Welcome Guest, Not a member yet? Register   Sign In
One Form, Two Buttons
#1

[eluser]Frychiko[/eluser]
I have a form with two submit buttons, but am having trouble trying to take a different action depending on the button pressed.

Here's a section of the form:

Code:
<p>Are you sure you want to delete this record?</p>

<div class='buttons'>
&lt;?=form_button("delete",'Delete')?&gt;
<span class='space'></span>
&lt;?=form_button("cancel",'Cancel')?&gt;
</div>

Here's the validation class run part:

Code:
if ($this->validation->run() == FALSE)
{
    // prepopulate form
    $this->validation->id = $id;
}
else
{
    if ($this->input->post("cancel"))
        echo "cancel!";
}

There is no "cancel!" output, so there's no cancel post variable..?
If I remove the if statement, it will echo "cancel!"..


Messages In This Thread
One Form, Two Buttons - by El Forum - 08-01-2008, 03:48 AM
One Form, Two Buttons - by El Forum - 08-01-2008, 03:57 AM
One Form, Two Buttons - by El Forum - 08-01-2008, 04:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB