Unknown Syntax Error, When Echoing Out Content

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ilya Kraft
    New Member
    • Jan 2011
    • 134

    Unknown Syntax Error, When Echoing Out Content

    Hello I have content that I want to echo out, but I came across a syntax error on line 31, which I can't figure out.
    I will post full code here just in case it is needed to answer a question, But The problem is on line 31.
    line 31:
    Code:
    <input name=\"pm_sender_id\" id=\"pm_sender_id\" type=\"hidden\" value=\"<?php echo $_SESSION['id']; ?>\" />
    Full Code

    Code:
    <?php 
    $contentVar = $_POST['contentVar'];
    if ($contentVar == "con1") {
        echo "<?php echo $interactionBox; ?>
    <div style=\"margin-left:30px; margin-right:38px;\" class=\"interactContainers\" id=\"add_friend\">
    <div align=\"right\"><a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:toggleInteractContainers('add_friend');\">cancel</a> </div>
    Add <?php echo \"$username\"; ?> as a friend? &nbsp;
    <a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:addAsFriend(<?php echo $logOptions_id; ?>, <?php echo $id; ?>);\">Yes</a>
    <span id=\"add_friend_loader\"><img src=\"images/loading.gif\" width=\"28\" height=\"10\" alt=\"Loading\" /></span>
    </div>
    
    <div style=\"margin-left:30px; margin-right:38px;\" class=\"interactContainers\" id=\"remove_friend\">
    <div align=\"right\"><a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:toggleInteractContainers('remove_friend');\">cancel</a> </div>
    Remove <?php echo \"$username\"; ?> from your friend list? &nbsp;
    <a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:removeAsFriend(<?php echo $logOptions_id; ?>, <?php echo $id; ?>);\">Yes</a>
    <span id=\"remove_friend_loader\"><img src=\"images/loading.gif\" width=\"28\" height=\"10\" alt=\"Loading\" /></span>
    </div>
    
    <!-- START DIV that serves as an interaction status and results container that only appears when we instruct it to -->
    <div id=\"interactionResults\" style=\"font-size:15px; padding:10px; margin-left:30px; margin-right:38px;\"></div>
    <!-- END DIV that serves as an interaction status and results container that only appears when we instruct it to -->
    
    <!-- START DIV that contains the Private Message form -->
    <div class=\"interactContainers\" id=\"private_message\" style=\"background-color: #d3f499; margin-left:30px; margin-right:38px;\">
    <form action=\"javascript:sendPM();\" name=\"pmForm\" id=\"pmForm\" method=\"post\">
    <font size=\"+1\">Sending Private Message to <strong><em><?php echo \"$username\"; ?></em></strong></font><br /><br />
    Subject:
    <input name=\"pmSubject\" id=\"pmSubject\" type=\"text\" maxlength=\"64\" style=\"width:385px;\" />
    Message:
    <textarea name=\"pmTextArea\" id=\"pmTextArea\" style=\"width:372px; height:45px; padding:8px;\"></textarea>
    <input name=\"pm_sender_id\" id=\"pm_sender_id\" type=\"hidden\" value=\"<?php echo $_SESSION['id']; ?>\" />
    <input name=\"pm_sender_name\" id=\"pm_sender_name\" type=\"hidden\" value=\"<?php echo $_SESSION['username']; ?>\" />
    <input name=\"pm_rec_id\" id=\"pm_rec_id\" type=\"hidden\" value=\"<?php echo $id; ?>\" />
    <input name=\"pm_rec_name\" id=\"pm_rec_name\" type=\"hidden\" value=\"<?php echo $username; ?>\" />
    <input name=\"pmWipit\" id=\"pmWipit\" type=\"hidden\" value=\"<?php echo $thisRandNum; ?>\" />
    <span id=\"PMStatus\" style=\"color:#F00;\"></span>
    <br /><button name=\"pmSubmit\" type=\"submit\">Submit</button> or <a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:toggleInteractContainers('private_message');\">Close</a>
    <span id=\"pmFormProcessGif\" style=\"display:none;\"><img src=\"images/loading.gif\" width=\"28\" height=\"10\" alt=\"Loading\" /></span></form>
    </div>
    <!-- END DIV that contains the Private Message form -->
    <div class=\"interactContainers\" id=\"friend_requests\" style=\"background-color:#FFF; height:120px; overflow:auto; margin-left:30px; margin-right:38px;\">
    <div align=\"right\"><a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:toggleInteractContainers('friend_requests');\">close window</a> &nbsp; &nbsp; </div>
    <h3>The following people are requesting you as a friend</h3>
    <?php 
    $sql = \"SELECT * FROM friends_requests WHERE mem2='$id' ORDER BY id ASC LIMIT 5000\";
    $query = mysql_query($sql) or die (\"Sorry we had a mysql error!\");
    $num_rows = mysql_num_rows($query); 
    if ($num_rows < 1) {
    echo 'You have no Friend Requests at this time.';
    } else {
    while ($row = mysql_fetch_array($query)) { 
    $requestID = $row[\"id\"];
    $mem1 = $row[\"mem1\"];
    $sqlName = mysql_query(\"SELECT username FROM myMembers WHERE id='$mem1' LIMIT 1\") or die (\"Sorry we had a mysql error!\");
    while ($row = mysql_fetch_array($sqlName)) { $requesterUserName = $row[\"username\"]; }
    /////// Mechanism to Display Pic. See if they have uploaded a pic or not //////////////////////////
    $check_pic = 'members/' . $mem1 . '/image01.jpg';
    if (file_exists($check_pic)) {
    $lil_pic = '<a href=\"profile.php?id=' . $mem1 . '\"><img src=\"' . $check_pic . '\" width=\"50px\" border=\"0\"/></a>';
    } else {
    $lil_pic = '<a href=\"profile.php?id=' . $mem1 . '\"><img src=\"members/0/image01.jpg\" width=\"50px\" border=\"0\"/></a>';
    }
    echo	'<hr />
    <table width=\"100%\" cellpadding=\"5\"><tr><td width=\"17%\" align=\"left\"><div style=\"overflow:hidden; height:50px;\"> ' . $lil_pic . '</div></td>
    <td width=\"83%\"><a href=\"profile.php?id=' . $mem1 . '\">' . $requesterUserName . '</a> wants to be your Friend!<br /><br />
    <span id=\"req' . $requestID . '\">
    <a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:acceptFriendRequest(' . $requestID . ');\" >Accept</a>
    &nbsp; &nbsp; OR &nbsp; &nbsp;
    <a href=\"#\" onclick=\"return false\" onmousedown=\"javascript:denyFriendRequest(' . $requestID . ');\" >Deny</a>
    </span></td>
    </tr>
    </table>';
    }	
    }
    ?>
    </div>
    
    <?php echo $the_blab_form; ?>
    <br />
    <div id=\"commentsdiv\">
    <?php include_once('checkcomments.php'); ?>
    </div>
    
    <div style=\"padding-left:30px; background-color:#FFF;  border-top:none;\">
    <?php 
    if($comments!="")
    {
    echo \"$paginationDisplay\";
    }
    else{
    echo \"This user has no posts ! \";
    } 
    
    ?>
    </div>";
    } 
    ?>
  • abhishekmiet
    New Member
    • Mar 2011
    • 8

    #2
    Ensure that you had started session before printing a session variable and that session variable had been registered.
    e.g.

    Code:
    <?php
    [B]session_start();[/B]
    
    if([B]isset($_SESSION['id'])[/B]){
    ?>
    <input name="pm_sender_id" id="pm_sender_id" type="hidden" value="<?php echo $_SESSION['id']; ?>" />
    <?php
    }
    else{
    ?>
    <input name="pm_sender_id" id="pm_sender_id" type="hidden" value="" />
    <?php
    }
    ?>
    Last edited by Dormilich; Mar 29 '11, 05:47 AM. Reason: please use [CODE] [/CODE] tags when posting code

    Comment

    Working...