Jump to content

php forms query!


adamhhh

Recommended Posts

A form submit button submits every element that is in the same form tag.

 

It doesnt matter where the submit button is in the form, every element in that form will be submitted.

 

Some examples:

 

<form>
    <input type="submit" value="Submit1" />
    <input type="text" name="username" />
    <input type="text" name="password" />
</form>

 

The above will submit username and password when clicked.

 

<form>
    <input type="submit" value="Submit1" />
    <input type="text" name="username" value="Foo" />
    <input type="text" name="password" value="Bar" />
</form>

<form>
    <input type="submit" value="Submit2" />
    <input type="text" name="username" />
    <input type="text" name="password" />
</form>

 

Above, when Submit1 is clicked, username will be Foo and password will be Bar.  But if Submit2 is clicked, username and password will be empty.

 

Does that makes sense?

Link to comment
https://forums.phpfreaks.com/topic/137732-php-forms-query/#findComment-719959
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.