Jump to content

How Do I Have Different Regular Buttons Send The Forms To Different Php Files


confused and dazed

Recommended Posts

Hello internet - what I am trying to do is that I have two different regular buttons (preview and submit) and I also have two functions I named checkit and checkit2 - but now I would like checkit to post different information than checkit2 when the forms are sent to m m_post_process_4.php to be processed. How do I accomplish this? My form text is:<form name=tourney action="m m_post_process_4.php" method="post" target="_blank">My button text is:<input type="button" name="Preview" value="Preview"; onclick="checkit();" /><input type="button" name="Submit" value="Submit"; onclick="checkit2();" />

Link to comment
Share on other sites

We did have a question like this recently. While you could use Javascript, this is a safer method:http://w3schools.invisionzone.com/index.php?showtopic=40732 You wouldn't want the user to accidentally submit a post when they didn't intend to just because Javascript was disabled.

Link to comment
Share on other sites

O.K. so I started out using that method but switched to regular buttons (as opposed to submit buttons) so I could have different functions (i.e. checkit and checkit2) executed using the onclick for regualr buttons. Now I would like to have the post process data look different when the regualar button named preview is clicked as opposed to clicking the regualar button named sumbit

Link to comment
Share on other sites

Seeing that you're already using Javascript. In the function that submits the form, set the action property of the form just before submitting: In one function:formElement.action = "preview.php"; In the other function:formElement.action = "post.php"; There's a problem with this: The user could easily submit the form without running your functions by pressing "enter" on any text field.

Link to comment
Share on other sites

Inside each function, just before the line that submits the form, formElement.submit(), set the action attribute of the form: formElement.action = "4.php";formElement.submit(); I think that's what you're trying to accomplish, though I can't make full sense out of your question.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...