Forum Moderators: open

Message Too Old, No Replies

Two submit buttons with different locations.

Modifying the ACTION attribute from 2 buttons using JS

         

cyberjunky

10:12 pm on Jul 9, 2006 (gmt 0)

10+ Year Member



Hi,

Im running a rather large PHP/MySQL project in my spare time and i am in need of a little bit of javascript, basically i need to have two buttons for one form that submit the form to seperate locations.
the first is POST and the second is PREVIEW.

The thing is, i CANNOT do this in php using: "$var = $_POST['Action'];" because my project has become so big that im using templates and classes to control things, and long story short, the submit link will conflict with other parts of the project, so i need two links that submit the form differently, as are:
Post = "?nav=news&a=2&i=".$i."&s=1&w=1&for=1
Preview = "?nav=news&a=2&i=".$i."&s=2&w=0&for=0

the reason for this is my project is module based, the forum and new page are all modules, and $for indicates the page will forward if its processing, $w indicates the page will only show the main specified module in $nav so its always assumed that with them two variables in the form we would be processing the data instead of allowing me to preview it...

A little bit of javascript would be the perfect solution, preferably one thats compatible with a majority of browsers..

Thanks in advance, Cyberjunky.

cyberjunky

11:27 pm on Jul 9, 2006 (gmt 0)

10+ Year Member



Sorry to bother you guys, but i found my own solution to this problem, i did try before though so you know, i dont just go asking for help before trying...but meh...nevermind aye?

Its done now, if your reading this and was about to post a suggestion then thanks nonetheless...