If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Vb6 to PhP to Mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-30-04, 00:18
Lord_Saroman Lord_Saroman is offline
Registered User
 
Join Date: Aug 2004
Posts: 16
echo problem

I am a beginner in PhP
I am running php an apache server

Is this code correct? Is there a config problem I dont know about?

<?php
echo "$username";
?>
when I go to http://myip/test?username=me
I should recive a page with "me" on it. but I get a blank page instead. why?

Last edited by Lord_Saroman; 12-01-04 at 04:14.
Reply With Quote
  #2 (permalink)  
Old 12-01-04, 12:20
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
I'm a n00b, so this is a shot in the dark...

Try:

<?php
echo $_REQUEST['username'];
?>
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #3 (permalink)  
Old 12-01-04, 19:07
joeldixon66 joeldixon66 is offline
Registered User
 
Join Date: Jul 2003
Posts: 73
Teddy's right. It has to do with global variables. Originally your method would have worked - because PHP automatically made all of your $_REQUEST, $_GET, $_POST etc items into normal variables.

Now you actually have to point to the array. (instead of just $PHP_SELF to get the name of your script - you need $_SERVER['PHP_SELF']).

As you've passed the username as a GET variable (in the URL - as opposed to a POST form) - you can refer to it as $_GET['username']. The $_GET is more specific (as you know the variable is being taken from the URL).
__________________
Joel Dixon
Analyst Programmer
Melbourne, Australia
Reply With Quote
  #4 (permalink)  
Old 12-02-04, 10:07
Lord_Saroman Lord_Saroman is offline
Registered User
 
Join Date: Aug 2004
Posts: 16
thanks, this worked fine.
I set the "global variables = on" to make MY code work..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On