Can anyone please help here I have a form that i wish the user to select a product from a drop down box and then query it in a mysql then i would like to the user to input a number in the next field the press the submit button, then the form should do some simple maths and display it in the next field. now 3 things my code does not do 1/ the math and display it 2/the user input and the product i would like to remain after the form has been submitted 3/ also can anyone give some idea of how to get the form to calculate without a submitt button. here is my code:

<form action="scdc_selfcompletion.php" method="post">
<select name="bap10">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan = '3'>Total Savings and Expenditure</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<input type="Submit" name="select" value="select">
</form>
<?php
$select = $_POST['select'];
 
// if something has been chosen
if (!empty($select)) {
 
// get the chosen value
$bap1 = $_POST['bap1'];
$bappledging1 = $_POST['pledging1'];
$bap2 = $_POST['bap1'];
$bappledging2 = $_POST['pledging1'];
$bap3 = $_POST['bap1'];
$bappledging3 = $_POST['pledging1'];
$bap4 = $_POST['bap1'];
$bappledging4 = $_POST['pledging1'];
$bap5 = $_POST['bap1'];
$bappledging5 = $_POST['pledging1'];
$bap6 = $_POST['bap1'];
$bappledging6 = $_POST['pledging1'];
$bap7 = $_POST['bap1'];
$bappledging7 = $_POST['pledging1'];
$bap8 = $_POST['bap1'];
$bappledging8 = $_POST['pledging1'];
$bap9 = $_POST['bap1'];
$bappledging9 = $_POST['pledging1'];
$bap10 = $_POST['bap1'];
$bappledging10 = $_POST['pledging1'];
// select the type from the database
// database connection details (change to whatever you need)
$HOST = 'localhost';
$DATABASE = '';
$USER = '';
$PASSWORD = '';
}
// connect to database
if(!$conn=mysql_connect('','','')) {
echo("<li>Can't connect to $HOST as $USER");
echo("<li>mysql Error: ".mysql_error());
die;
}
// select database
if (!mysql_select_db($DATABASE,$conn)) {
echo("<li>We were unable to select database $DATABASE");
die;
}
// if everything successful create query
// this selects all rows where the type is the one you chose in the dropdown
// * means that it will select all columns, ie name and type as i said above
$bap1_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap1'";
$bap2_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap2'";
$bap3_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap3'";
$bap4_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap4'";
$bap5_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap5'";
$bap6_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap6'";
$bap7_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap7'";
$bap8_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap8'";
$bap9_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap9'";
$bap10_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap10'";
//product 1 sum
$result = mysql_query($bap1_sql_query,$conn) or die('Invalid query: ' . mysql_error());
$details = mysql_fetch_array($result);
$bap1units = $bappledging1 = $_POST['pledging1'];
$bap1mes = $details['mesurements'];
$bapanswer1 = $bap1mes*$bap1units;
?>

i have only one row for lenth of thread perposes but all the php is there thanks in advance anyone

Can anyone please help here I have a form that i wish the user to select a product from a drop down box and then query it in a mysql then i would like to the user to input a number in the next field the press the submit button, then the form should do some simple maths and display it in the next field. now 3 things my code does not do 1/ the math and display it 2/the user input and the product i would like to remain after the form has been submitted 3/ also can anyone give some idea of how to get the form to calculate without a submitt button. here is my code:

<form action="scdc_selfcompletion.php" method="post">
<select name="bap10">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan = '3'>Total Savings and Expenditure</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<input type="Submit" name="select" value="select">
</form>
<?php
$select = $_POST['select'];
 
// if something has been chosen
if (!empty($select)) {
 
// get the chosen value
$bap1 = $_POST['bap1'];
$bappledging1 = $_POST['pledging1'];
$bap2 = $_POST['bap1'];
$bappledging2 = $_POST['pledging1'];
$bap3 = $_POST['bap1'];
$bappledging3 = $_POST['pledging1'];
$bap4 = $_POST['bap1'];
$bappledging4 = $_POST['pledging1'];
$bap5 = $_POST['bap1'];
$bappledging5 = $_POST['pledging1'];
$bap6 = $_POST['bap1'];
$bappledging6 = $_POST['pledging1'];
$bap7 = $_POST['bap1'];
$bappledging7 = $_POST['pledging1'];
$bap8 = $_POST['bap1'];
$bappledging8 = $_POST['pledging1'];
$bap9 = $_POST['bap1'];
$bappledging9 = $_POST['pledging1'];
$bap10 = $_POST['bap1'];
$bappledging10 = $_POST['pledging1'];
// select the type from the database
// database connection details (change to whatever you need)
$HOST = 'localhost';
$DATABASE = '';
$USER = '';
$PASSWORD = '';
}
// connect to database
if(!$conn=mysql_connect('','','')) {
echo("<li>Can't connect to $HOST as $USER");
echo("<li>mysql Error: ".mysql_error());
die;
}
// select database
if (!mysql_select_db($DATABASE,$conn)) {
echo("<li>We were unable to select database $DATABASE");
die;
}
// if everything successful create query
// this selects all rows where the type is the one you chose in the dropdown
// * means that it will select all columns, ie name and type as i said above
$bap1_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap1'";
$bap2_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap2'";
$bap3_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap3'";
$bap4_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap4'";
$bap5_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap5'";
$bap6_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap6'";
$bap7_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap7'";
$bap8_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap8'";
$bap9_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap9'";
$bap10_sql_query = "SELECT * FROM Behaviour WHERE Product LIKE '$bap10'";
//product 1 sum
$result = mysql_query($bap1_sql_query,$conn) or die('Invalid query: ' . mysql_error());
$details = mysql_fetch_array($result);
$bap1units = $bappledging1 = $_POST['pledging1'];
$bap1mes = $details['mesurements'];
$bapanswer1 = $bap1mes*$bap1units;
?>

i have only one row for lenth of thread perposes but all the php is there thanks in advance anyone

First - what is the problem - what error do you get?

Second what is this: $select = $_POST; ?

I am not sure this will work, I think you should refer to the select option as $_POST

Third - why are you referring to values are $_POST when they belong to $_POST;
$_POST?

$4th - since select returnes only one value (the selected one), you dont need all these:

// get the chosen value
$bap1 = $_POST['bap1'];
$bappledging1 = $_POST['pledging1'];
$bap2 = $_POST['bap1'];
$bappledging2 = $_POST['pledging1'];
$bap3 = $_POST['bap1'];
$bappledging3 = $_POST['pledging1'];
$bap4 = $_POST['bap1'];
$bappledging4 = $_POST['pledging1'];
$bap5 = $_POST['bap1'];
$bappledging5 = $_POST['pledging1'];
$bap6 = $_POST['bap1'];
$bappledging6 = $_POST['pledging1'];
$bap7 = $_POST['bap1'];
$bappledging7 = $_POST['pledging1'];
$bap8 = $_POST['bap1'];
$bappledging8 = $_POST['pledging1'];
$bap9 = $_POST['bap1'];
$bappledging9 = $_POST['pledging1'];
$bap10 = $_POST['bap1'];
$bappledging10 = $_POST['pledging1'];

Just use $_POST and $_POST in your sql
that's all

One more thing: why are you using LIKE in your sql but then use exact values. Either use = instead of LIKE or use LIKE '%$val%'

aaahhhrrrrr uncle smith i have heard all about you from Ardav he sais you are a legend and a better programmer, But thats a different story 1/ I get no error messages whatsoever i see what i should see but it just does not do anything?
2/$select = $_POST; ? this is a variable for the submit button
3/Are you sying i should just use $_POST; in my script and not turn them into variables, well at least that is what i think i am doing with them
4/ and the forth i will try cause i think i know what you mean!

aaahhhrrrrr uncle smith i have heard all about you from Ardav he sais you are a legend and a better programmer, But thats a different story 1/ I get no error messages whatsoever i see what i should see but it just does not do anything?
2/$select = $_POST; ? this is a variable for the submit button
3/Are you sying i should just use $_POST; in my script and not turn them into variables, well at least that is what i think i am doing with them
4/ and the forth i will try cause i think i know what you mean!

If you maned your 'select' group then just $_POST and you will automatically get the value of selected item

You normally dont need the value of the submit button. I mean, the button is just used to submit the form and since there is usually only one submit button in the form, you dont need to extract its value.

And yes, you only need one sql in your script - it will be automatically populated with the value of selected item.

I have posted the whole script because i think i may be on the wrong track here i cant get it to work!! if you want to see the form as now to get a better ides of what i want to do go here

<?php session_name('scdc');
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
// select the type from the database
// database connection details (change to whatever you need)
$HOST = 'localhost';
$DATABASE = 'k26bruc_cambsdata';
$USER = ';
$PASSWORD = ';

// connect to database
if(!$conn=mysql_connect('localhost','','')) {
echo("<li>Can't connect to $HOST as $USER");
echo("<li>mysql Error: ".mysql_error());
die;
}

// select database
if (!mysql_select_db($DATABASE,$conn)) {
echo("<li>We were unable to select database $DATABASE");
die;
}
?>
<p>Self Completion For : <?php echo(''.$_SESSION['ParishName'].''); ?>
<form action="scdc_selfcompletion.php" method="post">
<table width="800" border="1" cellspacing="2" cellpadding="3">
  <tr>
    <td colspan = '5'>Behaviour Alteration</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>Product Type</td>
    <td>Number Pledging</td>
    <td>Energy Saved</td>
    <td>Investment By The Community</td>
  </tr>
  <tr>
    <td width="15%">Product 1</td>
    <td width="27%">
    <select name="bap1">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging1" type="text" id="pledging" maxlength="5" />
    </td>
    <td width="20%"><?php echo(''.$details['mesurements'].'')?></td>
    <td width="19%">&nbsp;</td>
  </tr>
  <tr>
    <td>Product 2</td>
    <td width="27%">
     <select name="bap2">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging2" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Product 3</td>
    <td width="27%">
    <select name="bap3">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging3" type="text" id="pledging" maxlength="10" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Product 4</td>
    <td width="27%">
  <select name="bap4">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging4" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Product 5</td>
    <td width="27%">
    <select name="bap5">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging5" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Product 6</td>
    <td width="27%">
    <select name="bap6">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging6" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Product 7</td>
    <td width="27%">
    <select name="bap7">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging7" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Product 8</td>
    <td width="27%">
    <select name = "bap8">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging8" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Product 9</td>
    <td width="27%">
    <select name="bap9">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging9" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Product 10</td> 
    <td width="27%">
    <select name="bap10">
      <option selected="selected">Select One</option>
      <option value="Energy Efficient Cooking">Energy Efficient Cooking</option>
      <option value="Re-Usable Bags">Re-Usable Bags</option>
      <option value="Keep Fridge/Freezer Ice Free">Keep Fridge/Freezer Ice Free</option>
      <option value="No Stand By">No Stand By</option>
      <option value="Use Energy Meter">Use Energy Meter</option>
      <option value="Use Radio Other Than TV">Use Radio Other Than TV</option>
      <option value="Recycling">Recycling</option>
      <option value="Stop Junk Mail">Stop Junk Mail</option>
    </select>
    </td>
    <td width="19%">
      <input name="pledging" type="text" id="pledging" maxlength="5" />
    </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan = '3'>Total Savings and Expenditure</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<input type="Submit" name="select" value="select"> 
</form>
<?php
// if something has been chosen
if (!empty($select)) {
// select the type from the database
// database connection details (change to whatever you need)
$HOST = 'localhost';
$DATABASE = '';
$USER = ';
$PASSWORD = '';
}
// connect to database
if(!$conn=mysql_connect('localhost','','')) {
echo("<li>Can't connect to $HOST as $USER");
echo("<li>mysql Error: ".mysql_error());
die;
}
// select database
if (!mysql_select_db($DATABASE,$conn)) {
echo("<li>We were unable to select database $DATABASE");
die;
}
// if everything successful create query
// this selects all rows where the type is the one you chose in the dropdown
// * means that it will select all columns, ie name and type as i said above 
$_POST['bap1'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap1'";
$_POST['bap2'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap2'";
$_POST['bap3'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap3'";
$_POST['bap4'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap4'";
$_POST['bap5'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap5'";
$_POST['bap6'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap6'";
$_POST['bap7'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap7'";
$_POST['bap8'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap8'";
$_POST['bap9'] = "SELECT * FROM Behaviour WHERE Product LIKE '$bap9'";
$_POST['bap10']= "SELECT * FROM Behaviour WHERE Product LIKE '$bap10'";
//product 1 sum
$result = mysql_query($_POST['bap1'],$conn) or die('Invalid query: ' . mysql_error());
$details = mysql_fetch_array($result);
$bap1units = $bappledging1 = $_POST['pledging1'];
$bap1mes = $details['mesurements'];
$bapanswer1 = $bap1mes*$bap1units;
?>
</body>

You folks are really helpful and knowledgeable. I wish I knew as much. I'm just a humble DreamWeaver user.

Don't laugh.

Well, okay you can. Where would I go to learn this stuff?

gpit:

I noticed that your markup is repeated 10 times. pHp's for or while loop is made for this sort of stuff. I'd really suggest that you use a php loop to cut 250 lines to 25. It will be far more manageable - one change - all change.

<p>Self Completion For : <?php echo(''.$_SESSION['ParishName'].''); ?>
<form action="scdc_selfcompletion.php" method="post">
<table width="800" border="1" cellspacing="2" cellpadding="3">
  <tr>
    <td colspan = '5'>Behaviour Alteration</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>Product Type</td>
    <td>Number Pledging</td>
    <td>Energy Saved</td>
    <td>Investment By The Community</td>
  </tr>

<?php
for($x = 1;$x <= 10,$x += 1){
     echo "\n<tr>\n\t<td>Product {$x}</td>\n\t<td width=\"27%\">\n\t<select name=\"bap{$x}\">\n\t\t<option selected=\"selected\">Select One</option>\n\t\t<option value=\"Energy Efficient Cooking\">Energy Efficient Cooking</option>\n\t\t<option value=\"Re-Usable Bags\">Re-Usable Bags</option>\n\t\t<option value=\"Keep Fridge/Freezer Ice Free\">Keep Fridge/Freezer Ice Free</option>\n\t\t<option value=\"No Stand By\">No Stand By</option>\n\t\t<option value=\"Use Energy Meter\">Use Energy Meter</option>\n\t\t<option value=\"Use Radio Other Than TV\">Use Radio Other Than TV</option>\n\t\t<option value=\"Recycling\">Recycling</option>\n\t\t<option value=\"Stop Junk Mail\">Stop Junk Mail</option>\n\t</select>\n\t</td>\n\t<td width=\"19%\">\n\t<input name=\"pledging\" type=\"text\" id=\"pledging\" maxlength=\"5\" />\n\t</td>\n\t<td>&nbsp;</td>\n\t<td>&nbsp;</td>\n</tr>\n";
}
?>
<tr>
    <td colspan = '3'>Total Savings and Expenditure</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<input type="Submit" name="select" value="select"> 
</form>

That's your whole code for the form and table. If you need to add or subtract products, just change the $x <= [B]10[/B] value.

I have to say, creating your own shopping cart is laudable, but terribly difficult. I wouldn't fancy it. There are loads of off-the-shelf solutions, as already suggested. You may be better off with those. If you're going to take online payment, I would definitely discourage you from "rolling your own". If you're just taking orders, fine.

You folks are really helpful and knowledgeable. I wish I knew as much. I'm just a humble DreamWeaver user.

Don't laugh.

Well, okay you can. Where would I go to learn this stuff?

You would go home and reference the same resources I did:

These are the things I typically reference when coding a web site.

So:

  1. sign up for a solid week of transcendental meditation to clear your mind of WYSIWYG web programming poison
  2. teach yourself to become proficient using the vim/vi text editor
  3. teach yourself the basics, the fundamentals, of relational database design and applications
  4. teach yourself the basics, the fundamentals, of programming
  5. teach yourself the basics, the fundamentals, of typesetting
  6. teach yourself the basics of whitespace and visual contrast
  7. teach yourself the difference between information and its presentation, and the difference between content management and presentation management
  8. teach yourself the basics of PHP
  9. teach yourself the basics of HTML 4.01
  10. teach yourself the basics of styles and CSS
  11. teach yourself the basics of accessing a MySQL DB using PHP
  12. design a simple, one-table personal schedule DB
  13. write a simple, dynamic web page that lets you add items to the DB, delete and change those items, and display them on the page
  14. access this page from Konqueror, Iceweasel, Firefox, Opera, Epiphany, IE and any other browsers you can find; make your page appear and function the same on all of them

When your single dynamic web page works satisfactorily and looks presentable, you'll be an apprentice LAMP web site programmer. This process should take you six to twelve months if you do nothing else.

Darn. It almost fit into 12 steps. Call it Fester's 14-Step Web WYSIWYG Recovery Program.
N

Comments
TRUE, funny, and kind at the same time, great way to show some of the experience we all take for granted
This article has been dead for over six months. Start a new discussion instead.