Jump to content

[SOLVED] Syntax Error Help Pls.


teramera

Recommended Posts

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

<?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

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>';
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.