Jump to content

Php $_post Problems


giridharseel
 Share

Recommended Posts

Hello,my problem is that data in fields are not posted to another page,, plz explain i had build a test.html page,,the code in this page is <html><body><table width="100%" border="0"> <tr> <td><form name="form1" method="post" action="get.php"> <table width="100%" border="0"> <tr> <td colspan="2"><div align="center"><strong>Get Your Mysql Host Details</strong></div></td> </tr> <tr> <td width="14%">Mysql Host</td> <td width="86%"><label> <input name="host" type="text" id="host" size="45"> </label></td> </tr> <tr> <td>Mysql username</td> <td><label> <input type="text" name="username" id="username"> </label></td> </tr> <tr> <td>Mysql Password</td> <td><label> <input type="text" name="password" id="password"> </label></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="button" id="button" value="Submit"> </label></td> </tr> </table> </form> </td></tr></table> </body> </html>when i click the submit button it goes to the page called test1.phpthe code in this page is<?php$host=$_POST["host"];$username=$_POST["username"];$password=$_POST["password"];$con = mysql_connect("$host","$username","$password");echo "MySQL host info: " . mysql_get_host_info($con) . "</br>";echo "MYSQL server info: " . mysql_get_server_info($con) . "</br>";echo " MYSQL client info: " . mysql_get_client_info();?>

Link to comment
Share on other sites

i dont understand wat u mean action page in your terms, but i cannot understand watz the problem,,i think the problem is with php version (i think wat i am using is object oriented php)my server details goes here,, plz explain sir#Operating systemLinux#Apache version2.2.11 (Unix)#PHP version5.2.8#MySQL version5.0.67

Link to comment
Share on other sites

Your process page, the one the form is supposed to be sent to, is called test1.php. However, in your form, the destination is stated as get.php. So the data doesn't get through.Don't worry, your code is entirely procedural.

Link to comment
Share on other sites

Do some basic debugging. At the top of your script, add this:var_dump($_POST);See if there are any values there.Ater your call to mysql_connect(), add this:echo $con;If you have a true connection, you should get a resource ID.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...