jack_wetson Posted February 24, 2008 Share Posted February 24, 2008 when i run this script i just keep getting the form coming up and nothing being posted to the database <html> <body> <?php if ($submit) { //process form $db = mysql_connect("*****","*****","*****"); mysql_select_db("silversi_orders",$db); $sql = "INSERT INTO `ebay` (`ebayID`, `itemID`, `itemDes`, `email`, `Telephone`, `Status`) VALUES ('$ebayID', '$itemID', '$itemDes', '$email', '$Telephone', 'Ordered')"; $result = mysql_query($sql); echo "Thank You, Your Order Is Now Being Processed.\n"; ?> <br> <a href="http://www.silversidegaming.info"> Go back To The Homepage </a> <?php } else { //display form ?> <form method="post" action="<?php echo $PHP_SELF ?>"> Ebay Transaction ID:<input type="Text" name="ebayID"><br> Item ID:<input type="Text" name="itemID"><br> Item Description:<input type="Text" name="itemDes"><br> E-mail:<input type="Text" name="email"><br> Telephone:<input type="Text" name="Telephone"><br> <input type="Submit" name="submit" value="Process Ebay Transaction"> </form> <?php } //end if ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
PHP Monkeh Posted February 24, 2008 Share Posted February 24, 2008 Replace if ($submit) { with if (isset($_POST['submit'])) { Quote Link to comment Share on other sites More sharing options...
jack_wetson Posted February 24, 2008 Author Share Posted February 24, 2008 it does not process all the data now, the form goes through but does not submit to the database Quote Link to comment Share on other sites More sharing options...
Orio Posted February 24, 2008 Share Posted February 24, 2008 Unless you work with register_globals, you need to add $_POST['*'] around your vars in the query. Orio. Quote Link to comment Share on other sites More sharing options...
jack_wetson Posted February 24, 2008 Author Share Posted February 24, 2008 can you give an example , sorry im new to all of this code at this point:_ <html> <body> <?php if (isset($_POST['submit'])) { //process form $db = mysql_connect("localhost","*****","****"); mysql_select_db("silversi_orders",$db); $sql = "INSERT INTO `ebay` (`ebayID`, `itemID`, `itemDes`, `email`, `Telephone`, `Status`) VALUES ('$ebayID', '$itemID', '$itemDes', '$email', '$Telephone', 'Ordered')"; $result = mysql_query($sql); echo "Thank You, Your Order Is Now Being Processed.\n"; ?> <br> <a href="http://www.silversidegaming.info"> Go back To The Homepage </a> <?php } else { //display form ?> <form method="post" action="<?php echo $PHP_SELF ?>"> Ebay Transaction ID:<input type="Text" name="ebayID"><br> Item ID:<input type="Text" name="itemID"><br> Item Description:<input type="Text" name="itemDes"><br> E-mail:<input type="Text" name="email"><br> Telephone:<input type="Text" name="Telephone"><br> <input type="Submit" name="submit" value="Process Ebay Transaction"> </form> <?php } //end if ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
Orio Posted February 24, 2008 Share Posted February 24, 2008 <html> <body> <?php if (isset($_POST['submit']) { //process form $db = mysql_connect("*****","*****","*****"); mysql_select_db("silversi_orders",$db); $sql = "INSERT INTO `ebay` (`ebayID`, `itemID`, `itemDes`, `email`, `Telephone`, `Status`) VALUES ('".$_POST['ebayID']."', '".$_POST['itemID']."', '".$_POST['itemDes']."', '".$_POST['email']."', '".$_POST['Telephone']."', 'Ordered')"; $result = mysql_query($sql); echo "Thank You, Your Order Is Now Being Processed.\n <br> <a href=\"http://www.silversidegaming.info\"> Go back To The Homepage </a>"; } else { //display form ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Ebay Transaction ID:<input type="Text" name="ebayID"><br> Item ID:<input type="Text" name="itemID"><br> Item Description:<input type="Text" name="itemDes"><br> E-mail:<input type="Text" name="email"><br> Telephone:<input type="Text" name="Telephone"><br> <input type="Submit" name="submit" value="Process Ebay Transaction"> </form> <?php } //end if ?> </body> </html> Orio. Quote Link to comment Share on other sites More sharing options...
jack_wetson Posted February 24, 2008 Author Share Posted February 24, 2008 Parse error: syntax error, unexpected '{' in /home/silversi/public_html/purchase/ebay/index.php on line 6 it should be there should it not??? edit: typo Quote Link to comment Share on other sites More sharing options...
jack_wetson Posted February 24, 2008 Author Share Posted February 24, 2008 fixed there was a ) missing from the submit Quote Link to comment 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.