Forum Moderators: coopster

Message Too Old, No Replies

how to check if a var is set

         

kumarsena

9:32 am on Sep 22, 2004 (gmt 0)

10+ Year Member



can anyone tell me whats wrong with this one...im getting
Undefined index: art error

basically what im trying todo is to check if $art is set or not and also to see if anyone is trying to create a loop,,index.php3 is the main file where this code resides and where there is and include ($art);.

<?php

$art = $_GET['art'];

if($art == 'index.php3')
{$art='index.txt';
}
elseif(!isset($art)) {
$art='index.txt';
}
?>

kumarsena

10:24 am on Sep 22, 2004 (gmt 0)

10+ Year Member



ok guys, got it sorted....a little basic flow chart helped a lot he he...

new code

<?php

if(isset($_GET['art']))
{

if ($_GET['art']=='index.php3'){
$art='index.txt';}

else{
$art= $_GET['art'];
}
}

else{
$art='index.txt';
}

sonjay

11:58 am on Sep 22, 2004 (gmt 0)

10+ Year Member



That's helpful. Thanks for posting the fix, kumarsena.

kumarsena

12:41 pm on Sep 22, 2004 (gmt 0)

10+ Year Member



no probs,,we're all here to help (and be helped :))