How to use $_POST and $_GET in url bar?

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
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

How to use $_POST and $_GET in url bar?

Post by kaisellgren »

I need to use url bar to send information and I need to send it as $_POST. How to do it? Currently I have: http://www.domain.com/email.php?name=my ... s=password How to make it as $_POST ?
sheila
Forum Commoner
Posts: 98
Joined: Mon Sep 05, 2005 9:52 pm
Location: Texas

Post by sheila »

You can't.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

in the HTML-form instead of

Code: Select all

<form method="GET" action="...">
use

Code: Select all

<form method="POST" action="...">
Last edited by patrikG on Sat Jan 07, 2006 6:16 am, edited 1 time in total.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you explain why you need to do this we may be able to offer you other options.

Mac
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Post by kaisellgren »

I have made a EmotIcon maker program. And I have feedback form in it. I thought I would open a url to send to form from my program...
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Post by mickd »

generally its very insecure to have passwords and other sensitive information sent via $_GET, but if it must be done i would at least encode your url query string...
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Post by kaisellgren »

Well, I don't understand what you were saying :S :(
I am not sending any passwords, that was just an example. In fact, I use FeedBack Form in my program and that form has Name, Email, Subject and comment field. "i would at least encode your url query string..." ?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

In the feedback form change the method from post to get.
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Post by kaisellgren »

Ah, I have always wondered what's different between POST and GET. Does GET work if I "send" the form info with typing in the url bar?
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Post by mickd »

look up "phpsecureurl" at http://www.phpclasses.org/

it should be under security

theres lots of different classes there that does the same thing btw

basically it gets your

?var1=thet&var2=rehr&var3=grerg

and turns it into something like

?var=rkjglregjelrgjelgjlrjlwekgwjrgwrjgwlkgjl

which it would "decode" in your php script back to

?var1=thet&var2=rehr&var3=grerg
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Post by mickd »

kaisellgren wrote:Ah, I have always wondered what's different between POST and GET. Does GET work if I "send" the form info with typing in the url bar?
yes

edit: if i understood you correctly.
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Post by kaisellgren »

Thank you for your help! You have saved my day! :D
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

kaisellgren wrote:Ah, I have always wondered what's different between POST and GET. Does GET work if I "send" the form info with typing in the url bar?
The "form info" in the URL bar is the GET-request. For more info, see http://uk2.php.net/manual/en/language.v ... ternal.php
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Post by kaisellgren »

Oh, thank you. Now I know what to do to make it working... Thank you very much you guys for helping me!
Post Reply