Help - Search - Members - Calendar
Full Version: HTML Forms
HTMLHelp Forums > Programming > Server-side Scripting
eddy556
Hi, I'm using a php script to create a HTML table which is full of information from a MS access database. As the table is created the php script also adds a checkbox and a qty number along each row. I have attempted to create another script (in php) which will allow the user to check the boxes and add qty's and this will POST these to another page, however when the submit button is pressed nothing happens.

I've read somewhere that form elements may not appear in a table (specifically between the <tr></tr> tags).

Just wondering if anyone has any pointers that would maybe be the reason why it doesnt work,

dry.gif Thanks!
Brian Chandler
To take your questions in reverse order...

QUOTE(eddy556 @ Nov 15 2006, 06:20 AM) *

I've read somewhere that form elements may not appear in a table (specifically between the <tr></tr> tags).


No, that's not true. This is not the problem.


QUOTE(eddy556 @ Nov 15 2006, 06:20 AM) *

Hi, I'm using a php script to create a HTML table which is full of information from a MS access database. As the table is created the php script also adds a checkbox and a qty number along each row. I have attempted to create another script (in php) which will allow the user to check the boxes and add qty's and this will POST these to another page, however when the submit button is pressed nothing happens.


URL of the page generated by this script?

So one script generates the page including the form. Now you need another script to handle the result of form submission. (A script to "allow the user to check the boxes ..." makes no sense.) Perhaps if we could see any of this - like this second script, it might be easier to point out the problem.
eddy556
Here is the HTML code which is generated:

<form action="order_process.php" method="post">

<table border="1" cellpadding="0">
<tr><td><b>Order?</b></td><td><b>Qty</b></td><td><b>Code</b></td><td><b>Name</b></td><td><b>Description</b></td><td><b>Price</b></td>

<tr>
<td><input type="checkbox" name="chck_box1" value="AW156-78-02"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>AW156-78-02</td>
<td>Harrier Wing Assembly</td>
<td>Intersection joints for 80 - 2003 harrier Mk3 wing</td>
<td>£70985.23</td>
</tr>

<tr>
<td><input type="checkbox" name="chck_box2" value="AG12-34-9"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>AG12-34-9</td><td>Type 6 Nut</td><td>Counter clockwise 6" nut, landing gear and seats</td>
<td>£0.59</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box3" value="RE3-426-0"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>RE3-426-0</td><td>Mount 342</td><td>Mount for external fuel tanks</td>
<td>£540</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box4" value="AB678-90"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>AB678-90</td>
<td>Type 109 nut</td>
<td>Seat bolts for Airbus 220 cockpit</td>
<td>£1.09</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box5" value="CS546-39-09"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>CS546-39-09</td>
<td>Seal 312</td>
<td>Seal</td>
<td>£0.25</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box6" value="TR54-32-190-1"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>TR54-32-190-1</td>
<td>Tracking Checker</td>
<td>Tracker alignment for Boeing 7 series</td>
<td>£5876.36</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box7" value="YY3-636-48-9"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>YY3-636-48-9</td>
<td>Wing Tip Light 967</td>
<td>Light for Airbus wing tips - Red</td>
<td>£98.36</td

</tr>

<tr>
<td><input type="checkbox" name="chck_box8" value="YY65-47-8"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>YY65-47-8</td>
<td>Turbine Blade 34421</td>
<td>1000mm Blade for RR Cross turbine engine</td>
<td>£1.2</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box9" value="IP09873-65-19"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>IP09873-65-19</td>
<td>Type AB323 Injection Unit</td>
<td>Injection Unit for AirBus 450 Engine units</td>
<td>£10056.12</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box10" value="YT3242-98-0"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>YT3242-98-0</td>
<td>Seal</td>
<td>Oil seal for Hydraulics System (BO 737)</td>
<td>£0.97</td>

</tr>

</table>
<input name="Submit" type="button" value="Submit">

</form>

For some reason when I click the submit button above....nothing happens, yet I cannot see any errors in this code.
Christian J
QUOTE(eddy556 @ Nov 15 2006, 01:44 PM) *

CODE
<input name="Submit" type="button" value="Submit">



That should be

CODE
<input name="Submit" type="submit" value="Submit">

Christian J
Also, here's a missing ">" character:

CODE
<td>Light for Airbus wing tips - Red</td>
<td>£98.36</td
</tr>
Brian Chandler
QUOTE(eddy556 @ Nov 15 2006, 09:44 PM) *

Here is the HTML code which is generated:

<form action="order_process.php" method="post">

<table border="1" cellpadding="0">
<tr><td><b>Order?</b></td><td><b>Qty</b></td><td><b>Code</b></td><td><b>Name</b></td><td><b>Description</b></td><td><b>Price</b></td>

<tr>
<td><input type="checkbox" name="chck_box1" value="AW156-78-02"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>AW156-78-02</td>
<td>Harrier Wing Assembly</td>
<td>Intersection joints for 80 - 2003 harrier Mk3 wing</td>
<td>£70985.23</td>
</tr>

<tr>
<td><input type="checkbox" name="chck_box2" value="AG12-34-9"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>AG12-34-9</td><td>Type 6 Nut</td><td>Counter clockwise 6" nut, landing gear and seats</td>
<td>£0.59</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box3" value="RE3-426-0"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>RE3-426-0</td><td>Mount 342</td><td>Mount for external fuel tanks</td>
<td>£540</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box4" value="AB678-90"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>AB678-90</td>
<td>Type 109 nut</td>
<td>Seat bolts for Airbus 220 cockpit</td>
<td>£1.09</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box5" value="CS546-39-09"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>CS546-39-09</td>
<td>Seal 312</td>
<td>Seal</td>
<td>£0.25</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box6" value="TR54-32-190-1"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>TR54-32-190-1</td>
<td>Tracking Checker</td>
<td>Tracker alignment for Boeing 7 series</td>
<td>£5876.36</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box7" value="YY3-636-48-9"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>YY3-636-48-9</td>
<td>Wing Tip Light 967</td>
<td>Light for Airbus wing tips - Red</td>
<td>£98.36</td

</tr>

<tr>
<td><input type="checkbox" name="chck_box8" value="YY65-47-8"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>YY65-47-8</td>
<td>Turbine Blade 34421</td>
<td>1000mm Blade for RR Cross turbine engine</td>
<td>£1.2</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box9" value="IP09873-65-19"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>IP09873-65-19</td>
<td>Type AB323 Injection Unit</td>
<td>Injection Unit for AirBus 450 Engine units</td>
<td>£10056.12</td>

</tr>

<tr>
<td><input type="checkbox" name="chck_box10" value="YT3242-98-0"></td>
<td><input name="Order_Qty" type="text" size="1" maxlength="1"></td>
<td>YT3242-98-0</td>
<td>Seal</td>
<td>Oil seal for Hydraulics System (BO 737)</td>
<td>£0.97</td>

</tr>

</table>
<input name="Submit" type="button" value="Submit">

</form>

For some reason when I click the submit button above....nothing happens, yet I cannot see any errors in this code.


So this is the "first" script, right? Once you sort out the syntax errors (use the validator to help), what should happen when you click submit is that you get the page generated by order_process.php, or possibly a 404 because you haven't written it yet.

Incidentally, replace <td><b>Heading</b></td> by <th>Heading</th> and it will look much neater.

BTW, the thing you might be half-remembering (which is a _real_ pain is that you can't use a <tr> to hold a form. (So there's one submit per row)
eddy556
Thanks I've got it sussed now and it works fine, just got other errors in other scripts now to sort out wink.gif

Thanks

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.