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>; ?> Quote Link to comment 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 Quote Link to comment 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>'; ?> Quote Link to comment 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 Quote Link to comment 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! Quote Link to comment 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>"> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.