Form to load automatically

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
slaterino
Forum Commoner
Posts: 46
Joined: Fri Jul 11, 2008 10:50 am

Form to load automatically

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Form to load automatically

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Form to load automatically

Post 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>
slaterino
Forum Commoner
Posts: 46
Joined: Fri Jul 11, 2008 10:50 am

Re: Form to load automatically

Post by slaterino »

Maybe I lack the terminology but anyway I have got it sorted now! Thanks for your help!
Post Reply