Kristen G. Thorson wrote:
You said "If the user makes changes, those changes get error checked but
do not become part of the sql query." Where in your code is it failing
to become part of the query? Put a check at each level and see where
*exactly* it fails to get deep enough to become one with the query.
Also, I'm confused. I asked if the query was what you're expecting, and
you answered yes, which implies the data becomes part of the query.
Thanks for this; yes I was confused before and thank you for the
clarification.
Now I am confused by how to check the logic: I echo out the sql as it is
built, and if I'm going forward in the questionnaire it shows clearly but
$qidlist_sql="DELETE FROM teresa WHERE q_id IN (" .
(implode(",",$qidlist)) . ");";
echo "<br /><br />";
echo "<br />\$ cqidlist_sql:" . $qidlist_sql . "<br />";
$q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";
mysql_query($qidlist_sql);
echo "<br /><br />";
echo "<br />\$ q_a_sql:" . $q_a_sql . "<br />";
if($q_a_result = mysql_query($q_a_sql))
{
unset($_SESSION['required_fields']);
$cat = $_POST['cat']+1;
include_once(QUESTIONS . 'q.inc');
}
shows NOTHING if I hit the BACK button. I'm still not seeing where the
logic error is which makes it so that when I hit the BACK button it
loses the plot.
Sorry for my misunderstanding
JJ
kgt
Jack Jackson wrote:
I've tried playing with the $_SERVER['HTTP_REFERER'] and that's no
good because it's all coming from the same page - index.php!!
What am I missing. . . ?
Jack Jackson wrote:
Hi Kristen, there's a misunderstanding:
Kristen G. Thorson wrote:
The code below isn't much help to debug. Do some checking to figure
out how far into your IF statement you're getting. Is the query
running?
Yes it runs successfully
Is it the query you expect?
Yes it is perfect, and provided this is a new session and we're going
forward page by page, it properly deletes from and inserts to the db
as expected
(Step #1 when inserting or creating dynamic
queries that aren't working: print them out to make sure they are
what you think they are.) Is the category being incremented?
Yes, absolutely
You say you can go back, but you can't go forward.
Actually no. In a new session, I can start and go forward page by
page to the end of the questionnaire, advancing each stage perfectly,
storing all values exactly as I'd expect.
The trouble starts if, during the process, the user hits the BACK
button. At that point, user can reload the last page of questions,
displaying the answers they gave. If the user makes changes, those
changes get error checked but do not become part of the sql query.
Also, user can not move forwards any more. So it's as the subject
says - everything works...until they hit the back button, from which
point the whole thing goes gablooey.
Look at the page source, is the
form action what it should be?
Yes
Look at the form hidden variables (if
any) are they what you expect?
No. $cat remains what it was BEFORE the user hit the BACK button.
However the questions dispayed are from the $cat which is in fact $cat-1
??!!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php