rottenpixies Posted May 11, 2007 Share Posted May 11, 2007 I am trying to have a form submit to another source depending on a certain variable. Only problem is that the variable is not defined untill after you submit the form. Basically if a certain text field in the form is left blank i want it to be posting to a different place. Quote Link to comment https://forums.phpfreaks.com/topic/51004-having-a-form-submit-to-a-different-place-depending-on-a-variable/ Share on other sites More sharing options...
dzysyak Posted May 12, 2007 Share Posted May 12, 2007 Why cannot you do something like this: <form id="MyForm" onsubmit="javascript: if(document.getElementById('Element').value='something'){ document.getElementById('MyForm').action='SomeAction.php'; }"> I have used similar code several times Quote Link to comment https://forums.phpfreaks.com/topic/51004-having-a-form-submit-to-a-different-place-depending-on-a-variable/#findComment-251026 Share on other sites More sharing options...
Trium918 Posted May 12, 2007 Share Posted May 12, 2007 Ok, maybe we can better assist you if there was some code. Quote Link to comment https://forums.phpfreaks.com/topic/51004-having-a-form-submit-to-a-different-place-depending-on-a-variable/#findComment-251027 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.