gfmaking Posted June 23, 2006 Share Posted June 23, 2006 what is wrong with this code? can any one help please. I have tried evrything<?$username="gfm";$password="chris";$database="Order_db";$host="localhost";$First_Name=$_POST['First_Name'];$Last_Name=$_POST['Last_Name'];$Address=$_POST['Address'];$City=$_POST['City'];$State=$_POST['State'];$Zip=$_POST['Zip'];$Country=$_POST['Country'];$Phone=$_POST['Phone'];$E-Mail=$_POST['E-Mail'];$Product_01=$_POST['Product01'];$Product_02=$_POST['Product02'];$connection = mysql_connect($host,$username,$password)or die( "Unable to connect to server");$db= mysql_select_db($database,$connection) or die( "Unable to select database");$query = "INSERT INTO Order_Form (First_Name, Last_Name, Address, City, State, Zip, Country, phone, E-mail, Product01, Product02) VALUES ('$First_Name','$Last_Name','$Address','$City','$State','$Zip','$Country','$phone','$E-mail','$Product01','$Product02')";$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); // see the problemif($result) {echo "Thank You For your Order";}mysql_close();?> Quote Link to comment https://forums.phpfreaks.com/topic/12724-php-form-help/ Share on other sites More sharing options...
AndyB Posted June 23, 2006 Share Posted June 23, 2006 What's wrong with it? What does it do? What doesn't it do that you expect? What error messages does it generate? I'm skeptical about the username and database name you use in your code. Normally, the username and database name have your web account username as part of them. Don't post your real database access details (you never know who's reading these posts), but do check that what you are using makes sense. Quote Link to comment https://forums.phpfreaks.com/topic/12724-php-form-help/#findComment-48768 Share on other sites More sharing options...
rscott7706 Posted June 23, 2006 Share Posted June 23, 2006 I am a newbie also, but I think one problem is using e-mail. PHP wants to see this as e minus mail - mathmatical operation. Make it email. And just a suggestion - whay not first or fn and last or ln instead of the long winded titles you have. Quote Link to comment https://forums.phpfreaks.com/topic/12724-php-form-help/#findComment-48771 Share on other sites More sharing options...
AndyB Posted June 23, 2006 Share Posted June 23, 2006 [!--quoteo(post=387148:date=Jun 23 2006, 09:19 AM:name=RonScott)--][div class=\'quotetop\']QUOTE(RonScott @ Jun 23 2006, 09:19 AM) [snapback]387148[/snapback][/div][div class=\'quotemain\'][!--quotec--]I am a newbie also, but I think one problem is using e-mail. PHP wants to see this as e minus mail - mathmatical operation. Make it email. [/quote]Great catch, Ron. MySQL would choke on e minus mail (and error trapping in the OP's script should show that). Quote Link to comment https://forums.phpfreaks.com/topic/12724-php-form-help/#findComment-48793 Share on other sites More sharing options...
gfmaking Posted June 23, 2006 Author Share Posted June 23, 2006 Hi Andy,I used HTML Form to submit contact and order info to my mysql database. When Submiting the form balnk page apears & nothing was been inserted in to the database. Of course I used "post" method for my HTML form and I saved the above code in to action.php file.Please look in to it. Quote Link to comment https://forums.phpfreaks.com/topic/12724-php-form-help/#findComment-48867 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.