3

I am trying to create a form creator in PHP. This is one of them very silly "need another look" problems. I know this form should work but it just isn't sending any $_POST values at all. Here is the code.

<form method="post" action="http://projects.zesty-designs.co.uk/orderform" class="generatedform"> <label>Ebay Username</label><br /> <input type="text" name="ebay_username" value="" /><br /> <label>Email Address</label><br /> <input type="text" name="email_address" value="" /><br /> <label>Full Name</label><br /> <input type="text" name="full_name" value="" /><br /> <input type="submit" value="Submit" /><input type="reset" value="Start Again" /> </form> 

Here is the live link if anyone wants to try it out. http://projects.zesty-designs.co.uk/orderform.

6
  • 1
    nothing wrong with that html code. it should work. is the server perhaps doing a redirect to another page, which'd mean a GET and losing all the posted data? Commented Feb 11, 2013 at 20:38
  • try to pass full url , projects.zesty-designs.co.uk/orderform/index.php Commented Feb 11, 2013 at 20:40
  • Thanks for such a quick response. I tried changing the action to "./" and it seemed to work perfectly fine. So maybe something wrong with the URL? I need the full URL in the action as I will be putting this form on an external page. Commented Feb 11, 2013 at 20:40
  • You shouldn't have to put the full URL in. Commented Feb 11, 2013 at 20:41
  • I think Marc B is right: your page redirects to the same URL with a trailing slash. Try adding the missing slash to the form's action attribute: <form method="post" action="http://projects.zesty-designs.co.uk/orderform/" class="generatedform"> Commented Feb 11, 2013 at 20:42

5 Answers 5

3

Looks like most of the comments are correct.

It seems that the URL that is sending the information requires a trailing slash / or a reference to the direct file.

Thanks for the responses.

Sign up to request clarification or add additional context in comments.

Comments

1

Try to pass full url in action method;

http://projects.zesty-designs.co.uk/orderform/index.php 

Comments

0

You should add .php suffix like action="domain.com/somepage.php" (if it's actually a file name)

2 Comments

If the OP is using URL rewriting, then the .php should or should not be present based on his rules. We can't assume it is needed as it may not be required in this case.
That's why i added "if it's actually a file name"
0

Try to escape your caracters like so :

http:\/\/projects.zesty-designs.co.uk\/orderform

The backslash character has several uses. Firstly, if it is followed by a non-alphanumeric character, it takes away any special meaning that character may have. This use of backslash as an escape character applies both inside and outside character classes.

Check the link for more information : Escape sequences @ Php.net Manual

Basically in PHP your \ character is used for echo'ing out flag or escaping characters

Comments

0

I was having the exact same problem with classic asp. I have IIS RULE REWRITE and web.config set as follows:

<rule name="arulename"> <match url="somematch" /> <conditions> <add input="{REQUEST_METHOD}" matchType="Pattern" pattern="POST" negate="false" /> </conditions> <action redirectType="Temporary" type="Rewrite" url="someurl" /> </rule> 

my problem was that when I clicked the submit button the form did not submit. my form was perfect action="http://website.extension/someshorturl" but there was no post data. In other words everything was correct but the post data was being lost or dropped and there were no config or coding errors. What I found was that because I had set my server itself that the domain used the www. prefix, it was redirecting everything that came through without the www. prefix first. I simply had to change my form to say action="http://www.website.extension/someshorturl" and the post data appeared.

If anyone ever has the same problem as me, I hope this will help them.

I searched high and low, using "POST DATA BEING LOST" and got no help until I came here and this pointed me to the problem.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.