Page 1 of 1

post, get parametrers together

Posted: Fri Sep 06, 2002 3:47 am
by khayll
Hi all,

I have a question, can you send both POST and GET parameters together to a page ?

I mean will it work, if I send a form with method=post, and I also include some ?param=value in the action field ?

waddaya think? is this allowed ?

Thanks,
Khayll

Posted: Fri Sep 06, 2002 3:50 am
by twigletmac
Have you tried it? It will work just create a test form and have a go at it.

Mac

Posted: Sat Sep 07, 2002 9:39 am
by Coco
ya best way to learn this sorta stuff is to have a bash and stare at your screen for a day then ask someone...

i actually found that going to bed for an hour then coming back to try again helps :P
not that most offices have beds in them :D

Posted: Sat Sep 07, 2002 9:56 am
by MattF
It works for me, I do it quite often, for example on a mailing form I send it to $_SERVER['PHP_SELF']."?action=send" and then post it all, that way I can keep the the action seperate from the form text.

Posted: Sat Sep 07, 2002 11:16 am
by gite_ashish
hi,

Yes, one can put the method=POST and also add the query string parameters.

on the server side if u check:

Code: Select all

<?php
echo "method: " . $_SERVERї'REQUEST_METHOD'] . "<P>";
?>
it will be:
method: POST
Even if we add query string parameters and if the method is POST.. the REQUEST_METHOD is posted as POST but; the query string paramaters are available in $_GET[] only not in the $_POST[].

Every thing as expected :idea:

Posted: Sun Sep 08, 2002 1:21 am
by Takuma
How can you do that?
Using JS??? Cos I cannot think of the code that does the job with HTML form...

Posted: Sun Sep 08, 2002 7:23 am
by MattF

Code: Select all

<form action="<?php echo $_SERVER&#1111;'PHP_SELF']; ?>"?action=send&userid=123" method="post">
<input type="text" name="text1">
<input type="submit" value="Send">
</form>
See?

Posted: Sun Sep 08, 2002 12:32 pm
by Takuma
That's what you meant...

I though you meant sending parts of form by GET and parts of form element by POST. :lol: