gfmaking Posted June 21, 2006 Share Posted June 21, 2006 I want people to fill out my form, which is contact information, and I want the info directly load in to mysql database. Please look the PHP code. On the HTML form I inserted <form method="post" form action="action.php"> what is wrong? my database is running on my webhosting server in one of the sub folders. please please some one help me.<?$username="myuser";$password="mypass";$database="Order_db";$First_Name=$_POST['First_Name'];$Last_Name=$_POST['Last_Name'];$Address=$_POST['Address'];$City=$_POST['City'];$State=$_POST['State'];$Zip_Code=$_POST['Zip'];$Country=$_POST['Country'];$phone=$_POST['phone'];$E-Mail=$_POST['E-mail'];$Product_01=$_POST['Product01'];$Username8=$_POST['Product02'];mysql_connect('genesis.com/fpdb/php/index.php',$username,$password);@mysql_select_db($database) or die( "Unable to select database");$query = "INSERT INTO contacts VALUES ('','$First_Name','$Last_Name','$Address','$City','$State','$Zip','$Country','$phone','$E-mail','$email','$Product01','$Product02')";mysql_query($query);mysql_close();?> Quote Link to comment https://forums.phpfreaks.com/topic/12586-php-form-set-tp/ Share on other sites More sharing options...
michaellunsford Posted June 21, 2006 Share Posted June 21, 2006 Mysqlconnect typically gets the value "localhost" -- not a php file location. you might check to make sure you're connecting to the right place.Also, if your action is to action.php, I would assume the code you showed in your post is actually named "action.php" Quote Link to comment https://forums.phpfreaks.com/topic/12586-php-form-set-tp/#findComment-48237 Share on other sites More sharing options...
gfmaking Posted June 21, 2006 Author Share Posted June 21, 2006 [!--quoteo(post=386600:date=Jun 21 2006, 05:54 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 21 2006, 05:54 PM) [snapback]386600[/snapback][/div][div class=\'quotemain\'][!--quotec--]Mysqlconnect typically gets the value "localhost" -- not a php file location. you might check to make sure you're connecting to the right place.Also, if your action is to action.php, I would assume the code you showed in your post is actually named "action.php"[/quote]Thanx for your response,I put my action.php on my rootweb and edit to "localhost" but when submiting the form the browser point to action.php and show blank page. Quote Link to comment https://forums.phpfreaks.com/topic/12586-php-form-set-tp/#findComment-48242 Share on other sites More sharing options...
michaellunsford Posted June 21, 2006 Share Posted June 21, 2006 it is very likely that you posted data to the mysql database. check your database and see if the new stuff has been added.If not, you might consider adding a [code]echo mysql_error();[/code] line after the mysql_query to make sure you didn't get an error.you might also consider adding something to this page... "thanks for filling out the form" etc, so the users don't get a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/12586-php-form-set-tp/#findComment-48248 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.