Jump to content

teramera

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Posts posted by teramera

  1. Thanks a ton  The Little Guy, you made my day ! May you have a Wonderful Day as well.

    Thanks also everyone else for helping and keeping me going with the hope of getting it done.

    God Bless to all and Specially to phpfreaks.com for providing such a great service platform.

     

    Cheers !

    Tera

  2. No, don't use short tags. "<?=" is the short tag for <?php echo", so the line should read:

    <?php echo $row_sellerdetails['CompanyName'];?>

     

    Ken

     

    I tried both yours as well as Cal's suggestions. If I change that line which is line 13

    I get another error saying:

    Parse error: syntax error, unexpected '=' on line 68

  3. Please, please, please format your code next time (tabs).

     

    Give this a try:

     

    <?php
    session_start();
    include("../includes/connection.php");
    include("../includes/config.php");
    
    $sql_sellerdetails = "select * from buyer, buyer_profile WHERE buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID'];
    $result_sellerdetails = mysql_query($sql_sellerdetails);
    $row_sellerdetails = @mysql_fetch_array($result_sellerdetails);
    if(@mysql_num_rows($result_sellerdetails) > 0){	 ?>
    	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    	<html>
    	<head>
    	<title><?php=$row_sellerdetails['CompanyName'];?></title>
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    	<link href="../style.css" rel="stylesheet" type="text/css">
    	<style type="text/css">
    	<!--
    	body {
    	   margin-left: 0px;
    	   margin-top: 0px;
    	   margin-right: 0px;
    	   margin-bottom: 0px;
    	}
    	-->
    	</style>
    	<script language="javascript">
    	function validate(theform){
    		if(theform.Name.value == ""){
    			  alert("Please enter Name");
    			  theform.Name.focus();
    			  return false;
    		}else if(theform.Comment.value == ""){
    			alert("Please enter Comment");
    			theform.Comment.focus();
    			return false;
    	   }
    	   return true;
    	}
    	function showComment(){
    		document.getElementById('addcomment').style.display = "block";
    		document.getElementById('commentlink').style.display = "none";
    	}
    	</script>
    	</head>
    	<body>
    	<table border="0" cellspacing="0" width="1000" align="center">
    		<tr>
    		<?php include("topheader.php"); ?>
    	</tr>
    	<tr>
    	<td>
    	<table border="0" cellpadding="0" cellspacing="0" width="1000" align="center">
    		<tr>
    			<td colspan="2" align="center" valign="middle" background="../images/companyheadingbg.jpg" height="86">
    			<?php
    			if($row_sellerdetails['CompanyLogo'] != ""){
    				echo '<img src="../'.$row_sellerdetails['CompanyLogo'].'" border="0" align="absmiddle" style="border:2px solid #8080C0"> <a href="index.php?BuyerID='.$_REQUEST['BuyerID'].'>" class="companyheading">'.$row_sellerdetails['CompanyName'].'</a>';
    			}else{
    				echo '<a href="index.php?BuyerID='.$_REQUEST['SellerID'].'" class="companyheading">'.$row_sellerdetails['CompanyName'].'</a>';
    			}
    			?>
    			</td>
    		</tr>
    		<tr>
    			<td colspan="2">
    				<table border="0" cellpadding="0" cellspacing="0" width="100%" background="../images/GSMenuBg.gif">
    					<tr>
    						<td align="center" height="32"><a href="index.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Home</a></td>
    						<td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>
    						<td align="center"><a href="buying_leads.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Buying Leads</a></td>
    						<td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>
    						<td align="center"><a href="blogs.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Blogs</a></td>
    						<td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>
    						<?php
    						if($row_sellerdetails['GoldMember'] == 1){
    							echo '<td align="center"><a href="about_us.php?BuyerID='.$_REQUEST['BuyerID'].'" class="whitenav">About Us</a></td><td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>';
    						}
    						?>
    						<td align="center"><a href="view_contact_details.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Contact Us</a></td>
    					</tr>
    				</table>
    			</td>
    		</tr>
    		<tr>
    			<td width="21%" align="left" valign="top">
    				<table border="0" cellpadding="0" cellspacing="0" height="10"><tr><td></td></tr></table>
    				<!-- start of company profile-->
    				<table border="0" cellpadding="0" cellspacing="0" width="95%">
    					<tr>
    						<td width="9" height="26"><img src="../images/bar-box_01.gif"></td>
    						<td background="../images/bar-box_03.gif" class="heading"><a href="about_us.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>#companyprofile" class="headinglink">Company Profile</a></td>
    						<td width="9" height="26"><img src="../images/bar-box_05.gif"></td>
    					</tr>
    				</table>
    				<!-- end of company profile -->
    				<!-- start of rating/comment-->
    				<table border="0" cellpadding="0" cellspacing="0" height="10">
    					<tr>
    						<td></td>
    					</tr>
    				</table>
    				<table border="0" cellpadding="0" cellspacing="0" width="95%">
    					<tr>
    						<td width="9" height="26"><img src="../images/bar-box_01.gif"></td>
    						<td background="../images/bar-box_03.gif" class="heading"><a href="ratings.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="headinglink">Ratings/Comments</a></td>
    						<td width="9" height="26"><img src="../images/bar-box_05.gif"></td>
    					</tr>
    				</table>
    				<!-- end of rating/comment -->
    				<table border="0" cellpadding="0" cellspacing="0" height="10"><tr><td></td></tr></table>
    				<!-- start of contact Us-->
    				<table border="0" cellpadding="0" cellspacing="0" width="95%">
    					<tr>
    						<td width="9" height="26"><img src="../images/bar-box_01.gif"></td>
    						<td background="../images/bar-box_03.gif" class="heading">Contact Us</td>
    						<td width="9" height="26"><img src="../images/bar-box_05.gif"></td>
    					</tr>
    					<tr>
    						<td background="../images/bar-box_09.gif"></td>
    						<td background="../images/bar-box_10.gif">
    							<table border="0" cellpadding="3" cellspacing="0" width="100%" class="leftbar">
    								<tr>
    									<td height="5"></td>
    									<td></td>
    								</tr>
    								<?php
    								$sqlContactUs = "SELECT * FROM buyer, buyer_profile where buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID'];
    								$resultContactUs = mysql_query($sqlContactUs, $conn);
    								if (@mysql_num_rows($resultContactUs)!=0){
    									$row_ContactUs = @mysql_fetch_array($resultContactUs);
    									echo '
    									<tr>
    										<td width="3"></td>
    										<td class="contentblack">
    										'.$row_ContactUs['CompanyName'].'
    										<br><br>
    										<strong>Address:</strong><br>
    										'.$row_ContactUs['StreetAddress'].'
    										'.$row_ContactUs['StreetAddress2'].'
    										'.$row_ContactUs['StreetAddress3'].'
    										'.$row_ContactUs['City'].'
    										<br>
    										<br>';
    										?>
    										<a href="contact_now.php?BuyerID=<?php=$_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=$_REQUEST['BuyerID'];?>" class="contactus">View Contact Details</a>
    										<?php
    										echo "</td>
    									</tr>";
    								}
    								?>
    							</table>
    						</td>
    						<td background="../images/bar-box_11.gif"></td>
    					</tr>
    					<tr>
    						<td width="9" height="13"><img src="../images/bar-box_15.gif"></td>
    						<td background="../images/bar-box_16.gif"></td>
    						<td width="9" height="13"><img src="../images/bar-box_17.gif"></td>
    					</tr>
    				</table>
    				<!-- end of contact us-->
    			</td>
    			<td width="79%" align="center" valign="top">
    				<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
    					<tr height="10">
    						<td></td>
    					</tr>
    					<!-- start view Contact Details -->
    					<tr>
    						<td>
    							<table border="0" cellpadding="0" cellspacing="0" width="100%">
    								<tr>
    									<td width="7" height="22"><img src="../images/topleft.gif"></td>
    									<td background="../images/top.gif" class="heading">Ratings/Reviews/Comments</td>
    									<td width="8" height="22"><img src="../images/topright.gif"></td>
    								</tr>
    								<tr>
    									<td background="../images/left.gif"></td>
    									<td align="left">
    										<?php
    										if($_REQUEST['r']=="1"){
    											echo '<br><p class="redbold">Your feedback has been recorded.</p>';
    										}else{
    											echo '<br>';
    										}
    										if ($_SESSION['Name'] !=""){
    											?>
    											<div id="commentlink">
    												<a href="javascript:showComment();" class="edit">Click here to post Comment/Rating</a>
    											</div>
    											<div id="addcomment" style="display:none;">
    												<form method="post" action="add_comment.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" onSubmit="return validate(this);">
    													<table border="0" width="100%" style="border:1px solid #cccccc;" cellpadding="3">
    														<tr bgcolor="#CCCCCC"><td colspan="2" class="headings" style="color:#666666    ">Post a Comment</td></tr>
    														<tr><td align="right" class="content">Name:</td><td><input type="text" name="Name" id="Name"></td></tr>
    														<tr><td align="right" class="content">Rating:</td><td><select name="Rating">
    															<option value="0">0</option>
    															<option value="1">1</option>
    															<option value="2">2</option>
    															<option value="3">3</option>
    															<option value="4">4</option>
    															<option value="5">5</option>
    															<option value="6">6</option>
    															<option value="7">7</option>
    															<option value="8">8</option>
    															<option value="9">9</option>
    															<option value="10">10</option>
    														</select></td></tr>
    														<tr><td align="right" class="content">Comment:</td><td><textarea name="Comment" id="Comment" cols="50" rows="5"></textarea></td></tr>
    														<tr><td></td><td><input type="submit" value="Submit"></td></tr>
    													</table>
    												</form>
    											</div>
    											<?php
    										}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>';
    											$sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc";
    											$resultcomments= mysql_query($sqlcomments);
    											if (@mysql_num_rows($resultcomments)!=0){
    												echo '<br>';
    												while($row_comments = @mysql_fetch_array($resultcomments)){
    													echo '<p class="content">
    													<span style="color:#990000;">Comment By: '.$row_comments['CommentBy'].'</span> - <span style="color:#666666">Posted on '.date("M d, Y",strtotime($row_comments['AddedDate'])).'</span>
    													<br>
    													<span style="color:#000066">Rating: </span><img src="../images/rating'.$row_comments['Rating'].'.gif" border="0">
    													<br>
    													'.$row_comments['Comment'].'
    													</p>';
    												}
    											}
    											?>
    											</td>
    											<td background="../images/right.gif"></td>
    											</tr>
    											<tr>
    											<td width="7" height="4"><img src="../images/bottomleft.gif"></td>
    											<td background="../images/bottom.gif"></td>
    											<td width="8" height="4"><img src="../images/bottomright.gif"></td>
    											</tr>
    											</table>
    										<?php 
    										}
    										?>
    										</td>
    									</tr>
    									<!-- end of view contact details -->
    								</table>
    							</td>
    						</tr>
    					</table>
    				</td>
    			</tr>
    		</table>
    		<?php
    		include "footer.php";
    		?>
    	</body>
    	</html>
    <?php
    }else{
    	echo "Sorry, no record found..";
    }
    ?>

     

    Hi! Thanks The Little Guy,

    I tried your code but it gives this error:

    Parse error: syntax error, unexpected '=' on line 13

     

     

    I really appreciate your help, could you pls take some more time and help me pls.

  4. you need to add

     

    <?

     

    before

     

    $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc";
    $resultcomments= mysql_query($sqlcomments);
    if (@mysql_num_rows($resultcomments)!=0){

     

     

    Hi ! htmlstig,

    I tried what you recommended above but now i get this error:

    Parse error: syntax error, unexpected T_ELSE  on line 322

     

    Can you pls take a look at it and help.

     

    Thanks in advance.

     

  5. Hi!,

    I read up on the php stuff as a newbie and tried out editing an php script file. I am not getting any syntax error now but still i am making something wrong in the code. Its showing the code part also .... it should only read " Sign up or Register to be able to contact us."  and if the member is registered then they should be allowed to give the rankings. Can you pls help.

     

    The output is reading like this:

    a32xx1.jpg

     

    The code is here:

    <?
    session_start();
    include("../includes/connection.php");
    include("../includes/config.php");
    
    $sql_sellerdetails = "select * from buyer, buyer_profile WHERE buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID'];
    $result_sellerdetails = mysql_query($sql_sellerdetails);
    $row_sellerdetails = @mysql_fetch_array($result_sellerdetails);
    if(@mysql_num_rows($result_sellerdetails	) > 0)
    {
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title><?=$row_sellerdetails['CompanyName']?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="../style.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    }
    -->
    </style>
    <script language="javascript">
    function validate(theform)
    {
    if(theform.Name.value == "")
    {
    	alert("Please enter Name");
    	theform.Name.focus();
    	return false;
    }
    else if(theform.Comment.value == "")
    {
    	alert("Please enter Comment");
    	theform.Comment.focus();
    	return false;
    }
    return true;
    }
    
    function showComment()
    {
    document.getElementById('addcomment').style.display = "block";
    document.getElementById('commentlink').style.display = "none";
    }
    </script>
    </head>
    
    <body>
    <table border="0" cellspacing="0" width="1000" align="center">
    	<Tr>
    	<?
    		include("topheader.php");
    	?>
    	</Tr>
    	<Tr>
    	<Td>
    
    <table border="0" cellpadding="0" cellspacing="0" width="1000" align="center">
    
    <Tr><td colspan="2" align="center" valign="middle" background="../images/companyheadingbg.jpg" height="86">
    <?
    if($row_sellerdetails['CompanyLogo'] != "")
    {
    ?>
    <img src="../<?=$row_sellerdetails['CompanyLogo']?>" border="0" align="absmiddle" style="border:2px solid #8080C0"> <a href="index.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="companyheading"><?=$row_sellerdetails['CompanyName']?></a>
    <?
    }
    else
    {
    ?>
    <a href="index.php?BuyerID=<?=$_REQUEST['SellerID']?>" class="companyheading"><?=$row_sellerdetails['CompanyName']?></a>
    <?
    }
    ?>
    </td></Tr>
    
    <Tr><td colspan="2">
    <table border="0" cellpadding="0" cellspacing="0" width="100%" background="../images/GSMenuBg.gif">
    <td align="center" height="32"><a href="index.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">Home</a></td>
    <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>
    <Td align="center"><a href="buying_leads.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">Buying Leads</a></Td>
    <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>
    <Td align="center"><a href="blogs.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">Blogs</a></Td>
    <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>
    <?
    if($row_sellerdetails['GoldMember'] == 1)
    {
    ?>
    <Td align="center"><a href="about_us.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">About Us</a></Td>
    <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>
    <?
    }
    ?>
    <Td align="center"><a href="view_contact_details.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">Contact Us</a></Td>
    </table>
    </td></Tr>
    
    <Tr>
      <td width="21%" align="left" valign="top">
    
    
    
    <table border="0" cellpadding="0" cellspacing="0" height="10"><Tr><td></td></Tr></table>
    
    <!-- start of company profile-->
    <table border="0" cellpadding="0" cellspacing="0" width="95%">
    	<Tr>
    	<Td width="9" height="26"><img src="../images/bar-box_01.gif"></Td>
    	<Td background="../images/bar-box_03.gif" class="heading"><a href="about_us.php?BuyerID=<?=$_REQUEST['BuyerID']?>#companyprofile" class="headinglink">Company Profile</a></Td>
    	<Td width="9" height="26"><img src="../images/bar-box_05.gif"></Td>
    	</Tr>
    </table>
    <!-- end of company profile -->
    
    		<!-- start of rating/comment-->
    <table border="0" cellpadding="0" cellspacing="0" height="10"><Tr><td></td></Tr></table>
    <table border="0" cellpadding="0" cellspacing="0" width="95%">
    	<Tr>
    	<Td width="9" height="26"><img src="../images/bar-box_01.gif"></Td>
    	<Td background="../images/bar-box_03.gif" class="heading">
    	<a href="ratings.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="headinglink">Ratings/Comments</a>
    	</Td>
    	<Td width="9" height="26"><img src="../images/bar-box_05.gif"></Td>
    	</Tr>
    </table>
    <!-- end of rating/comment -->
    
    <table border="0" cellpadding="0" cellspacing="0" height="10"><Tr><td></td></Tr></table>
    
    <!-- start of contact Us-->
    <table border="0" cellpadding="0" cellspacing="0" width="95%">
    	<Tr>
    	<Td width="9" height="26"><img src="../images/bar-box_01.gif"></Td>
    	<Td background="../images/bar-box_03.gif" class="heading">Contact Us</Td>
    	<Td width="9" height="26"><img src="../images/bar-box_05.gif"></Td>
    	</Tr>
    
    	<Tr>
    	<Td background="../images/bar-box_09.gif"></Td>
    	<Td background="../images/bar-box_10.gif">
    		<table border="0" cellpadding="3" cellspacing="0" width="100%" class="leftbar">
    			<Tr><td height="5"></td>
    			<td></td>
    			</Tr>
    
    			<?
    				$sqlContactUs = "SELECT * FROM buyer, buyer_profile where buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID'];
    				$resultContactUs = mysql_query($sqlContactUs, $conn);
    				if (@mysql_num_rows($resultContactUs)!=0){
    					$row_ContactUs = @mysql_fetch_array($resultContactUs);
    					echo "
    						<Tr>
    							<td width='3'></td>
    							<td class='contentblack'>
    							".$row_ContactUs['CompanyName']."
    							<br><br>
    							<strong>Address:</strong><br>
    							".$row_ContactUs['StreetAddress']."
    							".$row_ContactUs['StreetAddress2']."
    							".$row_ContactUs['StreetAddress3']."
    							".$row_ContactUs['City']."
    							<br>
    							<br>";
    							?>
    <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>
    <?
    							echo "</td>
    						</Tr>
    						";
    				}
    			?>
    		</table>
    	</Td>
    	<Td background="../images/bar-box_11.gif"></Td>
    	</Tr>
    
    	<Tr>
    	<Td width="9" height="13"><img src="../images/bar-box_15.gif"></Td>
    	<Td background="../images/bar-box_16.gif"></Td>
    	<Td width="9" height="13"><img src="../images/bar-box_17.gif"></Td>
    	</Tr>
    </table>
    <!-- end of contact us-->
    
    </td>
      <td width="79%" align="center" valign="top">
      <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
    <Tr height="10"><Td></Td></Tr>
    <!-- start view Contact Details -->
    <Tr><Td>
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    	<Tr>
    	<Td width="7" height="22"><img src="../images/topleft.gif"></Td>
    	<Td background="../images/top.gif" class="heading">Ratings/Reviews/Comments</Td>
    	<Td width="8" height="22"><img src="../images/topright.gif"></Td>
    	</Tr>
    
    	<Tr>
    	<Td background="../images/left.gif"></Td>
    	<Td align="left">
    
    
    
    <?
    if($_REQUEST['r']=="1")
    {
    ?>
    <br>
    <p class="redbold">Your feedback has been recorded.</p>
    <?
    }
    else
    {
    ?>
    <br>
    <?
    }
    ?>
    <?php
    if ($_SESSION['Name'] !=""){
    ?>
    <div id="commentlink"><a href="javascript:showComment();" class="edit">Click here to post Comment/Rating</a></span><br></div>
    
    
    <div id="addcomment" style="display:none;">
    <form method="post" action="add_comment.php?BuyerID=<?=$_REQUEST['BuyerID']?>" onSubmit="return validate(this);">
    <table border="0" width="100%" style="border:1px solid #cccccc;" cellpadding="3">
    <tr bgcolor="#CCCCCC"><Td colspan="2" class="headings" style="color:#666666	 ">Post a Comment</Td></tr>
    <tr><Td align="right" class="content">Name:</Td><td><input type="text" name="Name" id="Name"></td></tr>
    <tr><Td align="right" class="content">Rating:</Td><td><select name="Rating">
    <option value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="10">10</option>
    </select></td></tr>
    <tr><Td align="right" class="content">Comment:</Td><td><textarea name="Comment" id="Comment" cols="50" rows="5"></textarea></td></tr>
    <tr><Td></Td><td><input type="submit" value="Submit"></td></tr>
    </table>
    </form>
    </div>
    <?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>
    
    
    $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc";
    $resultcomments= mysql_query($sqlcomments);
    if (@mysql_num_rows($resultcomments)!=0){
    
    ?>
    <br>
    
    
    <?
    while($row_comments = @mysql_fetch_array($resultcomments))
    {
    ?>
    <p class="content">
    <span style="color:#990000;">Comment By: <?=$row_comments['CommentBy']?></span> - <span style="color:#666666">Posted on <?=date("M d, Y",strtotime($row_comments['AddedDate']))?></span>
    <br>
    <span style="color:#000066">Rating: </span><img src="../images/rating<?=$row_comments['Rating']?>.gif" border="0">
    <br>
    <?=$row_comments['Comment']?>
    </p>
    <?
    }
    }
    ?>
    
    	</Td>
    	<Td background="../images/right.gif"></Td>
    	</Tr>
    
    	<Tr>
    	<Td width="7" height="4"><img src="../images/bottomleft.gif"></Td>
    	<Td background="../images/bottom.gif"></Td>
    	<Td width="8" height="4"><img src="../images/bottomright.gif"></Td>
    	</Tr>
    </table>
    
    </Td></Tr>
    <!-- end of view contact details -->
    
    
      </table></td>
    </Tr>
    </table>
    
    
    
    
    
    </Td></Tr>
    <?
    include "footer.php";
    ?>
    </table>
    </body>
    </html>
    <?
    }
    else
    {
    echo "Sorry, no record found..";
    }
    ?>

  6. 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>;
    ?>

  7. Hi!,

     

    want to use htaccess redirection to get the following:

     

    Currently in  my website I am getting the link as

    http://mydomain.com/up_auction_detail.php?auction_id=92&cat_id=1&auction_title=Cars%20volvo%20deluxe

     

    I would like the URL to show as :

    http://mydomain.com/up_auction_detail/92/1/Cars_volvo_deluxe.htm

     

    The auction_id=92&cat_id=1&auction_title=Cars%20volvo%20deluxe  part is a variable and the inputs change as per whatever is there in the result etc being pulled from mysql database.

     

     

    Can someone please help me with the code that i need to put in the .htaccess file to acheive this?

     

    Thanks in advance

    Regards

    tera

     

  8. Could the problem be somewhere in the form validator..... Here is the code from that file:

     

    
    <?PHP
    
    # ----------------------------------------------------------------------------------------------------
    # * FILE: /class_formValidator.php
    # ----------------------------------------------------------------------------------------------------
    
    /**
    * FormValidator
    *
    * This class validates forms nested in html files.
    * It can validate fields on following criteria:
    * - required field
    * - content ( email, digit, alpha, word )
    * - own perl or posix regular expression
    * - length ( min, max, equal )
    * - only defined values ( for select, radio and checkbox )
    * - forbidden values
    * - field values dependecies 
    *    + value can only exist with other field(s)
    *    + value must be equal to other field(s) ( eg. on pass verification )
    *    + value must exists OR/XOR other value(s)
    * - It handles fields named like an array ( eg. radiobox/checkbox )
    * - It can highlight the badly validated fields ( with smarty templates )
    * - It can return an array which information which fields were badly validated ( with field name, or logical name )
    *
    **/
    
    /*
    Description
    Parameters of form elem that are being processed by the class
    
    $elem = array (
    	'name'         => string,  // all
    	'type'         => string,  // text or select
    	                           // text covers html types: text, textarea, hidden, password
    	                           // select covers html types: select, checkbox and radio
    	'label'        => string,  // field label ( eg. 'Phone number' )
    	'required'     => boolean, // field must have value
    	'cont'         => string,  // content type: email, word, alpha, digit
    	'ereg'         => string,  // text, textarea
    	'preg'         => string,  // text, textarea
    	'len'          => integer, // accurate length
    	'len_min'      => integer, // min length
    	'len_max'      => integer, // max length
    	'val_max'      => integer, // max value of an integer ( use with cont == digit )
    	'val_min'      => integer, // min value of an integer ( use with cont == digit )
    	'values'       => array;   // select accepted values
    	'forbid'       => array;   // forbidden values that match other criteria
    	'arr_size_min' => integer  // when field name is an array( eg. 'phones[]' )
    	                           // minimum number of elements in array
    	// Fields dependencies
    	'eqal'         => mixed,   // array or string,
    	                           // value of this field must be equal to value of field in array()
    	                           // eg. in when there are two password boxes either array or string
    	'with'         => mixed,   // array or string, value must exist with other value(s)
    	'alt_or'       => mixed,   // array or string, at least one of fields must have a value
    	'alt_xor'      => mixed    // array or string, only one field must have a value
    	);
    */
    
    class FormValidator {
    
    	/**
    	 * Form definition
    	 * 
    	 * @var array
    	 * @access private
    	 */
    	var $elems = array();
    
    	/**
    	 * If error occured while validation
    	 * 
    	 * @var boolean
    	 * @access private
    	 */
    	var $err = false;
    
    	/**
    	 * Validation status for each field
    	 * 
    	 * @var array
    	 * @access private
    	 */
    	var $validElems = array();
    
    	/**
    	 * Fields that need dependency check
    	 * 
    	 * @var array
    	 * @access private
    	 */
    	var $secPhase = array();
    
    	/**
    	 * Constructor
    	 *
    	 * @param mixed $elems form definition
    	 * @access public
    	 * @return void
    	 */
    	function FormValidator(&$elems) {
    		if ( is_array($elems) ) {
    			// hmm...
    			is_array($elems[0]) ? $this->elems = $elems : $this->elems[] = $elems;
    		}
    	}
    
    	/**
    	 * Validates Form
    	 *
    	 * @param array $request - $_GET, $_POST, $_SESSION or other data
    	 * @access public
    	 * @return boolean true - validation OK, false - validation error
    	 */
    	function validate(&$request) {
    
    		// validated elems
    		$this->validElems = array();
    
    		$this->err = false;
    
    		// fields that needs dependency check
    		$this->secPhase = array();
    
    		foreach ( $this->elems as $e ) {
    
    			$name = $e['name'];
    
    			isset($e['label']) ? null : $e['label'] = null;
    
    			// Field not present in html form
    			if ( !isset($request[$name]) ) {
    				if($e['required']){
    					$this->_setError($name, $k, $v, $e['label']);
    					continue;
    				} else {
    					$this->validElems[$name][$k] = array('value'=>$v,'validation'=>true,'label'=>$e['label']);			  
    				}
    			}
    
    			$val = $request[$name];
    
    			// If field name is an array ( eg. phones[] in example above )
    			if ( is_array($val) ) {
    				if ( !empty($e['arr_size_min']) && $e['arr_size_min'] > 0 ) {
    					$c = 0;
    					foreach($val as $v) {
    						if ( !empty($v) ) {
    							$c++;
    						}
    					}
    					if ( $c < $e['arr_size_min'] ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    				}
    			}
    
    			// Each value is converted to an array
    			else {
    				$val = array($val);
    			}
    
    			foreach ( $val as $k => $v ) {
    
    				if ( !empty($e['required']) && (empty($v) && $v != "0")) {
    					$this->_setError($name, $k, $v, $e['label']); continue;
    				} elseif ( empty($v) ) {
    					$e['validated'] = true;
    					$this->validElems[$name][$k] = array('value'=>$v,'validation'=>true,'label'=>$e['label']);
    					continue;
    				}
    
    				if ( in_array($e['type'], array('text')) ) {
    					if ( !empty($e['len']) && $e['len'] != strlen($v) ) {
    					$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    					if ( !empty($e['len_min']) && strlen($v) < $e['len_min'] ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    					if ( !empty($e['len_max']) && strlen($v) > $e['len_max'] ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    					if ( !empty($e['val_min']) && $v < $e['val_min'] ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    					if ( !empty($e['val_max']) && $v > $e['val_max'] ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    					if ( !empty($e['ereg']) && !ereg($e['ereg'], $v) ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    					if ( !empty($e['preg']) && !preg_match($e['preg'], $v) ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    					if ( !empty($e['forbid']) && in_array($v, $e['forbid']) ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    					if ( isset($e['cont']) && in_array($e['cont'], array('email', 'alpha', 'word', 'digit','date','money')) ) {
    						$expr = ''; // just temporally
    						// digits only
    						if ( $e['cont'] == 'digit' ) {
    							$expr = "/^\d*$/";
    						}
    						// email verify
    						elseif ( $e['cont'] == 'email' ) {
    							if ( !$this->verifyEmail($v) ) {
    								$this->_setError($name, $k, $v, $e['label']); continue;
    							}
    						}
    						elseif ( $e['cont'] == 'alpha' ) {
    							$expr = "/^[a-zA-Z]*$/";
    						}
    						elseif ( $e['cont'] == 'word' ) {
    							$expr = "/^\w*$/";
    						}
    						elseif ( $e['cont'] == 'date' ) {
    							$expr = "/^(??:(?:0?[13578]|1[02])(\/|-)31)|(??:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(??:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(??:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/";
    						}
    						elseif ( $e['cont'] == 'money' ) {
    							$expr = "/^[0-9]{1,}+[,,.][0-9]{2,2}$/";
    						}
    						// del first condition when class would be complete...
    						if ( !empty($expr) && !preg_match($expr, $v) ) {
    							$this->_setError($name, $k, $v, $e['label']); continue;
    						}
    					}
    					if ( !empty($e['with']) ) {
    						$this->secPhase[] = $e;
    					}
    					if ( !empty($e['equal']) ) {
    						$this->secPhase[] = $e;
    					}
    					foreach ( array('with', 'equal', 'alt_or', 'alt_xor') as $eq ) {
    						if ( !empty($e[$eq]) ) {
    							$this->secPhase[] = $e;
    							break;
    						}
    					}
    				}
    
    				elseif ( $e['type'] == 'select' ) {
    					if ( isset($e['values']) && !in_array($v, $e['values'])  ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    
    					foreach ( array('with', 'equal', 'alt_or', 'alt_xor') as $eq ) {
    						if ( !empty($e[$eq]) ) {
    							$this->secPhase[] = $e;
    							break;
    						}
    					}
    
    				}
    
    				// hmm...
    				else {
    					$this->_setError($name, $k, $v, $e['label']); continue;
    				}
    
    				$this->validElems[$name][$k] = array('value'=>$v,'validation'=>true,'label'=>$e['label']);
    
    			}
    
    		}
    
    		$this->_validateSecondPhase($request);
    		return $this->err;
    
    	}
    
    	/*
    	 * Dependency check
    	 *
    	 * @param array array $request - $_GET, $_POST, $_SESSION or other data
    	 * @access private
    	 * @return void
    	 */
    	function _validateSecondPhase(&$request) {
    
    		foreach ( $this->secPhase as $e ) {
    
    			$name = $e['name'];
    			$val = $request[$name];
    
    			if ( !is_array($val) ) {
    				$val = array($val);
    			}
    
    			foreach ( $val as $k => $v) {
    
    				if ( isset($e['with']) && is_array($e['with']) ) {
    					foreach ($e['with'] as $eq) {
    						if ( !empty($v) && empty($this->validElems[$eq][$k]['value']) ) {
    							$this->_setError($eq, $k, $v, $e['label']); continue;
    						}
    					}
    				}
    				elseif ( !empty($e['with']) && !empty($v) && empty($this->validElems[$e['with']][$k]['value']) ) {
    					$this->_setError($e['with'], $k, $v, $e['label']); continue;
    				}
    
    				if ( isset($e['equal']) && is_array($e['equal']) ) {
    					foreach ( $e['equal'] as $eq ) {
    						if ( $v != $this->validElems[$eq][$k]['value'] ) {
    							$this->_setError($name, $k, $v, $e['label']); continue;
    						}
    					}
    				}
    				elseif ( !empty($e['equal']) && $v != $this->validElems[$e['equal']][$k]['value'] ) {
    					$this->_setError($name, $k, $v, $e['label']); continue;
    				}
    
    				if ( isset($e['alt_or']) && is_array($e['alt_or']) && empty($v) ) {
    					$c = 0;
    					foreach ( $e['alt_or'] as $eq ) {
    						 empty($this->validElems[$e['alt_or']][$k]['value']) ? $c++ : null;
    					}
    					if ( $c == 0 ) {
    						$this->_setError($name, $k, $v, $e['label']); continue;
    					}
    				}
    				elseif ( !empty($e['alt_or']) && empty($v) && empty($this->validElems[$e['alt_or']][$k]['value']) ) {
    					$this->_setError($e['with'], $k, $v, $e['label']); continue;
    				}
    
    				if ( isset($e['alt_xor']) && is_array($e['alt_xor']) ) {
    					$c = 0;
    					foreach ( $e['alt_xor'] as $eq ) {
    						empty($this->validElems[$e['alt_xor']][$k]['value']) ? null : $c++;
    					}
    
    					if ( empty($v) && $c != 1 ) {
    						$this->_setError($e['with'], $k, $v, $e['label']); continue;
    					}
    					elseif ( !empty($v) && $c > 0 ) {
    						$this->_setError($e['with'], $k, $v, $e['label']); continue;
    					}
    				}
    				elseif ( !empty($e['alt_xor']) ) {
    					if ( empty($v) && empty($this->validElems[$e['alt_xor']][$k]['value']) ) {
    						$this->_setError($e['with'], $k, $v, $e['label']); continue;
    					}
    					elseif ( !empty($v) && !empty($this->validElems[$e['alt_xor']][$k]['value']) ) {
    						$this->_setError($e['with'], $k, $v, $e['label']); continue;
    					}
    				}
    
    			}
    
    		}
    
    	}
    
    	/**
    	 * Email verification
    	 * 
    	 * @param string $email
    	 * @access private
    	 * @return boolean true if OK otherwise false
    	 */
    	function verifyEmail($email) {
    		$expr = '/^(.+)@(([a-z0-9\.-]+)\.[a-z]{2,5})$/i';
    		$uexpr = "/^[a-z0-9\~\!\#\$\%\&\(\)\-\_\+\=\[\]\;\:\'\"\,\.\/]+$/i";
    		if (preg_match($expr, $email, $regs)) {
    			$username = $regs[1];
    			$host = $regs[2];
    			//if (checkdnsrr($host, MX)) {
    				if (preg_match($uexpr, $username)) {
    					return true;
    				} 
    				else {
    					return false;
    				}
    		} else {
    			return false;
    		}
    	}
    
    	/**
    	 * WARNING !
    	 * Function name will be changed in future releases
    	 *
    	 * Highlight field/text with Smarty - if you don't use smarty it's quite useless...
    	 *
    	 * 
    	 * @param object $s - Smarty object
    	 * @param string $class_name - a css class name to assign
    	 * @access public
    	 * @return void
    	 */
    	function assignErrorClass(&$s, $class_name) {
    		foreach ( $this->validElems as $k => $v ) {
    			foreach ( $v as $k1 => $v1) {
    				if ( $v1[1] === false ) {
    					$err_c[$k][$k1] = $class_name;
    				}
    			}
    		}
    		$s->assign('err_c', $err_c);
    	}
    
    	/**
    	 *
    	 * Setting error
    	 * 
    	 * @param string $name field name
    	 * @param integer $k key value usually 0 until field name is an array ( eg. phones[])
    	 * @param string $value field value
    	 * @param string $label - field label
    	 * @access private
    	 * @return void
    	 */
    	function _setError($name, $k=0, $value = '', $label = '') {
    		$this->validElems[$name][$k] = array('value'=>$value,'validation'=>false,'label'=>$label);
    		$this->err = true;
    	}
    
    	/**
    	 * get array with validation result
    	 * 
    	 * @access public
    	 * @return array - array with validation result for each field
    	 */
    	function getValidElems() {
    		return $this->validElems;	
    	}
    
    }
    
    ?>
    

  9. Hi! jonsjava,

    I tried your code what you gave me , but it still gives me the same error message and does not post.

     

    Perhaps its something in the where the email posting code is in the scripts..... Can you guide me to find which file would be responsible for this part of the work.

     

    Cause if i post the message all in one line then the form works.

     

    Regards

    tera

  10. Hi! rondog,

    I entered the echo string which you gave me like this :

    <?php echo $_POST['body']; ?>

    above where the form part was and submitted the form:

     

     

    While I entered the text in multiple lines using the ENter Key to break lines like this:

    8143e4a9ef.jpg

     

    the echo command came back looking like this with the text in one single line.

    If I post in one single line then the worm work, but not the way when i enter it with breaks in lines.

    Does this trow some more light on what I need to do... Look forward to your guidence.

    Thanks once again

     

    Regards

    Tera.

  11. Hi! rondog,

    Sorry I couldnt figure out where to run that line for echo that you mentioned.

    here is the code of the form part in the php page:

     

    <form name="mail" method="post" action="<?=$_SERVER["PHP_SELF"]?>?id=<?=$_GET["id"]?>#info" class="formListingDetail">

     

    <? foreach ($_GET as $key => $value) print "<input type=\"hidden\" name=\"$key\" value=\"$value\" />"; ?>

    <input type="hidden" name="id" value="<?=$_GET["id"]?>" />

    <input type="hidden" name="id" value="<?=$_GET["id"]?>" />

    <input type="hidden" name="to" value="<?=htmlentities($listing->getString("email"))?>" />

    <? if ($error) { ?>

    <p class="<?=$message_style?>"><?=$error?></p>

    <? } ?>

     

    <a name="info"></a><p class="formListingTitle"><?=system_showText(LANG_LISTING_CONTACTTITLE)?></p>

     

    <label for="from"><span class="required">*</span><?=system_showText(LANG_LABEL_YOUREMAIL)?></label>

    <input type="text" name="from" id="from" value="<?=$from?>" />

    <br />

    <label for="subject"><?=system_showText(LANG_LABEL_SUBJECT)?></label>

    <input type="text" name="subject" id="subject" value="<?=$subject?>" />

    <br />

    <label for="body"><span class="required">*</span> <?=system_showText(LANG_LABEL_ADDITIONALMSG)?></label>

    <textarea name="body" rows="5" id="body" cols=""><?=$body?></textarea>

    <br class="clear" />

    <p class="formCaptchaWarning"><?=system_showText(LANG_LABEL_CAPTCHAHELP)?></p>

    <div class="captchaImage"><span class="required">*</span><img src="<?=DEFAULT_URL?>/includes/code/captcha.php" border="0" alt="<?=system_showText(LANG_ALT_CAPTCHA)?>" title="<?=system_showText(LANG_TITLE_CAPTCHA)?>" /></div>

    <input type="text" name="captchatext" value="" class="formCode" />

    <ul class="standardButton">

    <li>

    <? if ($user){ ?>

    <button type="submit" value="Send"><?=system_showText(LANG_BUTTON_SEND)?></button>

    <? } else { ?>

    <button type="button" value="Send"><?=system_showText(LANG_BUTTON_SEND)?></button>

    <? } ?>

    </li>

    </ul>

    <br class="clear" />

    <!--[if IE]>

    <br class="clear" />

    <![endif]-->

     

    </form>

     

    Can you tell me where to add that line taht you gave me  so that we know about whats making the error.

     

    Thanks Regards Tera

  12. But when i enter text with multiple lines using the enter key to break lines or a sentence it gives an error and does not post.

     

    What is the error?

    feb8768254.jpg

     

    Thats the only error I am getting. Can you pls tell me what string or someting to look for in the files so then I can post that relevant part here so you can peek into the code  and understand it better. Am a newbie so not know php.

     

    Thanks

    Tera

  13. Hi!,

    I am trying to get a php directory script to work and am getting a unique error.

    When i enter text in the body field without using a enter key to break lines it works fine

     

    d779b868a3.jpg

     

    But when i enter text with multiple lines using the enter key to break lines or a sentence it gives an error and does not post.

     

    c463f777d9.jpg

     

    Can someone please help tell me how to get it to work. What sort of codes do I look for in the script since there are a large number of files and more importantly what do i need to change to get it to work.

     

     

    All help greatly appreciated.

    Thanks in advance for your time

    Tera

  14. Hi!,

    Am looking at getting a php powerd joomla webiste working with the search engine friendly links... the link is at present something like http://www.domain.com/option,com_sobi2/Itemid,47.html  I want to setup a 301 redirect to a shorter URL something like http://www.domain.com/directory/index.php or index.html

     

    What is the code that i need to add into the .htaccess file?

     

    Can some please assist me .

     

    Regards

    tera

  15. I am a newbie at php but am trying to learn .. with some help from you experienced lot its a pleasure.

    Can you help me with what i want to do, am totally lost here.

    This is what i want to do:

    In a php script I have the following code where it shows the text in the browser:

     

    if ($SilentMode != 1) {

                print "<br> \n ";

                print "Confirmation email sent to $Email_Address! Please check your inbox. <br> \n ";

            }

     

     

    What i would like to do is, instead of outputting the text "Confirmation email sent... etc etc" as above, have it open a html page using the meta refresh tag like this:

    <meta http-equiv="refresh" content="0;url=http://www.mydomain.com/success.html">

     

    Can someone please help me with the code, what it is , so that I can have it working the way as outlined above.

     

    Thanking you in advance

     

    Regards

    Tera

  16. Hi!,
    I translated an usual HTML page into PHP and inserted the Include file tag but the include file does not show.
    When i test the include file on its own .. it works.
    I am certain I have something wrong in the syntax .. or the way the code is presented.
    Please take a look at the code below and help.

    The code that i tried to include is : <?php include("http://mysitename.com/banners.php"); ?>

    The code which is not working is:
    [code]
    echo "                <div align=\"center\">\n";
    echo "                  <center>\n";
    echo "        <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"160\" style=\"border-collapse: collapse\" bordercolor=\"#111111\">\n";
    echo "          <tbody><tr> \n";
    echo "            <td> \n";
    [color=#CC0000]echo "  <p align=\"center\"><?php include(\"http://www.mydomainname.com/banners.php\"); ?></td>\n";[/color]
    echo "          </tr>\n";
    echo "        </tbody></table>\n";
    echo "                  </center>\n";
    echo "                </div>\n";
    echo "                <p>\n";
    echo "        <br>\n";
    [/code]

    Please help am going nutty with this as a newbie.
    Thanks in advance.
    Regards
    tera
×
×
  • 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.