html - Php - detect which form was posted -


this question has answer here:

i have single page multiple forms may appear on it. there anyway of distinguishing between these forms in php (some kind of form iding system)?

there many methods can use

give submit button unique name or value each form,

<input type="submit" name="form1" value="submit">  if (isset($_post['form1'])){  // form1 filled in } 

add hidden input field

<input type="hidden" name="form" value="form1">  if (isset($_post['form']) && $_post['form'] == "form1"){  // form1 filled in } 

use parameter in action url.

<form action="index.php?form=form1" method="post">  if (isset($_get['form']) && $_get['form'] == "form1"){  // form1 filled in } 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -