Jump to content

[Help] Processing diffrent forms on one page using if statement


gtrufitt

Recommended Posts

Hi,

 

I have multiple forms on one page that are used to UPDATE a user's information, each form has its own submit button and the action is

<?php echo $SERVER['PHP_SELF']; ?>

to bring the form back to the page. I am slightly unsure of the code needed to process each from depending which one has been changed eg:

 

if (the form name) has been changed

UPDATE something

else

if (another form name) has been changed

UPDATE something different

 

etc.

 

What is the correct php code to use with the if statement in order to update each form depending on which form has been changed?

 

Thanks,

 

Gareth

<?php
if (isset($_POST['Submit1']))
{
// do me!
}
else if (isset($_POST['Submit2']))
{
// no me!
}
else if (isset($_POST['Submit3']))
{
// what about me?
}
?>
<form>
<!-- the form -->
<input type="Submit" name="Submit1" value="Submit1" />
</form>
<form>
<!-- the form -->
<input type="Submit" name="Submit2" value="Submit2" />
</form>
<form>
<!-- the form -->
<input type="Submit" name="Submit3" value="Submit3" />
</form>

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.