php - how to include two submit buttons for a form with different action -


here scenario :

i have html form on main page user can enter data , and submitting form using post method.

<form  id="main" name="main" action="#text" method="post" >        //codes goes here       <input  id="generate" type="submit"  name="script" value="create output" />  </form> 

and php code process above form

     <?php   echo '<form action="#text" method="post">';   echo '<textarea onclick="this.select()" name="output_textarea" id="output_textarea" cols="100" rows="25" readonly>';  //above form inputs echo in textarea  <-------php codes download here----> <-------php codes email here---->   <input type="submit" id="download"  value="download" name="download"></input> <input type="submit" id="send"  value="send" name="send"></input>  echo '</textarea>'; echo '</form>'; ?> 

i echoing form output textarea , need have download button email button

to save\send textarea. here issue facing both submit buttons on second page executing download php function, not email.

so, how can assign 2 separate functions 2 submit functions ? download , email ?

i not using separate php page here instead of using php code on same page add html.

buttons added $_post when , if pressed, , can press 1 button @ time,

you can or it:-

if ( isset( $_post['download'] ) ) {     do_dowload_stuff(); }  if ( isset( $_post['email'] ) ) {     do_email_stuff(); } 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -