Noob form data question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
I0printRob
Forum Newbie
Posts: 9
Joined: Fri Jul 17, 2009 4:50 am

Noob form data question

Post by I0printRob »

Hi sorry can't find the answers because my search terms are "get" "post" and "http" which returns the entire internet.

I've done plenty with forms when the action is a relative path. I'm trying to use an absolute path and it's breaking.

So I send 2 fields to a php page

Code: Select all

 
<form method="POST" action="http://www.blahblah.com/test/recieve_form.php">
        <input type="hidden" name="tagsField" id="tagsField" value="originalvalue" />
        <input type="text" name="textField" />      
        <input type="submit" />     
</form>
 
...

Code: Select all

 
<?php
echo $_POST['tagsField'] . "<br />";
echo $_POST['textField'];
?>
 
If I use a relative path it works. If I use an absolute path then there's no entries in $_POST..?
Also when I changed to GET only the first entry is there because of the urlencoding i think (&)
DaiLaughing
Forum Commoner
Posts: 76
Joined: Thu Jul 16, 2009 8:03 am

Re: Noob form data question

Post by DaiLaughing »

You are spelling receive wrong but as long as you are consistent that shouldn't be the problem!

I can't think of anything as as absolute paths should work.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Noob form data question

Post by pickle »

I0printRob wrote:Hi sorry can't find the answers because my search terms are "get" "post" and "http" which returns the entire internet.
That's the funniest thing I've read all day.

I've got nothing to add constructively that ~DaiLaughing hasn't already said.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
I0printRob
Forum Newbie
Posts: 9
Joined: Fri Jul 17, 2009 4:50 am

Re: Noob form data question

Post by I0printRob »

:lol:
Thanks for replying anyhoo.
I've gone back to my test and simply toggled the url from absolute to relative and back - when it's relative, the php returns

Code: Select all

originalvalue<br />asdf<br />
when it's absolute, the php returns

Code: Select all

<br /><br />
Might there be a setting somewhere on my hosting? I don't know what to look for.

Also why does the GET break with an absolute URL (why the &)?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Noob form data question

Post by pickle »

That's really odd - maybe there's a redirect happening so the data is actually being posted, but then you redirect? Like, maybe an http -> https redirect? I don't know - seems like a long shot.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
I0printRob
Forum Newbie
Posts: 9
Joined: Fri Jul 17, 2009 4:50 am

Re: Noob form data question

Post by I0printRob »

Bingo! Thanks pickle you the man. I was addressing our .com which is a redirect from a .co.uk, I forgot that was even the case.
Thanks very much for helping me out :)
Rob
Post Reply