Connecting Tech Pros Worldwide Help | Site Map

Why won't variable echo?

  #1  
Old October 19th, 2006, 12:45 AM
affiliateian@gmail.com
Guest
 
Posts: n/a
Just moved web hosts and noticed that this:

<?php echo "$f"; ?>

used to work when there was an ?f= in the URL like so:
http://www.mydomain.com/index.html?f=yes

Now it doesn't at the new host.

I want to echo out "yes" in the HTML.

Any ideas?

TIA.

  #2  
Old October 19th, 2006, 01:05 AM
Chris Hope
Guest
 
Posts: n/a

re: Why won't variable echo?


affiliateian@gmail.com wrote:
Quote:
Just moved web hosts and noticed that this:
>
<?php echo "$f"; ?>
>
used to work when there was an ?f= in the URL like so:
http://www.mydomain.com/index.html?f=yes
>
Now it doesn't at the new host.
>
I want to echo out "yes" in the HTML.
>
Any ideas?
register_globals will be off on your new host.

Either enable it using .htaccess (if possible) or change all references
to eg echo $_GET['f']. The latter is the better option but if your site
is full of global references then as a short term solution you'll need
to get register_globals enabled.

More info here: http://nz.php.net/register_globals

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
  #3  
Old October 19th, 2006, 02:25 AM
affiliateian@gmail.com
Guest
 
Posts: n/a

re: Why won't variable echo?


Chris Hope wrote:
Quote:
Either enable it using .htaccess (if possible) or change all references
to eg echo $_GET['f']. The latter is the better option but if your site
is full of global references then as a short term solution you'll need
to get register_globals enabled.
Thanks Chris, not sute how to enable register_globals but echo
$_GET['f'] worked! Thanks so much!

  #4  
Old October 19th, 2006, 05:05 AM
Rik
Guest
 
Posts: n/a

re: Why won't variable echo?


affiliateian@gmail.com wrote:
Quote:
Chris Hope wrote:
Quote:
>Either enable it using .htaccess (if possible) or change all
>references to eg echo $_GET['f']. The latter is the better option
>but if your site is full of global references then as a short term
>solution you'll need to get register_globals enabled.
>
Thanks Chris, not sute how to enable register_globals but echo
$_GET['f'] worked! Thanks so much!
Luckily.

Either make sure sure ALL your values are initialiased ($f = '' etc...),
or keep register_globals off (preferably both ofcourse), so your script
won't have to deal with variable values that have been set by a user on the
Evil Net, but only by youself, or a validated/checked request from the
user. That way you're reaonably sure what your sript does, instead of
intorducing unpredictable, and potentially harmfull, variables.
--
Rik Wasmus


  #5  
Old October 19th, 2006, 08:25 AM
aeg
Guest
 
Posts: n/a

re: Why won't variable echo?



affiliateian@gmail.com wrote:
Quote:
Just moved web hosts and noticed that this:
>
<?php echo "$f"; ?>
>
used to work when there was an ?f= in the URL like so:
http://www.mydomain.com/index.html?f=yes
>
Now it doesn't at the new host.
>
I want to echo out "yes" in the HTML.
>
Any ideas?
>
TIA.
Just at tip, for security reasons you may want to addslashes ie
addslashes($_GET['f]) else people could inject into your site.

  #6  
Old October 19th, 2006, 01:45 PM
Jerry Stuckle
Guest
 
Posts: n/a

re: Why won't variable echo?


aeg wrote:
Quote:
affiliateian@gmail.com wrote:
>
Quote:
>>Just moved web hosts and noticed that this:
>>
>><?php echo "$f"; ?>
>>
>>used to work when there was an ?f= in the URL like so:
>>http://www.mydomain.com/index.html?f=yes
>>
>>Now it doesn't at the new host.
>>
>>I want to echo out "yes" in the HTML.
>>
>>Any ideas?
>>
>>TIA.
>
>
Just at tip, for security reasons you may want to addslashes ie
addslashes($_GET['f]) else people could inject into your site.
>
Addslashes won't do a thing here - except maybe screwup the output he's
echoing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #7  
Old October 19th, 2006, 09:15 PM
Shelly
Guest
 
Posts: n/a

re: Why won't variable echo?



"Chris Hope" <blackhole@electrictoolbox.comwrote in message
news:4536c656@news.orcon.net.nz...
Quote:
affiliateian@gmail.com wrote:
>
Quote:
>Just moved web hosts and noticed that this:
>>
><?php echo "$f"; ?>
>>
>used to work when there was an ?f= in the URL like so:
>http://www.mydomain.com/index.html?f=yes
>>
>Now it doesn't at the new host.
>>
>I want to echo out "yes" in the HTML.
>>
>Any ideas?
I have made it a habit to always write something like that as:

<?php echo '"' . $f . '"'; ?>

or

<?php echo $f; ?>

and I always say <?php


(single-double-single quotes)

Shelly


  #8  
Old October 20th, 2006, 09:05 PM
aeg
Guest
 
Posts: n/a

re: Why won't variable echo?



Jerry Stuckle wrote:
Quote:
aeg wrote:
Quote:
affiliateian@gmail.com wrote:
Quote:
>Just moved web hosts and noticed that this:
>
><?php echo "$f"; ?>
>
>used to work when there was an ?f= in the URL like so:
>http://www.mydomain.com/index.html?f=yes
>
>Now it doesn't at the new host.
>
>I want to echo out "yes" in the HTML.
>
>Any ideas?
>
>TIA.

Just at tip, for security reasons you may want to addslashes ie
addslashes($_GET['f]) else people could inject into your site.
>
Addslashes won't do a thing here - except maybe screwup the output he's
echoing.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
He's relying on data from the url though, this could be dangerous
unless processed correctly

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with undefined variable Jeremy Felt answers 6 January 24th, 2007 05:25 PM
Multiple Listboxes on page won't work... sheldongold answers 1 January 27th, 2006 05:25 PM
passing a variable from a form to php bawar answers 1 July 17th, 2005 03:09 AM
function for capturing form input won't return anything lawrence answers 5 July 16th, 2005 11:47 PM