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.

j0k
  • 22,600
  • 28
  • 79
  • 90
Brad Bird
  • 737
  • 1
  • 11
  • 30
  • 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? – Marc B Feb 11 '13 at 20:38
  • try to pass full url , http://projects.zesty-designs.co.uk/orderform/index.php – Afsar Feb 11 '13 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. – Brad Bird Feb 11 '13 at 20:40
  • You shouldn't have to put the full URL in. – Mike Feb 11 '13 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: `
    `
    – Viktor Feb 11 '13 at 20:42
  • I agree. Change the action to `/orderform/` (with the trailing slash and just leave out the domain) and it should work. – Mike Feb 11 '13 at 20:44

5 Answers5

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.

pedromendessk
  • 3,538
  • 2
  • 24
  • 36
Brad Bird
  • 737
  • 1
  • 11
  • 30
1

Try to pass full url in action method;

http://projects.zesty-designs.co.uk/orderform/index.php
Afsar
  • 3,104
  • 2
  • 25
  • 35
0

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

Yaakov
  • 184
  • 1
  • 8
  • 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. – War10ck Feb 11 '13 at 20:54
  • That's why i added "if it's actually a file name" – Yaakov Feb 11 '13 at 20:57
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

hayonj
  • 1,429
  • 3
  • 21
  • 28
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.

gil
  • 1