Jump to content

PHP Form set tp


gfmaking

Recommended Posts

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();
?>

Link to comment
Share on other sites

[!--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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.