I can make the INPUT for QTY pass the value to my hidden field of quantity, what i want to try is something really easy.

I want the user to choose the quantity and pass the variable to my form, please help

Thank you for your time amigos

OCB

<form method="post" action="https://pay.com/live/shop/add_to_cart">
	Qty:
	<input name="cantidad" type="text" id="cantidad" size="2" />
    <?php $cantidad = $_POST["cantidad"]; ?>
	<br />
	<input type="hidden" name="store" value="project321">
	<input type="hidden" name="need_to_ship" value="no">
	<input type="hidden" name="need_to_tax" value="no">
	<input type="hidden" name="identifier" value="<?php echo $row_rsMiscDetail['part_number']; ?>">
	<input type="hidden" name="description" value="<?php echo $row_rsMiscDetail['product_name']; ?> <?php echo $row_rsMiscDetail['product_model']; ?>">
	<input type="hidden" name="quantity" value="<?php echo $cantidad = $_POST["cantidad"]; ?>">
	<input type="hidden" name="price" value="<?php echo $row_rsMiscDetail['price']; ?>">
<input type="hidden" name="fingerprint" value="820a4a580170e88df93d26beb7a2eafa">
	<table border="0" cellpadding="0" cellspacing="2">
	<tr>
<td align="center" valign="bottom"><label>
  <input name="submit" type="image" id="submit" onclick="this.form.submit()" src="images/buy_button.png" alt="add_to_cart" />
</label></td>
	</tr>
	</table>
</form>

Recommended Answers

All 2 Replies

I want the user to choose the quantity and pass the variable to my form, please help

If you are meaning to setup another page/form which submits to this form the quantity then first the code you mentioned will need to be altered to the below:

<form method="post" action="https://pay.com/live/shop/add_to_cart">
Qty:
<input name="cantidad" type="text" id="cantidad" size="2" />
<br />
<input type="hidden" name="store" value="project321">
<input type="hidden" name="need_to_ship" value="no">
<input type="hidden" name="need_to_tax" value="no">
<input type="hidden" name="identifier" value="<?php echo $row_rsMiscDetail['part_number']; ?>">
<input type="hidden" name="description" value="<?php echo $row_rsMiscDetail['product_name']; ?> <?php echo $row_rsMiscDetail['product_model']; ?>">
<input type="hidden" name="quantity" value="<?php echo $_POST["cantidad"]; ?>">
<input type="hidden" name="price" value="<?php echo $row_rsMiscDetail['price']; ?>">
<input type="hidden" name="fingerprint" value="820a4a580170e88df93d26beb7a2eafa">
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td align="center" valign="bottom"><label>
<input name="submit" type="image" id="submit" onclick="this.form.submit()" src="images/buy_button.png" alt="add_to_cart" />
</label></td>
</tr>
</table>
</form>

Also the form that submits the quantity to the above form would look something like below: (change the string/text page_name to the name of the php page which contains the above code.

<form method='post' action='page_name.php' style='margin:0; padding:0;'>
Quantity number: <input type='text' value='1' name='cantidad' size='5' maxlength='4'> 
<input type='submit' value='submit'>
</form>

And that should allow your users to submit a custom quantity number.

thank you so much for your time.

Gracias amigo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.