For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2006 > Getting form variables out of the URL [newbie question]









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Getting form variables out of the URL [newbie question]
Chris Styles

2006-05-07, 7:01 pm

I am using a forms in PHP, and I find that regardless of if I use POST or
GET as the method, I end up with things like

http://filename.php?Var1=Val1?Var2=Val2

I am sure that in previous stuff i have done (I am only an am. user, not a
prof. web designer) that the form variables have appeared magically without
being in the URL.

Now, I do remember something about register_globals which became off by
default a while ago, a lead to quite a bit of head scratching, but I am sure
that related to if form vars automatically became visible in the global
name space, rather than having to access them by $_something[varname]

Cheers

Chris


Janwillem Borleffs

2006-05-07, 7:01 pm

Chris Styles wrote:
> Now, I do remember something about register_globals which became off
> by default a while ago, a lead to quite a bit of head scratching, but
> I am sure that related to if form vars automatically became visible
> in the global name space, rather than having to access them by
> $_something[varname]


http:///www.php.net/manual/en/langu....predefined.php


JW


Chris Styles

2006-05-07, 7:01 pm

"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:445d1e12$0$82607$dbd4b001@news.euronet.nl...
> Chris Styles wrote:
>
> http:///www.php.net/manual/en/langu....predefined.php
>
>
> JW



Hi,

Thanks for the reference, it certainaly told me all i need to know about
accessing the form variables. Currently my register_globals is on, and I
relly should turn it off, and do the job properly.


However, I dont think explained very well what I meant, and what I want to
do.

I have a login box on my site, and the form submits to Login.php, but when
it does the password appears in the URL, i.e.

http://server/Login.php?UID=username?pwd=mypwd

Now, in Login.php i will salt and hash the password to and from the MySQL
daabase, but if it is visible in the URL in plain text, it seems there is a
gaping hole.

Before I used PHP, I used did a lot of CGI-BIN stuff with perl, and ISTR
that on a form submission nothing was added to the URL, but the variables
magically appeared visible to the Perl script (it required some taking
key/val pairs out of a global array etc)

So my question should have been "how do I stop form variables appear in the
URL they are submitted to?"

I ws thinking maybe that would happen when I switch register_globals off,
but then I figured the problem is how the browser submits to the form action
URL to the server, so it is a client side problem?

Ta in advance

Chris















Rik

2006-05-07, 7:01 pm

Chris Styles wrote:
> So my question should have been "how do I stop form variables appear
> in the URL they are submitted to?"


Use method="post" instead of "get" in the HTML, values shouldn't appear in
the url then, or you action="somepage.php" isn't properly defined.

It should have nothing to do with globals, appearing URL is client-side.

Grtz,
--
Rik Wasmus


Chris Styles

2006-05-07, 7:01 pm


"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:e3kqoa$oqd$1@netlx020.civ.utwente.nl...
> Chris Styles wrote:
>
> Use method="post" instead of "get" in the HTML, values shouldn't appear in
> the url then, or you action="somepage.php" isn't properly defined.
>
> It should have nothing to do with globals, appearing URL is client-side.
>
> Grtz,
> --
> Rik Wasmus


Thanks!

I was *just* about to post something along the lines of "sorry I am an
idiot, I appear to be using get rather than post"

You politely beat me to it!

Thanks

Chris




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com