teramera Posted February 16, 2009 Share Posted February 16, 2009 Hi! I am getting an Syntax error with the following code. Coul someone pls hep correct it. Also can you point me where I can read up about writing correct sytax for php, its about time that i get to lern this now. Thanks for your help and time. <? if ($_SESSION['Name'] !=""){ <a href="contact_now.php?BuyerID=<?=$_REQUEST['BuyerID']?>"><img src="../images/inquire_now.gif" border="0"></a><br><br> <img src="../images/view_contact.gif" border="0" align="absmiddle"> <a href="view_contact_details.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="contactus">View Contact Details</a>; } else { <a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br>; ?> Link to comment https://forums.phpfreaks.com/topic/145459-solved-syntax-error-help-pls/ Share on other sites More sharing options...
Mchl Posted February 16, 2009 Share Posted February 16, 2009 <?php if ($_SESSION['Name'] !=""){ ?> <a href="contact_now.php?BuyerID=<?php echo $_REQUEST['BuyerID']?>"><img src="../images/inquire_now.gif" border="0"></a><br><br> <img src="../images/view_contact.gif" border="0" align="absmiddle"> <a href="view_contact_details.php?BuyerID=<?php echo $_REQUEST['BuyerID']?>" class="contactus">View Contact Details</a>; <?php } else { ?> <a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br>; <?php } ?> You can't just type HTML and expect it to be displayed. You have to echo it, or close php tag ?> first The best source ever: php.net Link to comment https://forums.phpfreaks.com/topic/145459-solved-syntax-error-help-pls/#findComment-763622 Share on other sites More sharing options...
The Little Guy Posted February 16, 2009 Share Posted February 16, 2009 Try this: <? if ($_SESSION['Name'] !=""){ echo '<a href="contact_now.php?BuyerID='.$_REQUEST['BuyerID'].'"><img src="../images/inquire_now.gif" border="0"></a><br><br><img src="../images/view_contact.gif" border="0" align="absmiddle"> <a href="view_contact_details.php?BuyerID='.$_REQUEST['BuyerID'].'" class="contactus">View Contact Details</a>'; } else { echo '<a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br>'; ?> Link to comment https://forums.phpfreaks.com/topic/145459-solved-syntax-error-help-pls/#findComment-763623 Share on other sites More sharing options...
rhodesa Posted February 16, 2009 Share Posted February 16, 2009 next time you post, please include the error you are getting. For a good intro to PHP, check out http://devzone.zend.com/node/view/id/627 Link to comment https://forums.phpfreaks.com/topic/145459-solved-syntax-error-help-pls/#findComment-763627 Share on other sites More sharing options...
teramera Posted February 16, 2009 Author Share Posted February 16, 2009 A Big Thank You Mchl, rhodesa and The Little Guy I will check out the links you gave me. Thanks once again . You guys make PHPFreaks rock. Have Great Day! Link to comment https://forums.phpfreaks.com/topic/145459-solved-syntax-error-help-pls/#findComment-763632 Share on other sites More sharing options...
The Little Guy Posted February 16, 2009 Share Posted February 16, 2009 you may have already noticed this, but your link is wrong in your else, you have an extra greater than sign: <a href="signmeup.php>"> Link to comment https://forums.phpfreaks.com/topic/145459-solved-syntax-error-help-pls/#findComment-763640 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.