|
Posted by J.O. Aho on 12/16/05 02:10
Sam wrote:
> I'm using forms to pass variables between, for example, Page1 and
> Page2.
>
> This all works fine. However, if I open Page2 directly without first
> entering data in the form on Page1, I get an error similar to this:
>
> Notice: Undefined index: pc in
> content/Host/e/b/<bbbb>.com/web/thanks.php on line 223
>
> What's the best way to approach this so that the user doesn't see such
> an ugly message if they end up on Page2 without first going to Page 1?
You check if the variable is set with isset(), if it's not set, then don't
execute the line
eg:
isset($index) {
echo $index;
}
//Aho
[Back to original message]
|