RE: [PHP-GENERAL] Greetings and Help With Forms CORRECTION
| From: | Christopher Thompson | Date: | Fri, 09 Jun 2000 21:14:35 +0000 |
| Subject: | RE: [PHP-GENERAL] Greetings and Help With Forms CORRECTION | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1448@lists.php.net to get a copy of this message | ||
I noticed an error in my previous posting. See changes in mypage2.php:
myform.inc:
<FORM ACTION="mypage2.php" METHOD="post">
...
<INPUT TYPE="submit" NAME="submit" VALUE="Submit">
</FORM>
mypage1.php:
include('myform.inc');
mypage2.php:
if($submit){
# process form
}
if($error){
include('myform.inc');
}else{
# show confirmation
}
> -----Original Message-----
> From: Christopher Thompson [mailto:ct@arborinternet.com]
> Sent: Friday, June 09, 2000 12:41 PM
> To: Phillip S. Baker; php-general@lists.php.net
> Subject: RE: [PHP-GENERAL] Greetings and Help With Forms
>
>
> I tend to use two pages and a common include file for this. You can also
> use JavaScript to check the form on the client side.
>
> myform.inc:
> <FORM ACTION="mypage2.php" METHOD="post">
> ...
> <INPUT TYPE="submit" NAME="submit" VALUE="Submit">
> </FORM>
>
> mypage1.php:
> include('myform.inc');
>
> mypage2.php:
> if($submit){
> # process form
> }else{
> include('myform.inc');
> }
>
>
> > -----Original Message-----
> > From: Phillip S. Baker [mailto:phillip@wordsandimages.com]
> > Sent: Friday, June 09, 2000 12:27 PM
> > To: php-general@lists.php.net
> > Subject: [PHP-GENERAL] Greetings and Help With Forms
> >
> >
> > Greetings all,
> >
> > My Name is Phillip.
> >
> > I am new to programming and PHP. I just started late last week to
> > learn both of these web development tools.
> >
> > I am dropping a note as I am creating a form in PHP to handle data
> > and load it into a MySQL DB. The question I have is what parameters
> > do I use to pass the user to a specific page after they enter
> > information into form.
> >
> > The code I am basing this off of is from the webmonkey tutorial.
> >
> >
> > <?php
> > if ($submit)
> > {
> > //Process the form
> > $db = mysql_connect("localhost", "root");
> > mysql_select_db("test",$db);
> > $sql = "insert into employees
> > (first,last,address,position) values
> > ('$first','$last','$address','$position')";
> > $result = mysql_query($sql);
> > echo "Thank you! Information entered.\n";
> > }
> >
> > else
> > {
> > //Display the form to fill out
> > ?>
> >
> > <FORM ACTION="<?php echo $PHP_SELF?>" METHOD="post">
> > First Name: <INPUT TYPE="text" NAME="first"
> > SIZE="20"><BR>
> > Last Name: <INPUT TYPE="text" NAME="last"
> > SIZE="20"><BR>
> > Address: <INPUT TYPE="text" NAME="address"
> > SIZE="20"></TEXTAREA><BR>
> > Position: <INPUT TYPE="text" NAME="position"
> > SIZE="20"><BR>
> > <INPUT TYPE="submit" NAME="submit" VALUE="Enter
> > Information">
> > </FORM>
> > <?php
> > //Close the if statment
> > }
> > ?>
> >
> >
> > So basically instead of the echo statement when someone submits the
> > form. I would like to take them to another URL.
> >
> > How would I specify that?
> >
> > Thanks
> >
> > Phillip
> > --
> >
> > Phillip S. Baker
> >
> > phillip@wordsandimages.com
> > Words & Images, Inc.
> > 1535 Seabright Avenue, Suite 100, Santa Cruz, CA 95062
> > Direct Line (831) 420-2641 / Fax (831) 458-0808
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>