1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Links open in Chrome but not in Firefox

Discussion in 'Programming' started by imranamen6, Jun 23, 2015.

  1. #1
    In one of the site i am working the link are opening in chrome but when i try to open the same link in firefox its not opening what could be the problem?


    <?php
    $sql=mysql_query("SELECT * FROM feed where itemtype='$type' ORDER BY id DESC LIMIT 20");
    while($row=mysql_fetch_array($sql))
            {
            $msgID= $row['id'];
            $name= $row['product_name'];
    $largimg=str_replace('/normal/', '/large/',$row['image_url']);
    $cssclass=str_replace(array(' ',"'"), '', $row['category']);
    ?>
    
    
    
    <div  class="pro2 message_box <?php echo $cssclass; ?>" id="<?php echo $msgID; ?>">
    <div  id="pro2_pic">
        <a href="<?php echo $row['link_product_page'] ?>"><img src="<?php echo $row['image_url']; ?>" alt="<?php echo $row['description']; ?>" title="<?php echo $row['description']; ?>" width="184px" height="184px"/></a></div>
    <div  id="pro2_text">
       
        <table   width="100%" border="0"  >
      <tr>
        <td class="text_green"><a href="<?php echo $row['link_product_page'] ?>"><?php echo $name; ?></a></td>
      </tr>
      <tr>
    <tr>
        <td class="text1"><div  id="pro2_des">
        <table width="100%" border="0">
      <tr>
        <td width="51%" height="20">Model :</td>
        <td width="49%"><?php echo $row['catalog_id']; ?></td>
      </tr>
      <tr>
        <td height="40">Material :</td>
        <td><?php echo str_replace(' ', ' ', $row['material']); ?></td>
      </tr>
    </table>
    
        </div></td>
      </tr>
     
      <tr>
        <td class="price">$ <?php echo $row['price'] ?> <div id="btn2"><a href="<?php echo $row['link_product_page'] ?>">Buy</a></div></td>
      </tr>
    </table>
    </div>
    </div>
    
    
    <?php
    }
    ?>
    
    Code (markup):

    This is the page > http://www.legenddiamond.com/earrings/
     
    imranamen6, Jun 23, 2015 IP
  2. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #2
    Are you missing a semi-colon ;?

    <?php echo $row['link_product_page']; ?>
    PHP:
    Also, run your HTML output through the Validator to check for HTML errors.

    http://validator.w3.org/
     
    billzo, Jun 23, 2015 IP
  3. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #3
    That shouldn't be an issue I think.

    The issue with the link is that there is an empty space at the end of the url causing it not to load. Removing that spaces seems to fix the issue for me. Replace:

    
    <a href="<?php echo $row['link_product_page'] ?>"><img src="<?php echo $row['image_url']; ?>" alt="<?php echo $row['description']; ?>" title="<?php echo $row['description']; ?>" width="184px" height="184px"/></a></div>
    
    Code (markup):
    With:

    
    <a href="<?php echo trim($row['link_product_page']); ?>"><img src="<?php echo $row['image_url']; ?>" alt="<?php echo $row['description']; ?>" title="<?php echo $row['description']; ?>" width="184px" height="184px"/></a></div>
    
    Code (markup):
    See if that fixes it for you.
     
    ThePHPMaster, Jun 23, 2015 IP
    imranamen6 likes this.
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    This is why I'm NOT a fan of opening and closing PHP willy-nilly just because you want to echo something. Convoluted poorly formatted mess, you could have ANY number of things wrong.

    Also, title should be on the anchor, not the IMG tag -- to say where the anchor is going -- though if it's identical to the alt text, then it's just a waste of bandwidth. I'm also REALLY wondering if you're accidentally outputting the same ID more than once, if all those DIV are REALLY necessary (feels needlessly bloated), why you are using attributes like BORDER that has zero place in any HTML written after 1997, trying to set height on TD when it's pretty much ignored by every browser, using TD to do TH's job, an inconsistent number of TD to TR ratio (I'm thinking that first one should be a caption?)

    This might also be a weird question, but why are you replacing spaces with spaces? Also you don't say "PX" on width and height when it's in the HTML. That's assumed, saying PX makes it ignored. HTML attributes either accept a raw number as pixels, or a percentage using %. No other measurements are valid markup-side. Saying PX is a CSS thing.

    I'm guessing WILDLY here, but:

    echo '
    	<div class="pro2 message_box ', $cssclass, '" id="', $msgID, '">
    		<a
    			href="', $row['link_product_page'], '"
    			class="pro2_pic"
    		>
    			<img
    				src="', $row['image_url'], '"
    				alt="', $row['description'], '>"
    				width="184" height="184"
    			>
    		</a>
    		<table>
    			<caption>
    				<a href="', $row['link_product_page'], '">
    					', $name, '
    				</a>
    			</caption>
    			<tfoot>
    				<tr>
    					<td colspan="2">
    						<span>$ ', $row['price'], '</span>
    						<a href="', $row['link_product_page'], '">Buy</a>
    					</td>
    				</tr>
    			</tfoot><tbody>
    				<tr>
    					<th scope="row">Model:</th>
    					<td>', $row['catalog_id'], '</td>
    				</tr><tr>
    					<th scope="row">Material:</th>
    					<td>', $row['material'], '</td>
    				</tr>
    			</tbody>
    		</table>
    	<!-- .pro2.message_box --></div>';
    Code (markup):
    Is probably how I'd approach that.... though I might use even less markup than that. What you have there really reeks of "HTML, what's that?"

    Looking at the rendered page... It is vomiting up the same ID's more than once, ID's that you probably don't even need on DIV you don't need... your ampersands and other html entities aren't escaped or encoded on the URI's, that could be part of the problem... you've got attributes like TARGET that much like BORDER have no business on a website... It's an outdated, outmoded laundry list of how NOT to code a website.

    Of course it's turdpress, so that kind-of goes without saying.

    Not sure where you are storing or generating those links, but I'd make REALLY sure that the parameters are run through urlencode before you output them.
    http://php.net/manual/en/function.urlencode.php

    Just as with a number of your outputs I'd probably be running htmlspecialchars on them.
     
    deathshadow, Jun 26, 2015 IP
    ryan_uk likes this.
  5. imranamen6

    imranamen6 Active Member

    Messages:
    947
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    98
    Digital Goods:
    1
    #5
    Thanks! This was the simplest of all!

     
    imranamen6, Jul 3, 2015 IP