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
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
Share on other sites

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.