Page 1 of 1

Form to load automatically

Posted: Tue Jan 05, 2010 9:54 am
by slaterino
I have a form that I want to load automatically when the page loads. The basic code for this form is:

Code: Select all

<form action="basket.php?action=update" method="post" id="cart">
<input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" />
<button type="submit">Update cart</button>
</form>
Is there a way I could use PHP to make this form load automatically when the page loads?? I just really want the $qty value to be updated and this seems like the best way of doing this!

Russ

Re: Form to load automatically

Posted: Tue Jan 05, 2010 1:09 pm
by AbraCadaver
If you put that code in a page then load that page in the browser it will display that form. I don't understand what you're getting at.

Re: Form to load automatically

Posted: Tue Jan 05, 2010 1:19 pm
by flying_circus
I think he just wants to update a form text field value based on a php variable.

Code: Select all

<form action="basket.php?action=update" method="post" id="cart">
<input type="text" name="qty<?php echo $id; ?>" value="<?php echo $id; ?>" size="3" maxlength="3" />
<button type="submit">Update cart</button>
</form>

Re: Form to load automatically

Posted: Tue Jan 05, 2010 4:19 pm
by slaterino
Maybe I lack the terminology but anyway I have got it sorted now! Thanks for your help!