This is a discussion on "I don't _GET it!" within the PHP Forum section. This forum, and the thread "I don't _GET it! are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
I don't _GET it!
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
I don't _GET it!
_GET is used to get a querystring value from the URL, right?
Does it not work for some reason if that URL is not generated via a form (with method=get)? I have a link on a page like so:
thissite = '' What am I doing wrong?! |
|
|
|
#2
|
|||
|
|||
|
Re: I don't _GET it!
But your not using $_GET, you are using $_REQUEST!!!
|
|
#3
|
|||
|
|||
|
Re: I don't _GET it!
I was using $_GET (same results) - when that didn't work I tried $_REQUEST. I posted the wrong code but my problem is the same either way - it just doesn't work!
|
|
#4
|
|||
|
|||
|
Re: I don't _GET it!
$_REQUEST contains everything that's in $_GET, plus $_COOKIE and a couple of other super-globals, so it should work just as well ... Suggestion, Donny: Try pointing your link at a PHP page containing <?php phpinfo(); ?>. That will let you look at all the various superglobal variables and give you a clue as to what is happening. (I've had a look but couldn't spot anything obviously wrong) |
|
#5
|
||||
|
||||
|
Re: I don't _GET it!
That quote syntax is downright Byzantine. It's the single quotes that are killing you. Just write
|
|
#6
|
||||
|
||||
|
Re: I don't _GET it!
I should probably point out that I'm not a complete idiot. (No sarcasm there - I know you guys deal with people of all knowledge/skill levels. Mine isn't terribly high, but it's not terribly low, either.
Quote:
Quote:
Quote:
Quote:
|
|
#7
|
|||
|
|||
|
Re: I don't _GET it!
I also tried inserting a listvars function that I've used to debug other troublesome pages in the past. Here's the complete code now:
The page works perfectly except for the stupid querystring. If you want to try it out, feel free: http://stickpuppy.com/contact.php?site=dhs57.com The only other thought I have is that somehow, maybe this is a problem on the server. Is it possible to disable querystring handling??? My webhost is 1and1.com - are there known issues with their php hosting? |
|
#8
|
|||
|
|||
|
Re: I don't _GET it!
The phpinfo confirms that the script IS picking up the parameters from the form - see under PHP Variables; they're listed there. And I host some
of my domains on 1and1 and there's quite a bit of PHP there. I find myself looking at odd things such as back quotes and forward quotes - or even other special quotes in other fonts. Have you tried with $thissite = $_GET["ws"]; rather than $thissite = $_GET['ws']; By the way - I confirmed the relationship between $_GET and $_REQUEST because I thought the thread might mislead other readers the way it was developing. Sorry if it read otherwise |
|
#9
|
|||
|
|||
|
Re: I don't _GET it!
Quote:
|
|
#10
|
|||
|
|||
|
Re: I don't _GET it!
Well, I tried the double quotes. Still no joy. I also thought to try it in IE, on the longshot chance this was some sort of Firefox bug. Same behavior in IE.
|
|
#11
|
|||
|
|||
|
Re: I don't _GET it!
Well, I have a workaround... Source page code:
|
|
#12
|
||||
|
||||
|
Re: I don't _GET it!
GAH! Javascript = surrender. It defeats one of the purposes of a serverside language, i.e. 100% certainty.
There is a flaw in the code somewhere. Why don't you try posting all the applicable code in one reply? I have done a lot of links just like this and it's a great technique to automate an unlimited menu of pages. I did a page where the database had articles written, and php automatically generated the new link and page using your exact code, i.e. href="...?id=mysqlid" as the pattern link and $id=$_GET['id'] on the new page. |
|
#13
|
|||
|
|||
|
Re: I don't _GET it!
I agree, but surrender is about where I'm at right now! And if it comes down to using javascript or a butt-ugly submit button, I'm going with javascript.
Quote:
OK - bizarre new development - I changed this:
On a whim, I changed it back - and it still worked! (Well, sort of.) By sort of, I mean to say that the print statement yields the passed qs parm, and the input I stuck on the form for debugging has the right value in it as well. But when the e-mail is sent out, it still shows "re: stickpuppy.com" in the subject (instead of "re: whatever.net") - but that's just a minor error somewhere else in the code. I know the documented changes I posted above probably have nothing to do with why it started working, but I don't care. I'm just glad to get past that hurdle. |
|
#14
|
|||
|
|||
|
Re: I don't _GET it!
Below is the code from two test files that I tried and it works perfectly.
|
|
#15
|
|||
|
|||
|
Re: I don't _GET it!
Thanks, Geoff. Mine was pretty much the same, I think. At this point I've made so many changes trying to debug that I can't be certain, but I posted the code in previous posts above and it doesn't look any different now (except for changing a variable name and fixing other problems downstream - which I found after this crazy thing started working!)
edit: Initially, my code looked exactly like the code mason posted here: http://www.webforumz.com/php-forum/1....htm#post87358 - it was immediately preceded by the
Last edited by Donny Bahama; Jan 20th, 2007 at 19:27. |
|
#16
|
|||
|
|||
|
Re: I don't _GET it!
All's well that ends well!
It's working beautifully, and I now have a nice (if I do so say so myself) little contact form. On any page of any of my sites, I can now use a contact link to http://stickpuppy.com/contact.php?ws=webforumz.com Here's a sample of the confirmation page displayed after the user submits a simple form (name, e-ddress and message text): Quote:
NOTE 2: The use of a semi-colon, double quotes and backslashes was intentional (for testing the escape handling code - which also works nicely). The user receives an e-mail which looks like: Quote:
Quote:
Last edited by Donny Bahama; Jan 20th, 2007 at 19:50. |
![]() |
| Tags |
| get, querystring |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] $_GET['ting'] Pages (Safely) With PHP | ||||