Jump to content

Difficult Forms Problem


Fearpig

Recommended Posts

Hi guys,
This isn't a coding problem more of a method problem...

I've set up a page where people can request literature in volumes of 1, 25, 50 or a box. The page scans a database and for each bit of literature it creates a new set of radio buttons so that you can tick either 1, 25, 50 or box for each bit of literature.

I then wanted to submit this form as an e-mail to the person responsible. Unfortunately I don't know which variables are going to be passed to the processing page as that depends on which manuals are listed on the form (by which ones are in the database).

The form works correctly but I have no idea how to process it as of yet. Can anyone suggest a moethod or tutorial? This has been bugging me for a couple of days now. :-\

[code]
<p class="Body2">Documentation Request Form </p>
<form name="LiteratureRequestForm" method="post" action="ProcessingPage.php">

<?php

$sql="SELECT * FROM BR_01_PRODF_0001 WHERE Product_Group = 'Literature'";
$result=odbc_exec($conn,$sql);
if (!$result)
      {exit("Error in SQL");}


echo "<table width=250 border=0 class='Body3'>\n";
echo "<tr><th class='Body2' align=center bgcolor=#CCCCCC><b>Manuals</b></th></tr>\n";

while (odbc_fetch_row($result))
{
$PartNo=odbc_result($result,"BR_PR_PARTNO");
$Description=odbc_result($result,"BR_PR_StockFullDescr");
echo "<tr><td><fieldset>
<legend>$Description</legend>
<input type='radio' name='$PartNo' value='1' id='1'>1
<input type='radio' name='$PartNo' value='25' id='25'>25
<input type='radio' name='$PartNo' value='50' id='50'>50
<input type='radio' name='$PartNo' value='Box' id='Box'>Box
</fieldset></td></tr>\n";
}

echo "</table>\n";
?>

</form>[/code]

Any help would be appreciated.  ;D
Link to comment
https://forums.phpfreaks.com/topic/24215-difficult-forms-problem/
Share on other sites

On your processing page, just process all of the values like this, that way you have no need to know what the values are:

[code]
<?php
echo "Please order me the following:\n";
foreach ($_POST as $part => $qty){
  echo "$part - $qty\n";
}
?>
[/code]

Regards
Huggie

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.