Jump to content

Recommended Posts

If these are two submit buttons, you can check for the value being set to determine which button was clicked and act accordingly.

 

<form>
    <input type='submit' value='yes' />
    <input type='submit' value='no' />
</form>

 

receiving page

 

if(isset($_POST['yes']))
{
//do stuff
}
else if(isset($_POST['no']))
{
//do stuff
}

If these are two submit buttons, you can check for the value being set to determine which button was clicked and act accordingly.

 

<form>
    <input type='submit' value='yes' />
    <input type='submit' value='no' />
</form>

 

receiving page

 

if(isset($_POST['yes']))
{
//do stuff
}
else if(isset($_POST['no']))
{
//do stuff
}

 

Not quite. A value of a field is not passed as an index in the POST data. In the above, you would also need to set the Names to "yes" and "no" for that PHP logic to work. Or, you need to give your two submit buttons a name and then set the values accordingly.

 

    <input type="submit" name="response" value="Yes" />
    <input type="submit" name="response" value="No" />

 

if(isset($_POST['response']) && $_POST['response']=="Yes")
{
    //Yes response
}
else
{
    //Assume no response
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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