Page 1 of 1

I'm completley stuck!

Posted: Tue Aug 04, 2009 3:52 pm
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.

Re: I'm completley stuck!

Posted: Tue Aug 04, 2009 4:12 pm
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.

Re: I'm completley stuck!

Posted: Tue Aug 04, 2009 4:44 pm
by watson516
Maybe it's because you're using GET? Trying changing it to POST if you can and it should work just fine.

Re: I'm completley stuck!

Posted: Tue Aug 04, 2009 4:53 pm
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?

Re: I'm completley stuck!

Posted: Tue Aug 04, 2009 5:30 pm
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.

Re: I'm completley stuck!

Posted: Tue Aug 04, 2009 5:59 pm
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.

Re: I'm completley stuck!

Posted: Wed Aug 05, 2009 2:17 am
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!.