Hi Adam,

I think that you have to put the header command before anything else. (that 
is, putting the header (Location:X) command at the bottom of your block 
might be the trouble)

If putting it somewhere else in your script doesn't work, how about:

         echo "<html><head>";
         echo "<meta http-equiv='refresh' content='1; 
URL=http://www.example.com'>";
         echo "</head>";

...at the top of your if($submit) block, assuming magic quotes are on. This 
will refresh the page after 1 second to www.example.com, and I think that 
spitting out that HTML will have no bearing on the executing of the rest of 
the script (so your query will execute, or try to). If, for some reason, 
the redirect doesn't happen automatically, or if 1 second isn't fast enough 
for the user, you could add:

         echo "<body>Record updated. If this page does not automatically 
refresh after 1 second, you can proceed by clicking <a 
href='www.example.com'>here</a>.</body>";

This assumes, of course, that you have immense confidence in your database 
and query. You might want to check for the query's success before asserting 
that everything's OK and redirecting.

-Colin Odden
(OSU Sociology)

>On Mon, 26 Aug 2002, Gerd Ulrich wrote:
>
> > Hello, I want to build a questionaire where the user is guided through five
> > pages of questions. How can I program PHP that the user gets to the second
> > page after pushing the "Submit"-Button?
> > My solution printed here doesn't work.
> > Any hints are greatly apreciated!
> >
> > S. Maier
> >
> > <?php
> > if ($submit) {
> >  // process form
> > require ('.htmypasswd');
> > $verbnr = mysql_connect ($dbhost,$dbuser,$dbpasswd);
> > $db = mysql_connect($dbhost,$dbuser,$dbpasswd);
> > mysql_select_db("pretest",$db);
> > $sql = "INSERT INTO frage3 (a1,a2,a3,be_fe01,be_fe02) VALUES
> > ('$a1','$a2','$a3','$be_fe01','$be_fe02')";
> > $result = mysql_query($sql);
> > header ("Location: http://www.example.com";);
> > exit;
> > } else{
> >   // display form
> > ?>
> >
> >
> >
> >
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to