Patrick3002 Posted February 23, 2007 Share Posted February 23, 2007 Ok, my problem is that my if isset statements will only echo the part after else in the if statement... heres the code. I have this at the very top of my page and it echos fine. (It echos: Hi when $email isnt set and $email when $email isset) <?php session_start(); ?> <?php if ( !isset($email) ) { echo "Hi"; } else { echo $email; } ?> Then here is where i have my problem... This code echos $logged2 if $email isset and nothing if $email isnt set, idk why it wont echo Hi if $email isnt set. <td width="170" align="right" valign="middle" class="tblrow2"> <?php if ( !isset($email) ) { echo "Hi"; } else { echo $logged2; } ?> </td> Any help would be greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/ Share on other sites More sharing options...
suzzane2020 Posted February 23, 2007 Share Posted February 23, 2007 hi, where have u placed the second part on the program? Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191972 Share on other sites More sharing options...
Patrick3002 Posted February 23, 2007 Author Share Posted February 23, 2007 Heres the second part: <table width="728" border="0" cellspacing="0" cellpadding="2"> <tr> <td height="23" bgcolor="#33CCFF" class="tblrow1">Browse artists: <a href="find.php?pc=A">A</a> <a href="find.php?pc=B">B</a> <a href="find.php?pc=C">C</a> <a href="find.php?pc=D">D</a> <a href="find.php?pc=E">E</a> <a href="find.php?pc=F">F</a> <a href="find.php?pc=G">G</a> <a href="find.php?pc=H">H</a> <a href="find.php?pc=I">I</a> <a href="find.php?pc=J">J</a> <a href="find.php?pc=K">K</a> <a href="find.php?pc=L">L</a> <a href="find.php?pc=M">M</a> <a href="find.php?pc=N">N</a> <a href="find.php?pc=O">O</a> <a href="find.php?pc=P">P</a> <a href="find.php?pc=Q">Q</a> <a href="find.php?pc=R">R</a> <a href="find.php?pc=S">S</a> <a href="find.php?pc=T">T</a> <a href="find.php?pc=U">U</a> <a href="find.php?pc=V">V</a> <a href="find.php?pc=W">W</a> <a href="find.php?pc=X">X</a> <a href="find.php?pc=Y">Y</a> <a href="find.php?pc=Z">Z</a> <a href="find.php?pc=0">#</a> </td> <td width="170" align="right" valign="middle" class="tblrow2"> <?php if (!isset($email)) { echo "Hi"; } else { echo $logged2; } ?> </td> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191973 Share on other sites More sharing options...
suzzane2020 Posted February 23, 2007 Share Posted February 23, 2007 when the email is not set does it go to the else part n display $logged2 or just give an empty string? Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191974 Share on other sites More sharing options...
suzzane2020 Posted February 23, 2007 Share Posted February 23, 2007 n better still u could use the _GET or _POST methods when using isset eg if( !isset($_POST["$mail1"])) { } Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191976 Share on other sites More sharing options...
Patrick3002 Posted February 23, 2007 Author Share Posted February 23, 2007 Its just empty. When $email is not set it displays nothing. Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191977 Share on other sites More sharing options...
Patrick3002 Posted February 23, 2007 Author Share Posted February 23, 2007 Im using sessions. Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191978 Share on other sites More sharing options...
Patrick3002 Posted February 23, 2007 Author Share Posted February 23, 2007 Heh, what do you know, this works: <?php if (!isset($_SESSION["email"])) { echo "Hi"; } else { echo $logged2; } ?> Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191979 Share on other sites More sharing options...
Patrick3002 Posted February 23, 2007 Author Share Posted February 23, 2007 I found the problem. I had another $email var between the first if statement and the second one Thanks for your help!! Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191981 Share on other sites More sharing options...
suzzane2020 Posted February 23, 2007 Share Posted February 23, 2007 sure... :)glad u found te problem!! Link to comment https://forums.phpfreaks.com/topic/39753-echo-and-isset-problems/#findComment-191982 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.