I'm completley stuck!

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
WhizzBang
Forum Newbie
Posts: 11
Joined: Sat Jul 11, 2009 5:39 pm

I'm completley stuck!

Post by WhizzBang »

Hey, I have a file with a few functions, some of the function hold forms.

The URL to one of these forms is blah.php?page=send.

Code: Select all

<form action='blah.php?page=send' method='get'>
 
But whatever I do It cuts of the ?page=send bit :S

So once the form has submitted the URL should look something like. blah.php?page=send&ID=1&user=1&qty=1
But It comes out like this, blah.php?ID=1&user=1&qty=1.

I've tried PHP_SELF, SCRIPT_NAME, QUERY_STRING , REQUEST_URI but none of these seem to work.
peterjwest
Forum Commoner
Posts: 63
Joined: Tue Aug 04, 2009 1:06 pm

Re: I'm completley stuck!

Post by peterjwest »

You could try adding a hidden field to the form e.g. <input type="hidden" name="page" value="send"/>

Also you should know that single quotes aren't valid html.
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: I'm completley stuck!

Post by watson516 »

Maybe it's because you're using GET? Trying changing it to POST if you can and it should work just fine.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: I'm completley stuck!

Post by Weirdan »

peterjwest wrote:Also you should know that single quotes aren't valid html.
It's valid HTML5 (http://www.w3.org/TR/html5/syntax.html# ... oted-state) and it's valid HTML4.01 (http://www.w3.org/TR/html401/intro/sgml ... ttribute-6).
Moreover, it's valid XML 1.0 as well (http://www.w3.org/TR/xml/#dt-attrval). So, which version of HTML are you referring to?
peterjwest
Forum Commoner
Posts: 63
Joined: Tue Aug 04, 2009 1:06 pm

Re: I'm completley stuck!

Post by peterjwest »

Weirdan wrote:It's valid HTML5 (http://www.w3.org/TR/html5/syntax.html# ... oted-state) and it's valid HTML4.01 (http://www.w3.org/TR/html401/intro/sgml ... ttribute-6).
Moreover, it's valid XML 1.0 as well (http://www.w3.org/TR/xml/#dt-attrval). So, which version of HTML are you referring to?
Sorry I was mistaken. Perhaps I was thinking of XHTML or just wrong entirely.
watson516 wrote:Maybe it's because you're using GET? Trying changing it to POST if you can and it should work just fine.
If you're trying to get these values in the URL then GET is the method to use.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: I'm completley stuck!

Post by califdon »

WhizzBang wrote:

Code: Select all

<form action='blah.php?page=send' method='get'>
 
Sure, because when you declare the method='get', it creates the URL string from the form elements. It doesn't append it to something that you put in the action parameter. As someone else suggested, just add a hidden form element with name='page' and value='send', don't put it in the action parameter.
WhizzBang
Forum Newbie
Posts: 11
Joined: Sat Jul 11, 2009 5:39 pm

Re: I'm completley stuck!

Post by WhizzBang »

peterjwest wrote:You could try adding a hidden field to the form e.g. <input type="hidden" name="page" value="send"/>

Also you should know that single quotes aren't valid html.

Thank you that worked very well!.
Post Reply