Forum Moderators: coopster
Here is the PHP code in question. Any help with this would be greatly appreciated. I'm new to PHP (Within the last 48-72 hours. Can't remember it exactly how long. the days are kinda blurred.):
94. <?php
95. // open the connection
96. $conn = mysql_connect("localhost", "username", "password");
97. // pick the database to use
98. mysql_select_db("mnmelect_cart",$conn);
99. // create the SQL statement
100. $sql = "INSERT INTO cart values ('', '$PHPSESSID', '$_POST['itemnumber']', '$_POST['itemname']', '$_POST['itemprice']', '', '1', '', '')";
101. // execute the SQL statement
102. if (mysql_query($sql, $conn)) {
103. echo "$itemname added to cart!";
104. } else {
105. echo "Error: Auction Item not added. Please try again.";
106. }
107.?>
Here is my current code:
163. <form method="post" action="auction_payment_buy.php">
164. <input type="hidden" name="itemid" value="$itemnumber">
165. <input type="hidden" name="itemname" value="$itemname">
166. input type="hidden" name="itemprice" value="$itemprice">
167. <input type="submit" name="Submit" value="Add to Cart">
168. </form>
With that it just puts the $variblename as the value, and not the contents of the varible.
Reason being is, they type in the Ebay Auction ID, which finds their item, showing them the Item Name, ID, and Price. They can then click add to cart, and it add the info to the cart. Which is on the third page that you guys just got working for me.
But now I see that it's not adding the varible contents to the form to send it to the last page.
Any more help you guys can give is GREATLY appreciated. :)
Justin
="<?php print "$itemnumber";?>
and
="<?php echo "$itemnumber";?>
both made the submit button dissapear even though they didn't effect the button itself :S
And HelenDev, where are you suggesting putting that code? In place of the HTML form? If so, would the input code for the button need to be in HTML or PHP code?
Thanks for all the suggestiosn everyone.
Justin
Now you have to comment out the " with the \ to make sure it does not think the code has ended
If I use single quotes in my print('<html here>'); then I do not need to comment out double quotes, it works fine.
Reaper, on many of my pages I put almost all my html code within php code. You could put your whole form in there...
print('
<form>
<input etc, etc.>
</form>
');
So again, thank you, and I look forward to enjoying more time on here discussing more about PHP and other languages with you guys. (Especially once I get sleep and then learn more about the languages. LOL)
Thanks,
Justin