Re: How do I submit data AND send user to other page?
| From: | John Coder | Date: | Mon, 26 Aug 2002 23:25:29 +0000 |
| Subject: | Re: How do I submit data AND send user to other page? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21378@lists.php.net to get a copy of this message | ||
On Mon, 2002-08-26 at 13:25, 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
> ?>
easiest way I know to do it is in your form action . as in <form
action="new_page.php> you then can put the above code on that page and
it will process it and still print out the page you want.