Jump to content

Getting form values


Schlo_50

Recommended Posts

Hi there,

 

I need help in getting some form values from my price list back into my ms access database. I have so far been trying to get all selected check boxes on the page, quantity text fields and ordernotes text area to INSERT INTO my database but to no avail. Im using OBDC to add to the confusion.

 

I've tried to develop my 'product' script into some kind of a form, but now need to find out how to make the data i want variable so that i can send them into my database.

 

Product.php

 

<form action="?id=inc/order" method="post" name="orderform">
<?php
include('odbc.php');
$sql = odbc_exec($odbc, "SELECT * FROM Product1 ORDER BY CategoryName") or die (odbc_errormsg());

$prevCat='';
while($row = odbc_fetch_array($sql))
{
$Category = $row["CategoryName"];
$ProductId = $row["ProductId"];
$ProductName = $row["ProductName"];
$Price = $row["Price"];

// has category changed
// if so, print it
if ($Category != $prevCat)  {
	echo "<h2>$Category</h2>";
}
echo  'Item Code: ', $ProductId, '<br/>Item Name:  ', $ProductName, '<br/><br/>Price: £', $Price, '    | Order: <input name=checker type=checkbox /> Quantity: <input name=quan type=text maxlength=5 size=3 /><br/><br/>';

$prevCat = $Category;
}
?>
<hr />
(Order Notes- If you have any comments to make about any of the products you are ordering please state them below.)<br />
<textarea name="ordernotes" cols="75" rows="5"></textarea><br /><br />
<input name="submitBtn" type="Submit" value="Submit Order" />
</form>

 

Any help would appreciated, or if you need any more information or questions please do PM me.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/73608-getting-form-values/
Share on other sites

change line

echo  'Item Code: ', $ProductId, '<br/>Item Name:  ', $ProductName, '<br/><br/>Price: £', $Price, '    | Order: <input name=checker type=checkbox /> Quantity: <input name=quan type=text maxlength=5 size=3 /><br/><br/>';

to

echo  'Item Code: ', $ProductId, '<br/>Item Name:  ', $ProductName, '<br/><br/>Price: £', $Price, '    | Order: <input name="checker[', $ProductId, ']" type="checkbox" /> Quantity: <input name="quan[', $ProductId, ']" type="text" maxlength="5" size="3" /><br/><br/>';

Link to comment
https://forums.phpfreaks.com/topic/73608-getting-form-values/#findComment-371477
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.