0

Hi
How are you guys
Im new learner in php and im coding a small script for orders and customers
and i hve problem

lets say
I have table with name of : Orders
id : int(11) - AUTO_INCREMENT
pizza : text - not null

and order form is like that

<?php
include "config.php";
echo '
<form method="POST" action="send2.php">
		<tr>
			<td width="240"><font class="ws14" face="Times New Roman" size="4">
			<b>Pepperoni</b></font></td>
			<td width="100" align="center">
			<input type="checkbox" name="pizza1" value="Chicken"></td>
			<td width="100" align="center">
			<input type="checkbox" name="pizza1" value="pepperoni"></td>
			<td align="center" width="100">
			<input type="checkbox" name="pizza1" value="bacon"></td>
			<td align="center" width="100">
			<input type="checkbox" name="pizza1" value="greenpapper"></td>
			<td align="center" width="100">
			<input type="checkbox" name="pizza1" value="hotpapper"></td>
		</tr>
';
?>

and the send2.php page "insert into mysql"

<?php
include "config.php";
$pizza = $_POST['pizza1'];


echo '<p align="center"><b><font face="Tahoma" color="red">Done<br></font><font face="Tahoma" color="lime" size="4">تم 
Done</font><font face="Tahoma" color="red"><br>DONNE </font><font face="Tahoma" color="blue"> 
PHP</font><font face="Tahoma" color="red">&nbsp;</font></b></p>';
$sql="INSERT INTO orders(pizza)VALUES('$pizza')";
$result =mysql_query($sql);
?>

if i check all boxes only the letter c is inserting to database
can u help me guys to do this
and if i check all boxes or more than one i want to insert the values into database

Thnkx

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by cgull
0

I don't know if that is the problem but you don't close the table and the form tags in your form.

I tried this:

echo '
	<form method="POST" action="send2.php">
	<table cellpadding="0" cellspacing="0" border="1">
		<tr>
			<td width="240"><font class="ws14" face="Times New Roman" size="4">
			<b>Pepperoni</b></font></td>
			<td width="100" align="center">
			<input type="checkbox" name="pizza1" value="Chicken">Chicken</td>
			<td width="100" align="center">
			<input type="checkbox" name="pizza1" value="pepperoni">Pepperoni</td>
			<td align="center" width="100">
			<input type="checkbox" name="pizza1" value="bacon">Bacon</td>
			<td align="center" width="100">
			<input type="checkbox" name="pizza1" value="greenpapper">Greenpepper</td>
			<td align="center" width="100">
			<input type="checkbox" name="pizza1" value="hotpapper">Hotpepper</td>
		</tr>
</table>
<input type="submit" value="submit" />
</form>';

In the send2.php I used echo $pizza and it printed: Chicken

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.