|
-
May 7th, 2003, 11:39 AM
#1
Thread Starter
Addicted Member
getting value from the url
I want to edit a row in my database which has the testid field , so i did a list of all testid in the first page ( named edittest.php ) which contains anchors that has the format like this :http://localhost/edit.php?testid=A01 .
"A01" is a value of the testid in my database , and i have done this , the problem i want help from you all is that what do i write in the edit.php file to get the value of the tesid from the url of the edit.php file ( in the example above is "A01") and then passing the value to the variable $testid to do a query ?
I guess i have to use the $HTTP_POST_VARS but don;t know how to deal with it .
Anyone have done this please help me .
-
May 8th, 2003, 05:23 AM
#2
In older PHP:
$testid = $PHP_GET_VARS['testid'];
In even older PHP $testid is already available.
In modern PHP:
$testid = $_GET['testid'];
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 8th, 2003, 05:54 AM
#3
Lively Member
Ummm.. hate to be a spoil-sport but its not $PHP_GET_VARS but
PHP Code:
$HTTP_GET_VARS['testid']
There's something I've noticed in the last year or so...
Australian's are good at EVERYTHING !!!
-
May 8th, 2003, 07:51 AM
#4
That was that uneasy feeling that I had something wrong...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 8th, 2003, 10:09 AM
#5
Lively Member
or turn register_globals off.
that way you can use $testid
without the other stuff
but the other way is better.!
-
May 8th, 2003, 10:47 AM
#6
Frenzied Member
Originally posted by bekkel
or turn register_globals off.
that way you can use $testid
without the other stuff
but the other way is better.!
uhh no that is backwards. you should never turn them ON.
and it doesn't matter how old the php is, well to a point, but if register_globals are ON then the variable is all you need. but if OFF you need $_GET.
and $testid is available in any version of php, just depends on if register_globals is ON or OFF
and $HTTP_GET_VARS['testid'] is deprecated and shouldn't be used.
-
May 8th, 2003, 01:02 PM
#7
Turning register_globals on is discouraged for security reasons. But in very old PHP there wasn't a register_globals option AFAIK.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|