Welcome Guest, Not a member yet? Register   Sign In
Form with 2 actions...
#1

[eluser]Alex91[/eluser]
I got my form working to send by mail.
So i got a button Send.

But i also want a button pdf.
So it opens a other piece of code where the pdf will be generated.

But how do i do that?

What i use so far:
Code:
<php form_open('form/submit'); ?&gt;
//The form
&lt;?php echo form_submit('submit','Send'); ?&gt;

&lt;?php echo form_close(); ?&gt;

Thanks so far for the help.
#2

[eluser]saidai jagan[/eluser]
Use one form , single action like
Code:
function form_action_here()
{
if(send_button)
{
}
elseif(pdf_button)
{
}
}
#3

[eluser]Alex91[/eluser]
Ok, i will try that.
Thanks so far.
#4

[eluser]Alex91[/eluser]
Ok, thanks for the help.
It was the right way, but it was not working.

I fixed it this way:
Code:
if(isset($_POST['submit']) && ($_SERVER['REQUEST_METHOD'] == "POST"))
#5

[eluser]saidai jagan[/eluser]
are u using both buttons as submit ? (send mail, create pdf)?
just name these buttons with separate names.
Code:
if(isset($_POST['send_mail'])
{
// Send mail contet
}
elseif(isset($_POST['create_pdf'])
{
// create the pdf file
}




Theme © iAndrew 2016 - Forum software by © MyBB