I have a page that receives variables in the URL, like so:
...ordering.php?id=sky3&set_albumName=Smith
in the receiving page, I retrieve the vars like this:
Then I'm trying to stuff these into a MySQL db like so:Code:$image1 = $_GET['id']; $client1 = $_GET['set_albumName'];
but it ain't workin'. I can echo $image1 and $client1 to the screen, so the values must be there, but they don't show up in my database fields. My other vars that I define from a form on this page get inserted fine; just not these two getting passed in. Anyone help me out? I don't understand why I can echo it to the screen, but not insert it into the database! I can assign the value to another variable, echo that to the screen, but if I plug it into the query, it still won't insert. wtf? I've tried getting the vars with $_GET, $_POST, $HTTP_GET_VARS... etc.Code:$query = "INSERT INTO dd_order (client, image) VALUES ('$client1', '$image1')";
Here's the whole page:
Code:<html> <head> <title>ordering</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF"> <form action="<?php echo $PHP_SELF ?>" method="POST"> <?php require("dd_upload_inc.php"); require("dd_functions.php"); function check_mysql() { if (mysql_errno() > 0) { die("<BR> MySQL error " . mysql_errno() . ": " . mysql_error()); } } $db = mysql_connect($host, $usr, $pw); if (!$db) { die("Failed to open connection to MySQL server."); } mysql_select_db("$dbname"); check_mysql(); //get posted vars... tried a number of variations here... $image1 = stripslashes($_GET['id']); $client1 = $_GET['set_albumName']; echo $client1; //echo works fine!!! but won't write to database... if (isset($placeorder)) { $query = "INSERT INTO dd_order"."(order_date, client, image, quantity, size, priceper, total, duedate) VALUES ('$order_date1', '$client1', '$image1', '$quantity1', '$size1', '$priceper1', '$total1', '$duedate1')"; $result = mysql_query($query); check_mysql(); } $order_date1 = trim($order_date1); $client1 = trim($client1); $image1 = trim($image1); $quantity1 = trim($quantity1); $size1 = trim($size1); $priceper1 = trim($priceper1); $total1 = trim($total1); $duedate1 = trim($duedate1); ?> <b>Order Prints <br> <br> </b> <table border="0" cellspacing="0" cellpadding="5"> <tr> <td align="right">Quantity:</td> <td> <input type="text" name="quantity1" size="4" maxlength="4" <?php echo "VALUE=\"$quantity1\"" ?>> </td> </tr> <tr> <td align="right">Size:</td> <td> <select name="size1"> <option selected>Choose...</option> <option value="wallets">Wallets</option> <option value="4x6">4 x 6</option> <option value="5x7">5 x 7</option> <option value="8x10">8 x 10 </option> <option value="11x14">11 x 14 </option> <option value="16x20">16 x 20</option> <option value="20x24">20 x 24</option> <option value="24x30">24 x 30</option> <option value="30x40">30 x 40</option> <option value="30x48">30 x 48</option> <option value="30x60">30 x 60</option> <option value="30x72">30 x 72</option> <option value="30x84">30 x 84</option> <option value="30x96">30 x 96</option> </select> (larger prints by request)</td> </tr> <tr> <td align="right">Turnaround:</td> <td> <select name="turnaround1"> <option selected>Choose...</option> <option value="1">24-Hour </option> <option value="4">4-Day </option> <option value="7">7-Day </option> </select> </td> </tr> </table> <input type="submit" name="placeorder" value="Place Order"> </form> </body> </html>





Bookmarks