Jump to content

[SOLVED] Multiple forms with one submit button without using Javascript


Mr_jmm

Recommended Posts

Hi All,

 

Without using any Javascript, is it possible to have multiple forms with only one submit button? What I have is a php script that loops through an array (from a query result) and foreach item displays a form with product information on it. The form has radio buttons for people to use to rate a product (later this will be images). I can't find a way to give each set of review buttons a unique id. Actually, to be exact, I can't work out how a query would work.

 

<fieldset class="ratings2" id="<?php echo $row[$key]['basket_id']; ?>">
	<legend class="legend"> <?php echo $row[$key]['basket_product_title'] .' (' .$row[$key]['basket_product_id'] .')'; ?> </legend>
	<br /><input type="text" name="basket_id" id="basket_id" value="<?php echo $row[$key]['basket_id']; ?>" />
	<p><label id="q1">question1: </label><input type="radio" name="q1_button" id="q1_button" value="1" /><input type="radio" name="q1_button" id="q1_button" value="2" /><input type="radio" name="q1_button" id="q1_button" value="3" /><input type="radio" name="q1_button" id="q1_button" value="4" /><input type="radio" name="q1_button" id="q1_button" value="5" checked /></p>
	<p><label id="q2">question2: </label><input type="radio" name="q2_button" id="q2_button" value="1" /><input type="radio" name="q2_button" id="q2_button" value="2" /><input type="radio" name="q2_button" id="q2_button" value="3" /><input type="radio" name="q2_button" id="q2_button" value="4" /><input type="radio" name="q2_button" id="q2_button" value="5" checked /></p>
	<p><label id="q3">question3: </label><input type="radio" name="q3_button" id="q3_button" value="1" /><input type="radio" name="q3_button" id="q3_button" value="2" /><input type="radio" name="q3_button" id="q3_button" value="3" /><input type="radio" name="q3_button" id="q3_button" value="4" /><input type="radio" name="q3_button" id="q3_button" value="5" checked /></p>
	<p><label id="q4">question4: </label><input type="radio" name="q4_button" id="q4_button" value="1" /><input type="radio" name="q4_button" id="q4_button" value="2" /><input type="radio" name="q4_button" id="q4_button" value="3" /><input type="radio" name="q4_button" id="q4_button" value="4" /><input type="radio" name="q4_button" id="q4_button" value="5" checked /></p>
	<p><label id="q5">question5: </label><input type="radio" name="q5_button" id="q5_button" value="1" /><input type="radio" name="q5_button" id="q5_button" value="2" /><input type="radio" name="q5_button" id="q5_button" value="3" /><input type="radio" name="q5_button" id="q5_button" value="4" /><input type="radio" name="q5_button" id="q5_button" value="5" checked /></p>
</fieldset>

 

 

<?php
$row = query_array('SELECT basket_id, basket_product_title, basket_product_id FROM basket b LEFT JOIN site_order s ON b.basket_session_id = s.order_session_id WHERE md5(VendorTxCode) = "' .substr($_SERVER[QUERY_STRING], 2, 32) .'"');
	#$row = mysql_fetch_array($get_id_query);
	foreach ($row as $key => $foo) {
		include('./includes/ratings_sets.inc.php'); // 
?>

Link to comment
Share on other sites

It's quite simple, have them all assigned a name, have the action go to a processing page, and use the fields variable names depending on what you set then as, and do whatever you want. You can have infinite number of fields on a field.

Link to comment
Share on other sites

Cheers.

 

Solution was along the same line. One form with one submit button, have a form-handler included which each set of ratings sets all running identical queries each with a key from the array. I then extended the button's names to include some other intentifier. In this case the product code. Button name becomes:

name="q1_button_<?php $row[$key]['product_id'] ?>"

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.