Jump to content

Form Submitting Standards


ddigmann

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.