To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Upgrading PHP

Upgrading PHP Issues concerning PHP version upgrades and future releases

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-24-2004, 03:01 PM   #1
avneet
Junior Member
 
Join Date: Jul 2004
Posts: 3
Variables are not automatically getting the values as filled in the html form

I just started connecting PHP5 with mysql 5.0.0-alpha.
i had made a html file with the following code:
<HTML>
<BODY>
<form method="post" action="detain.php">
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>
</HTML>

Then i had coded the relavant detain.php with the following code:
<HTML>
<?php
$db = mysql_connect("localhost", "root","");
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.\n";
?>
</HTML>

The problem i am facing is that no values are stored in the variables $first, $last, $nickname,$email,$salary and hence, a simple blank row is inserted in the database.

Can anybody help me in finding out why aren't the values from the form are automatically stored in the variables with the same name as of the fields?

Thanks,
Avneet
avneet is offline   Reply With Quote
Old 07-24-2004, 03:20 PM   #2
tekky
the stand in Telepath
 
tekky's Avatar
 
Join Date: Jul 2003
Location: College Station, Texas
Posts: 2,293
try reading about $_POST here...
__________________
-Karl
Problem solved? Mark your thread resolved!
See how many times my link has been used to mark a thread resolved here
(fixed to work with updated VBulletin... this works again!)
tekky is offline   Reply With Quote
Old 07-25-2004, 02:25 AM   #3
avneet
Junior Member
 
Join Date: Jul 2004
Posts: 3
Thumbs up

Thanks Karl.
After setting "register_globals = On" in the php.ini file, i was able to resolve the problem.
avneet is offline   Reply With Quote
Old 07-25-2004, 03:32 AM   #4
Weedpacket
Custom User Title™
 
Weedpacket's Avatar
 
Join Date: Aug 2002
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,128
Quote:
Originally posted by avneet
Thanks Karl.
After setting "register_globals = On" in the php.ini file, i was able to resolve the problem.
*****BZzzzzt!! Wrong answer!
Quote:
For related information on this change, read the configuration entry for register_globals, the security chapter on Using Register Globals , as well as the PHP 4.1.0 and 4.2.0 Release Announcements.

Using the available PHP Reserved Predefined Variables, like the superglobal arrays, is preferred.
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
Weedpacket is offline   Reply With Quote
Old 07-25-2004, 05:06 AM   #5
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
Since when did the PHP 5 forum become Wheel of Fortune
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 11:48 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.