Jump to content

Recommended Posts

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.