AdminAccount.php
<?php
ob_start();
include 'connection.php';
$ses = $_SESSION['user_id'];
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
echo "<h3> User Account Information </h3>";
if (isset($_SESSION["user_id"] )) {
print "<table border=1 cellpadding='5' width = 100px height = 100px align='middle'>";
print "<th>username</ th>";
print "<th>Password</ th>";
print "<th>email</ th>";
print "<th>edit information</ th>";
print "<th>delete information</ th>";
$query = "SELECT * FROM Register";
$result = mysqli_query($connection, $query);
while ($row = mysqli_fetch_array($result)) {
echo " <tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td><a href='EditInfo.php?id=" . $row['user_id'] . "'>Edit</a></td>";
echo "<td><a href='DeleteInfo.php?id=".$row["user_id"] ."' > delete </a> ";
echo "</tr>";
//echo "<td><a href='EditInfo.php?id=" . $row['user_id'] . "'>Edit</a></td>";
}
echo "</table>";
}
if(isset($_POST['submit'])){
$query = ("UPDATE Register SET username = '$username' , password = '$password' , email = '$email' WHERE user_id='$ses'");
$result = mysqli_query($connection,$query);
header('location:ProtectedPage.php');
//Temporarily echo $query for debugging purposes
//run $query
}
EditInfo.php
<form method="post" action="AdminAccount.php">
<lable for ="Username" > Username: </lable> </br>
<input type="text" name="username" value=''/> </br>
<lable for ="Password" > Password: </lable> </br>
<input type="password" name="password" /> </br>
<lable for ="Email" > Email: </lable> </br>
<input type="email" name="email" /> </br>
<input type="submit" name="submit" value="submit" />
<input type="reset" value="clear" />
</form>
DeleteInfo.php
<?php
session_start();
include 'connection.php
$ses = $_SESSION['user_id'];
$query = "DELETE FROM Register WHERE user_id = " .$user_id;
$result = mysqli_query($query);
?>
My edit link works but when im clicking on delete I will be displayed with a blank page and the command will not have ran, any help as this is really annoying me.
Related
i want to edit my data in database called simple_stall with table order_detail...currently i have done a page that shows a list of data with No Name Ordered_Item Quantity. When user click the No, they'll be redirected to a new page that shows only the data of that he clicked.
Now, when user click on Edit button, they'll be redirected to a new page called update_info.php. Here is a form to change Name Ordered_Item and Quantity...but now when i click update order button, it will update all rows to be the data that user just put in...
What i want is to UPDATE only the data of that No that user click
this is the code
order_detail.php
<?php
include_once 'dbh.php';
$query = "SELECT * FROM order_detail"; //You don't need a ; like you do in SQL
$result = mysqli_query($connection, $query);
echo "<table border = 1px>"; // start a table tag in the HTML
while($row = mysqli_fetch_array($result))
{
$no = $row['No'];
//Creates a loop to loop through results
echo "<tr><td style = 'width:30px;'>" . "<a href='view_more.php?no=$no'>" .$row['No'] . "</td>
<td style = 'width:30%;'>" . $row['Name'] . "</td>
<td style = 'width:30%;'>" . $row['Ordered_Item'] . "</td>
<td>" . $row['Quantity'] . "</td></tr>"; //$row['index'] the index here is a field name
}
echo "</table>"; //Close the table in HTML
echo "<button type='button'><a href='./index.php'>Back</a></button>";
view_more.php
if (isset($_GET['no']))
{
include_once 'dbh.php';
$no = $_GET['no'];
$query = "SELECT * FROM order_detail WHERE No = '$no'";
$result = mysqli_query($connection, $query);
echo "<table border = 1px>"; // start a table tag in the HTML
while($row = mysqli_fetch_array($result))
{
//Creates a loop to loop through results
echo "<tr><td style = 'width:30px;'>" . $row['No'] . "</td>
<td style = 'width:30%;'>" . $row['Name'] . "</td>
<td style = 'width:30%;'>" . $row['Ordered_Item'] . "</td>
<td>" . $row['Quantity'] . "</td></tr>"; //$row['index'] the index here is a field name
}
echo "</table>"; //Close the table in HTML
echo "<button type='button'><a href='./update_info.php?no=$no'>Edit</a></button>";
echo "<button type='button'><a href='#'>Delete</a></button>";
echo "<button type='button'><a href='./order_detail.php'>Back</a></button>";
mysqli_close($connection);
update_info.php
<form action="update_data.php" method="POST">
<div>
<input type="text" name="NewName" placeholder="Name">
</div>
<div>
<input type="text" name="NewOrder" placeholder="Order">
</div>
<div>
<input type="text" name="NewQuantity" placeholder="Quantity">
</div>
<div>
<button type="submit" name="submit">Update Order</button>
</div>
</form>
update_data.php
if(isset($_POST['submit']))
{
include_once 'dbh.php';
$update = "UPDATE order_detail SET Name='$_POST[NewName]', Ordered_Item='$_POST[NewOrder]', Quantity='$_POST[NewQuantity]' ";
if (mysqli_query($connection, $update))
{
header("Location: ./order_detail.php");
exit();
}
else
{
header("Location: ./order_detail.php?update=failed");
exit();
}
}
Specify which order you want to update
look at the HTML and SQL I have change
<form action="update_data.php" method="POST">
<div>
<input type="text" name="NewName" placeholder="Name">
</div>
<div>
<input type="text" name="NewOrder" placeholder="Order">
</div>
<div>
<input type="text" name="NewQuantity" placeholder="Quantity">
</div>
<div>
<input type="hidden" name="No">
<!-- Specify which order you want to update -->
<button type="submit" name="submit">Update Order</button>
</div>
</form>
update_data.php
if(isset($_POST['submit']))
{
include_once 'dbh.php';
$update = "UPDATE order_detail SET
Name='$_POST[NewName]',
Ordered_Item='$_POST[NewOrder]',
Quantity='$_POST[NewQuantity]'
WHERE No = {$_POST['No']} ";
// add where clause in sql to specify which you want to update
if (mysqli_query($connection, $update))
{
header("Location: ./order_detail.php");
exit();
}
else
{
header("Location: ./order_detail.php?update=failed");
exit();
}
}
Use prepared statement, it is safer
Add the Where clause and pass your id whose value you want to edit.Have a look at code below
if(isset($_POST['submit']))
{
include_once 'dbh.php';
$update = "UPDATE order_detail SET Name='$_POST[NewName]', Ordered_Item='$_POST[NewOrder]', Quantity='$_POST[NewQuantity]' WHERE No='$_GET[no]' ";
if (mysqli_query($connection, $update))
{
header("Location: ./order_detail.php");
exit();
}
else
{
header("Location: ./order_detail.php?update=failed");
exit();
}
}
add a hidden input with the value of $no to your update_info.php like this
<form action="update_data.php" method="POST">
<input type="hidden" name="no" value="<?php $_GET['no']; ?>" />
<div>
<input type="text" name="NewName" placeholder="Name">
</div>
<div>
<input type="text" name="NewOrder" placeholder="Order">
</div>
<div>
<input type="text" name="NewQuantity" placeholder="Quantity">
</div>
<div>
<button type="submit" name="submit">Update Order</button>
</div>
</form>
and then change your sql query in update_data.php to be like this
"UPDATE order_detail SET Name='$_POST[NewName]', Ordered_Item='$_POST[NewOrder]', Quantity='$_POST[NewQuantity]' where = {$_POST['no']} ";
here is a bit of code im working on. Everything works expect that part where i enter ID, then it shows me information in that ID row and also 2 boxes pop where i can write new value of variable. There is also 2 buttons, one which comfirms the edit which has been written into boxes and second one to delete that row from database.
Im still at kinda basics at programming as you can see and im quessing there is something wrong with structure in this part of code?
Can anyone help me to make these 2 submit buttons work as they should.
Thanks you all. :)
if(isset($_POST['idnumber'])) {
$idnumber = protect($_POST['idnumber']);
global $idnumber;
if($idnumber == ""){
echo "Please supply all fields!";
}
else{
?>
<table cellpadding="2" cellspacing="2">
<br />
<tr>
<td width="50px"><b>ID</b></td>
<td width="150px"><b>Current name</b></td>
<td width="200px"><b>Current description</b></td>
<td width="100px"><b>Time added</b></td>
<td width="100px"><b>Current status</b></td>
</tr>
<?php
$get_tasks = mysqli_query($con, "SELECT id FROM task WHERE id='$idnumber'") or die(mysql_error());
while($row = mysqli_fetch_assoc($get_tasks)){
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
$get_taskname = mysqli_query($con, "SELECT taskname FROM task WHERE id='$idnumber'") or die(mysql_error());
$task_name = mysqli_fetch_assoc($get_taskname);
echo "<td>" . $task_name['taskname'] . "</td>";
$get_description = mysqli_query($con, "SELECT description FROM task WHERE id='$idnumber'") or die(mysql_error());
$description_text = mysqli_fetch_assoc($get_description);
echo "<td>" . $description_text['description'] . "</td>";
$get_dateadded = mysqli_query($con, "SELECT dateadded FROM task WHERE id='$idnumber'") or die(mysql_error());
$date_added = mysqli_fetch_assoc($get_dateadded);
echo "<td>" . $date_added['dateadded'] . "</td>";
$get_status = mysqli_query($con, "SELECT status FROM task WHERE id='$idnumber'") or die(mysql_error());
$cur_status = mysqli_fetch_assoc($get_status);
if($cur_status['status'] == 1) {
echo "<td>" . "Unfinished" . "</td>";
}
else{
echo "<td>" . "Finished" . "</td>";
}
echo "</tr>";
}
if(isset($_POST['edittask'])) {
$editname = protect($_POST['editname']);
mysqli_query($con, "UPDATE task SET taskname=$editname WHERE id='$idnumber'") or die(mysql_error());
}
elseif(isset($_POST['deletetask'])) {
mysqli_query($con, "DELETE FROM task WHERE id='$idnumber'") or die(mysql_error());
}
?>
<form action="test2.php" method="POST" >
<td width="50px"><b></b></td>
<td width="150px"><b>New name: <input type="text" name="editname"/></b></td>
<td width="200px"><b>New desc: <input type="text" name="editdesc"/></b></td>
<td width="100px"><b></b></td>
<td width="100px"><b>D</b></td>
<input type="submit" name="edittask" value="Edit task"/> <br />
<input type="submit" name="deletetask" value="Delete task"/> <br />
</form>
<?php
}
}
?>
</table>
<br /><br />
<form action="test2.php" method="POST" >
Insert ID of task to edit: <input type="text" name="idnumber"/>
<input type="submit" name="ids" value="Find task"/> <br />
</form>
I am new to PHP and I made a simple program where you can apply your name and age, it will take the data to the database and the table will be added with a new row.
I want to add a new column where you can click "change", only the data from that particular row will show up in a few textboxes and can be changed. when pressing submit I want to use the UPDATE function to update the records.
example/plot:
Mike Towards 23 Change
Tyler Frankenstein 24
Change Sophie Baker 22
Change
I want to change the age of Sophie Baker to 24 so I press Change on that row.
Now I only want to get the data from that row and make some changes.
The code I have this far:
Drawing the table above the input fields and the input:
$result = mysqli_query($con,"SELECT * FROM Persons");
echo "<table border='2'> <tr> <th>Voornaam</th> <th>Achternaam</th> <th>Leeftijd</th></tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "<td>" . $row['Age'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
<html>
<body>
<br />
<form action="insert.php" method="post"><br />
<input type="text" name="firstname"> Firstname <br />
<input type="text" name="lastname"> Lastname <br />
<input type="text" name="age"> Age
<p><input type="submit"></p>
</form>
</body>
</html>
Parser:
<?php
$con = mysqli_connect("localhost", "user" , "", "personInfo");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO Persons (FirstName, LastName, Age) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added to the database";
echo "<p><a href=sql2.php>Back to form</a></p>";
mysqli_close($con);
?>
I have tried a few things, but I cant figure out how to show the content on the row I want to select.
Change the actual data with the update function won't be the problem, so I only need help to get the actual data from the correct row.
you'd need to select with the primary key of that table if any exists. if not you should create one. I assume you have a primary key named PersonID:
$query = "SELECT * FROM Persons WHERE PersonID = '" . ($_GET['PersonID']) . "'";
to add the edit button:
echo "<table border='2'> <tr> <th>Voornaam</th> <th>Achternaam</th> <th>Leeftijd</th><th>Action</th></tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "<td>" . $row['Age'] . "</td>";
echo "<td><a href = '?PersonID=" . $row['PersonID'] . "'>Edit</a></td>";
echo "</tr>";
}
echo "</table>";
I assume you have a column named "id".
you can do the following:
<?php
$con = mysqli_connect("localhost", "user" , "", "personInfo");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// when you are in "edit mode" just display the row you will edit row
if (isset($_GET['id'])
$result = mysqli_query($con,"SELECT * FROM Persons where id = ".(int)$_GET['id']);
else
$result = mysqli_query($con,"SELECT * FROM Persons");
echo "<table border='2'> <tr> <th>Voornaam</th> <th>Achternaam</th> <th>Leeftijd</th></tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "<td>" . $row['Age'] . "</td>";
echo "<td><a href='?id=" . $row['id'] . "'>change</a></td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
<html>
<body>
<br />
<form action="update.php" method="post"><br />
<input type="hidden" name="id" value="<?php echo isset($_GET['id']?$_GET['id']:'') ?>" />
<input type="text" name="firstname" value="<?php echo isset($row['FirstName'])?$row['FirstName']:'' ?>"/> Firstname <br />
<input type="text" name="lastname" value="<?php echo isset($row['LastName'])?$row['LastName']:'' ?>"/> Lastname <br />
<input type="text" name="age" value="<?php echo isset($row['Age'])?$row['Age']:'' ?>"/> Age
<p><input type="submit"></p>
</form>
</body>
</html>
update.php (handle both insertion and update):
<?php
$con = mysqli_connect("localhost", "user" , "", "personInfo");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if (isset($_POST['id'])
$sql="UPDATE Persons set FirstName = ?, LastName = ?, Age = ?
WHERE id = ".(int)$_POST['id'];
else
$sql="INSERT INTO Persons (FirstName, LastName, Age) VALUES (?, ?, ?)";
$sth = mysqli_prepare($con, $sql);
$sth->bind_param($_POST[firstname],$_POST[lastname],$_POST[age]);
if (!$sth->execute())
{
die('Error: ' . mysqli_error($con));
}
echo "1 record ".(isset($_POST['id']?'modified':'added')." to the database";
echo "<p><a href=sql2.php>Back to form</a></p>";
I have a form that is generated in a table by a php loop. The form works fine except for the first one generated. I can't seem to figure out why. Here is my code, am i missing a closing somewhere?
while($row = mysql_fetch_array($result))
{
$msisdn = $row['msisdn'];
$messageid = $row['messageid'];
echo "<tr>";
echo "<td style='width:70px;'><center>" . $row['message-timestamp'] . "</td>";
echo "<td><center>" . $row['terpname'] . "</td>";
echo "<td>";
echo "<div class='layer1'>
<p class='heading'><B><U><font size='2' color='blue'>Reply</font></u></b> </p>
<div class='content'>
<fieldset >
<form name='reply' method='post' action='reply.php'>
<textarea rows='4' cols='50' name='response' value=''></textarea>
<input type='hidden' name='phonenumber' value='$msisdn' /><BR>
<input type='hidden' name='messageid' value='$messageid' /><BR>
<input type='submit' name='search' class='btn btn-info btn-large' value='Send' />
</form>
</fieldset>
</div>
</div>
";
echo "-->" . $row['text'];
//Select responses to this text message
$sqlselect = "SELECT * FROM li_appointments.li_outbound_sms
where messageid = '" . $row['messageid'] . "';";
$subresult = mysql_query($sqlselect);
//Loop through results and display them
while($row = mysql_fetch_array($subresult))
{
echo "<BR><--" . $row['sender'] . "(" . $row['datetime'] . "): " . $row['message'];
}
echo "</td>";
echo "<td style='width:10px;'><center><input type='checkbox' class='db' onclick='resetSelectAlldb();'name='database[]', value='$messageid'></center></td>";
echo "</tr>";
}
you should use prepare statements but anyway you can't use $row twice in the same function.
while($row = mysql_fetch_array($result))
{
$msisdn = $row['msisdn'];
$messageid = $row['messageid'];
echo "<tr>";
echo "<td style='width:70px;'><center>" . $row['message-timestamp'] . "</td>";
echo "<td><center>" . $row['terpname'] . "</td>";
echo "<td>";
echo "<div class='layer1'>
<p class='heading'><B><U><font size='2' color='blue'>Reply</font></u></b> </p>
<div class='content'>
<fieldset >
<form name='reply' method='post' action='reply.php'>
<textarea rows='4' cols='50' name='response' value=''></textarea>
<input type='hidden' name='phonenumber' value='$msisdn' /><BR>
<input type='hidden' name='messageid' value='$messageid' /><BR>
<input type='submit' name='search' class='btn btn-info btn-large' value='Send' />
</form>
</fieldset>
</div>
</div>
";
echo "-->" . $row['text'];
//Select responses to this text message
$sqlselect = "SELECT * FROM li_appointments.li_outbound_sms
where messageid = '" . $row['messageid'] . "';";
$subresult = mysql_query($sqlselect);
//Loop through results and display them
while($row2 = mysql_fetch_array($subresult))
{
echo "<BR><--" . $row2['sender'] . "(" . $row2['datetime'] . "): " . $row2['message'];
}
echo "</td>";
echo "<td style='width:10px;'><center><input type='checkbox' class='db' onclick='resetSelectAlldb();'name='database[]', value='$messageid'></center></td>";
echo "</tr>";
}
I'm new to PHP... I want to know how to populate a form from mySQL. I'm stumped at the input section where I am trying to allow the user to select choices for radio button /checkbox for each record. thanks in advance for anyone's help!
TC
Here's a snippet of my code:
<?php
$mQuantity = 1;
$con = mysql_connect("localhost","t","c");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("tc", $con);
/*
if request.form("itemname")<>" " then
cSQLAcct = "SELECT * FROM Restaurant_Menus WHERE Restaurant_ID='" & mRestaurant_ID & "' and Item like '%" & Request.Form("ITEMNAME") & "%' ORDER BY FOODTYPE, ITEM"
else
cSQLAcct = "SELECT * FROM Restaurant_Menus WHERE Restaurant_ID='" & mRestaurant_ID & "' ORDER BY FOODTYPE, ITEM"
end if
*/
// retrieve form data
$input = $_POST['itemname'];
echo $_POST['ITEM'];
$mItem = $_POST['ITEM'];
$mPrice = $_POST['PRICE'];
$mQuantity = $_POST['QUANTITY'];
$mOrderTotal = 0;
$mSide0 = '1';
$mOil = '1';
$mStarch = '1';
$mSalt = '1';
// use it
echo "You searched for: <i>$input</i>";
echo $mSessionID;
mysql_query("INSERT INTO OrderQueue (SessionID,item,quantity,price,no_oil,no_starch,no_salt,side0) VALUES ('$mSessionID','$mItem','$mQuantity','$mPrice','$mOil','$mStarch','$mSalt','$mSide0')");
/*
$sql="SELECT * FROM Restaurant_Menus
WHERE
Item like '%$input%'";
*/
$sql="SELECT * FROM OrderQueue
WHERE
SessionID = '$mSessionID'";
$result = mysql_query($sql);
//('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";
//echo $input;
//echo $sql;
/*
if ($input!=" "){
$result = mysql_query($sql);
}
// cSQLAcct = "SELECT * FROM Restaurant_Menus WHERE Restaurant_ID='" & mRestaurant_ID & "' and Item like '%" & Request.Form("ITEMNAME") & "%' ORDER BY
else
{ $result = mysql_query("SELECT * FROM Restaurant_Menus");
}
*/
$c=1;
$class[1] = 'odd';
$class[2] = '';
$array_no_oil = array();
$array_no_salt = array();
$array_no_starch = array();
$array_rice = array();
echo "<table border='1' width=500px>
<tr>
<th></th>
<th align=left>Item</th>
<th align=right>Price</th>
<th align=right>Quantity</th>
</tr>";
//<tr onMouseOver="this.bgColor = '#F3EB49'" onMouseOut ="this.bgColor = '#DDDDDD'" bgcolor="#DDDDDD">
while($row = mysql_fetch_array($result))
{
//echo '<tr class="'.$class[$c].'" onMouseOver='#F3EB49' onMouseOut ='#DDDDDD' bgcolor="#DDDDDD" >';
//echo "<tr class='odd'>";
//echo '<tr onMouseOver="this.bgColor = '#F3EB49'" onMouseOut ="this.bgColor = '#DDDDDD'" bgcolor="#DDDDDD">'
?>
<TR onMouseover="this.bgColor='#FFC000'"onMouseout="this.bgColor='#DDDDDD'">
<?php
/*
<form action="Orders.asp" method="post" target="_top" name="LogonForm">
<td><font size = 2>
<!--<%= mQuantity %>-->
<INPUT TYPE="TEXT" NAME="QUAN" VALUE="1" SIZE=2>
</font></td>
<td width=50px><font size = 2>
<INPUT TYPE=HIDDEN NAME=ITEM VALUE="<% =mItem %>">
<INPUT TYPE=HIDDEN NAME=PRICE VALUE=<% =mPrice %>>
<INPUT TYPE=HIDDEN NAME=RID VALUE= <% =mRestaurant_ID %>>
<INPUT TYPE=HIDDEN NAME=ADDITEM VALUE = "1">
<input id="Choices" class="findit" type="submit" value ="Order" />
</form>
*/
?>
<?php
// Obtain list of images from directory
//$img = getRandomFromArray($imgList);
}
?>
<?php
if ($row['Picture']!=" "){
echo "<td><a><img src='images/".$row['Picture'].".JPG' height=50px></a></td>";
}
else{
echo "<td></td>";
}
echo "<td width=200><b>" . $row['Item'] . "</b><br>
<input class='dropwidth' type='radio' name='$array_rice' value='1' selected>White Rice<br>
<input type='radio' name='$array_rice' value='2'>Pork Fried Rice<br>
<input type='radio' name='$array_rice' value='3'>Brown Rice<br>
<input type='checkbox' name='$array_no_oil' value='1' />No Oil
<input type='checkbox' name='starch' value='no oil' />No Starch
<input type='checkbox' name='salt' value='no salt' />No Salt
</td>";
echo "<td width=50 align=right>" . number_format($row['Price'],2) . "</td>";
$mQuantity = "'" . number_format($row['Quantity'],0) . "'";
$mPrice = "'" . number_format($row['Price'],2) . "'";
$mLineItemTotal = $row['Quantity'] * $row['Price'];
$mOrderTotal = (number_format($mOrderTotal,2) + number_format($mLineItemTotal,2));
echo $mOrderTotal;
$mLineItemTotal2 = "'". number_format($mLineItemTotal,2) . "'";
//echo "<td>" . $mQuantity. "</td>";
?>
<form action="orders.php" method="post" target="_top" name="LogonForm">
<td width="50" align=right><font size = 2>
<!--<%= mQuantity %>-->
<!--<INPUT TYPE="TEXT" NAME="QUANTITY" VALUE=<?php $mQuantity; ?>>-->
<INPUT TYPE="TEXT" NAME="QUANTITY" VALUE=<?php echo $mQuantity.";" ?>/>
</font></td>
<?php echo "<td width=50 align=right>" . $mLineItemTotal . "</td>";?>
<!--<td width=50px><font size = 2>-->
<!--<INPUT TYPE="TEXT" NAME="LINEITEMTOTAL" VALUE=<?php echo $mLineItemTotal.";" ?> WIDTH=10/>-->
<INPUT TYPE=HIDDEN NAME=ITEM VALUE=<?php $mItem ?> />
<INPUT TYPE=HIDDEN NAME=PRICE VALUE=<?php $mPrice ?>/>
<INPUT TYPE=HIDDEN NAME=RID VALUE=<?php $mRestaurant_ID ?>/>
<INPUT TYPE=HIDDEN NAME=ADDITEM VALUE = "1">
<!--<input id="Choices" class="findit" type="submit" value ="Order" />-->
</form>
<?php
echo "</tr>";
if($c==2) $c=0;
$c++;
}
echo "</table>";
echo "<div>".$mOrderTotal."</div>";
mysql_close($con);
?>
You should name your HTML form elements as such: MyElement[] when using them as arrays. For example:
<form method="post" name="myForm" action="myForm.php">
<select multiple name="myFormSelectMultiple[]">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
</form>
In this select multiple example, when the first two items are selected and then posted this form would produce similar output to the following:
array('myFormSelectMultiple' => array(1,2));
Hope this helps!