NYCPHP Meetup

NYPHP.org

[nycphp-talk] Question

ken wu ken_11223 at yahoo.com
Mon Jun 10 18:55:37 EDT 2002


are you running php4.1.2 or above? i know it is
slightly different to deal with the form variables if
u running such versions of php.  For example. u have
to echo $HTTP_POST_VARS['first'} which is the form
variables.  But i know that if u use the php 4.0.6 or
below. u don't have to do so. just simply use $first
or $last.  


 
--- Larry Chuon <LarryC at indexstock.com> wrote:
> <paralist>This message contained 1 file(s) and is
> available at
>
http://nyphp.org/list/paralist_archive.html?L_mid=364</paralist>
> 
> I'm working on a sample code and have some
> questions.  My php and html files
> are below.  I'm running on IIS and MySQL.  This code
> gives me the following
> error:
>  
>  
> Notice: Undefined variable: first in
> d:\\example\\datain.php on line 5
> 
> Notice: Undefined variable: last in
> d:\\example\\datain.php on line 5
> 
> Notice: Undefined variable: nickname in
> d:\\example\\datain.php on line 5
> 
> Notice: Undefined variable: email in
> d:\\example\\datain.php on line 5
> 
> Notice: Undefined variable: salary in
> d:\\example\\datain.php on line 5
> Thank you! Information entered. 
>  
> If I add the following lines prior to the insert
> statement, it works fine.
> $first = $HTTP_POST_VARS['first'];
> 
> $last = $HTTP_POST_VARS['last'];
> 
> $nickname = $HTTP_POST_VARS['nickname'];
> 
> $email = $HTTP_POST_VARS['email'];
> 
> $salary = $HTTP_POST_VARS['salary'];
> 
> Why do I need $HTTP_POST_VARS???? Thanks in advance.
>  
> --------------------
>  
> datain.php
> <html>
> 
> <?php
> 
> $db = mysql_connect("172.21.6.25","root","123456");
> 
> mysql_select_db("learndb",$db);
> 
> $sql="insert into personnel (firstname, lastname,
> nick, email, salary)
> VALUES
> ('$first','$last','$nickname','$email','$salary')";
> 
> $result = mysql_query($sql);
> 
> echo "Thank you! Information entered.\
";
> 
> ?>
> 
> </html>
> 
>  
> datain.html
> <html>
> 
> <body>
> 
> <form action="datain.php" method="post">
> 
> First name:<input type="text" name="first"><br>
> 
> Last name:<input type="text" name="last"><br>
> 
> Nick name:<input type="text" name="nickname"><br>
> 
> E-mail:<input type="text" name="email"><br>
> 
> Salary:<input type="text" name="salary"><br>
> 
> <input type="Submit" name="submit" value="Enter
> information">
> 
> </form>
> 
> </body>
> 
> </html> 
> 
> 
> 


=====
Ken Wu

718-788-0661
168 35 Street Apt 2
Broooklyn, NY 11232-2320

http://www.kenfile.com

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the talk mailing list