ddigmann Posted April 24, 2007 Share Posted April 24, 2007 I have been writing PHP for my site and others we a few years now, but I thought I was time to become a bit more professional with my code. In the past every time I submit a form, I set an action parameter to '/blah/blah/.../blah/script/run_this_form.php'. Now although this works it is, it does not seem ideal at all. I have looked at a few examples and some sites do not even have action parameters on their forms. I am assuming this will run the same PHP file over again. Within that file I am assuming there is also a else if or switch statement to handle the various form submissions (ie is this form1 submit, is this form2 submit..., else do everything that isn't submitting). This again seems to be a bad idea. I was wondering what the standard methodology for submitting forms would be from the server side of things. What would a simple 'Hello World' form look like with a standard submission? Thanks folks. Link to comment https://forums.phpfreaks.com/topic/48453-form-submitting-standards/ Share on other sites More sharing options...
taith Posted April 24, 2007 Share Posted April 24, 2007 personally... i dont believe in standards... its the people that work outside the box that get anywhere in the programming world... personally... i as a rule, use a simple javascript function for my forms... like so... <s cript> function formsubmit(webpage){ document.form.action=webpage; document.form.submit(); } </s cript> <form name=form method=post> <input type=text name=test> </form> <a href="javascript:formsubmit('whereiwannago.php');">text</a> using the standard methods... forms can only go to one location... using this... you can send the same form information to any webpages you want... which does work... but this is SOOOO helpful! Link to comment https://forums.phpfreaks.com/topic/48453-form-submitting-standards/#findComment-236921 Share on other sites More sharing options...
ddigmann Posted April 24, 2007 Author Share Posted April 24, 2007 That is quite a nice method. I was looking for something like that. One question though: What if the client has javascript disabled which could always be their choice? No to get into a debate over why javascript should be disabled or enabled, but this method would never submit for those users?? Thank you for your time. Link to comment https://forums.phpfreaks.com/topic/48453-form-submitting-standards/#findComment-236926 Share on other sites More sharing options...
taith Posted April 24, 2007 Share Posted April 24, 2007 well... thats pretty easy... top of your pages, put this... <noscript>WHAT DO YOU THINK YOUR DOING!?!? TURN JAVASCRIPT BACK ON!!!</noscript> or something to that affect... LOL Link to comment https://forums.phpfreaks.com/topic/48453-form-submitting-standards/#findComment-236931 Share on other sites More sharing options...
taith Posted April 24, 2007 Share Posted April 24, 2007 personally... i think we should abolish that function... so much of the internet is java/ajax enhanced... just those hackers out there who give everybody a bad name Link to comment https://forums.phpfreaks.com/topic/48453-form-submitting-standards/#findComment-236955 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.