Re: [PHP] getting around the undefined index



Ross wrote:
I have not found a satisfactory way of doing this yet!!!!

$text = $_REQUEST['text_size'];
if ($text) {
echo $text;
}

I send the $text_size variable to the browser with lines like...

<a href="<? $_SERVER['PHP_SELF']; ?>?text_size=small" class="size1" id="one">A</a>

When the page initially loads I get a undefined index error as it does not exist but is there a way of wrapping in in a switch statement or funtion so the variable is only used when $_REQUEST['text_size']; actually exists.

http://php.net/isset

-Stut
.



Relevant Pages

  • Re: [PHP] getting around the undefined index
    ... On 11/27/06, Ross wrote: ... echo $text; ... I send the $text_size variable to the browser with lines like... ... When the page initially loads I get a undefined index error as it does not ...
    (php.general)
  • Re: [PHP] outputing image part 2
    ... Ross wrote: ... echo $height = imagesy; ... Chances are you're getting an error message, but because you're telling the browser it's an image the browser is trying to display it as an image. ...
    (php.general)
  • Re: Deer collisions
    ... >I just saw this on CNN. ... > browser. ... > After it loads wait thru the Dodge truck commercial..> ... Thanks for the link Jim. ...
    (rec.motorcycles.harley)
  • Re: Browser support was Re: New Group for DesignBAIS
    ... Ross Ferris wrote: ... > In terms of general BI (Browser Independence), ... > old browsers you can't even rely on frames being present! ...
    (comp.databases.pick)
  • Re: Safari inadequate?
    ... of the Web designer, who has written a browser into the code. ... If I use any browser on Windows, the page loads ... married to Cecil. ...
    (comp.sys.mac.system)