ReeceSayer Posted May 9, 2009 Share Posted May 9, 2009 Okay so i have the following code: <?php require_once "header.php"; echo "". $_SESSION['username']; echo " You are currently logged in " ; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <br><br> <form action="authenticateorder.php" method="POST"> <!-- you can use another action if you'd like --> <fieldset> <legend>Order</legend> <label>Ham:</label><br> <input type="text" name="Qtyham" id="Qtyham" size="2" maxlength="2"><br> <label>Cheese:</label><br> <input type="text" name="Qtycheese" id="Qtycheese" size="2" maxlength="2"><br> <label>BLT:</label><br> <input type="text" name="QtyBLT" id="QtyBLT" size="2" maxlength="2"><br> <label>Coca-Cola:</label><br> <input type="text" name="QtyCoke" id="QtyCoke" size="2" maxlength="2"><br> <label>Fanta</label><br> <input type="text" name="QtyFanta" id="QtyFanta" size="2" maxlength="2"><br> <label>Dr. Pepper:</label><br> <input type="text" name="QtyDrPepper" id="QtyDrPepper" size="2" maxlength="2"><br> <form method="POST" action="my_form_server_program"> <p> <input type="radio" name="Headingly" value="Headingly"/>Headingly <input type="radio" name="Harrogate" value="Harrogate"/>Harrogate <input type="radio" name="Wakefield" value="Wakefield"/>Wakefield <input type="radio" name="Dewsbury" value="Dewsbury"/>Dewsbury </p> </form> <input type="submit" name="submit" id="submit" value="Submit"> <a href="logout.php"> Logout </a> </fieldset> </form> </html> <?php require_once "footer.php"; ?> Which sends the results to my database yet when i go on the database the QtyCoke, QtyFanta & QtyDrPepper results are all missing... authenticate.php: <?php require_once "rehome.php"; if(!isset($_SESSION['username']) || !isset($_SESSION['sid']) ||!isset($_SESSION['ip'])) { header("Location: login.php"); exit; } // Include the database connection file. include("connection.php"); // Check if a person has clicked on submit. if(isset($_POST['submit'])) { // Create variables from each $_POST. $username = $_SESSION['username']; $Qtyham = $_POST['Qtyham']; $Qtycheese = $_POST['Qtycheese']; $QtyBLT = $_POST['QtyBLT']; $QtyCoke = $_POST['QtyCoke']; $QtyFanta = $_POST['QtyFanta']; $QtyDrPepper = $_POST['QtyDrPepper']; // Create a variable containing the SQL query. $query = "INSERT INTO `sandwich` (username, Qtyham, Qtycheese, QtyBLT, QtyCoke, QtyFanta, QtyDrPepper) VALUES ('$username', '$Qtyham', '$Qtycheese', '$QtyBLT', 'QtyCoke', 'QtyFanta', 'QtyDrPepper')"; // Perform the SQL query on the database. $result = mysql_query($query); // If the query failed, display an error. if(!$result) { echo "Your query failed. " . mysql_error(); // The dot seperates PHP code and plain text. } else { // Display a success message! echo "Thanks " . $username . " Your Order Has Been Confirmed<br>"; echo "You Will Be Redirected Shortly"; }} require_once "footer.php"; ?> Also... How would I go about using the radio buttons to input something like a yes/no field into my database? So i can see which delivery centre the product needs to go to? Thanks Again & Sorry for all of the posts today! Link to comment https://forums.phpfreaks.com/topic/157527-solved-form-trouble-sorry-for-all-the-posts-today/ Share on other sites More sharing options...
ReeceSayer Posted May 10, 2009 Author Share Posted May 10, 2009 yeah just reread the code... this topic can be deleted... i missed 3 $ signs from the beggining of a string...thanks Link to comment https://forums.phpfreaks.com/topic/157527-solved-form-trouble-sorry-for-all-the-posts-today/#findComment-830620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.