Yeah, its it possible to have multiple form in a single page.

for example:
<form action=test.php method=post>
---
--
</form>

<form action=test.php method=post>
---
---
</form>


Both the form action is the same test.php. Any problem ?

Recommended Answers

All 4 Replies

You can have multiple forms on a page and they can both go to the same page. You will need to identify which form has been submitted to test.php.

hi,

how to identify this? which form is submitted to test.php ? can you help me out. How to identity, which form been submitted to test.php?

Member Avatar for diafol

This is usually done by giving each submit button a unique id/name:

<input id="sub1" name="sub1" type="submit" value="Submit Form 1" />

it's a rubbish name/id, I know, but you get the idea. Then in your form handling routine:

if(isset($_POST['sub1'])){
  //code for handling this form
}

In addition, you can use an if code before the <head> to establish different handlings for each form.

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.