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> Link to comment https://forums.phpfreaks.com/topic/92716-keeps-loading-same-page/ 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'])) { Link to comment https://forums.phpfreaks.com/topic/92716-keeps-loading-same-page/#findComment-475054 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 Link to comment https://forums.phpfreaks.com/topic/92716-keeps-loading-same-page/#findComment-475057 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. Link to comment https://forums.phpfreaks.com/topic/92716-keeps-loading-same-page/#findComment-475060 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> Link to comment https://forums.phpfreaks.com/topic/92716-keeps-loading-same-page/#findComment-475061 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. Link to comment https://forums.phpfreaks.com/topic/92716-keeps-loading-same-page/#findComment-475066 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 Link to comment https://forums.phpfreaks.com/topic/92716-keeps-loading-same-page/#findComment-475068 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 Link to comment https://forums.phpfreaks.com/topic/92716-keeps-loading-same-page/#findComment-475069 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.