Jump to content

link $website


andy_b_1502

Recommended Posts

Hi everyone,

 

<?PHP
session_start();
include('php only scripts/db.php');
$id = $_GET['id'];
$query ="SELECT * FROM companies WHERE id = '$id'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);

?>
<?PHP 
			echo $row['street1'] . 
			"<br>" . $row['street2'] . 
			"<br>" . $row['city'] . "," .  $row['postcode'] .  
			"<br>phone: " . $row['phone'] .  
			"<br>email: " . $row['email'] . 
			"<br>website: " . $row['website']  ; 
?>

 

The above code, is displayed after a search.... The website section: ""<br>website: " . $row['website']  ; " is where i'd like to know how to link to the users website, how do i do this as the websites are going to be different everytime, is it something like this:

 

<a href="$website?id=<?PHP echo $row['id'];

  ?>">"<br>website: " . $row['website']  ; </a>

 

so when clicked the user is sent to the specific website?

 

 

Link to comment
Share on other sites

<?php
session_start();
include('php only scripts/db.php');
$id = $_GET['id'];
$query ="SELECT * FROM companies WHERE id = '$id'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
            $websiteUrl = $row['website'].'?id='.$row['id'];
			 echo $row['street1'] . 
			"<br>" . $row['street2'] . 
			"<br>" . $row['city'] . "," .  $row['postcode'] .  
			"<br>phone: " . $row['phone'] .  
			"<br>email: " . $row['email'] . 
			"<br>website: <a href='$websiteUrl'>" . $row['website'].'</a>'  ; 
}
?>

Link to comment
Share on other sites

i dont know?  :confused:

 

view00.php is the view page (passing the id to create a specific company view page)

 

it is what the website url's are on...

 

 

 

The newly created link for those url's has that path to it? where it should have the users website url instead

Link to comment
Share on other sites

<!DOCTYPE html>

  <head>

    <title>Removalspace.com</title>

<style type="text/css">

<!--

body {

background-image: url(styles/downloaded%20styles/todo/todo/images/bg.png);

 

}

-->

</style>

<link href="styles/downloaded styles/todo/todo/css/style.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" type="text/css" href="styles/downloaded styles/todo/todo/css/style9.css" />

    <link rel="stylesheet" type="text/css" href="styles/downloaded styles/todo/todo/css/demo.css" />   

        <link href='http://fonts.googleapis.com/css?family=Terminal+Dosis' rel='stylesheet' type='text/css' />

        <style type="text/css">

<!--

.Stile1 {color: #333333}

-->

        </style>

<script type="text/javascript">

 

  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-31656176-1']);

  _gaq.push(['_trackPageview']);

 

  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();

 

</script>

</head>

 

<body>

<!--start container -->

<div id="container">

<header>

    <nav> 

      <div id="logo"><a href="index.php"><img src="images/header2.png" alt="Logo here" width="219" height="161" /></a>      </div>

     

      <div id="search-top"><img src="styles/downloaded styles/todo/todo/images/quote-right.png" alt="images" /><span class="cursive">Enter your postcode here</span><img src="styles/downloaded styles/todo/todo/images/quote-left.png" alt="images" />

        <form method="post" action="search.php">

  <input type="text" name="strSearch" onFocus="if(this.value=='Search Area')this.value='';" onBlur="if(this.value=='')this.value='Search Area';" value="Search Area"  id="search-field"/>

  <input type="submit" value="" id="search-btn"/>

  </form>

      </div> 

      <div id="nav_social"><a href="http://www.facebook.com/pages/Removalspace/181434181939226"><img src="styles/downloaded styles/todo/todo/images/facebook_32.png" alt="Become a fan" width="32" height="32" /></a><a href="#"><img src="styles/downloaded styles/todo/todo/images/twitter_32.png" alt="Follows on Twitter" /></a><a href="id=183427956&trk=tab_pro"><img src="styles/downloaded styles/todo/todo/images/linkedin_32.png" alt="Linked in" /></a><a href="contact.php"><img src="styles/downloaded styles/todo/todo/images/email_32.png" alt="Contact" width="32" height="32" /></a><!-- Place this tag where you want the +1 button to render -->

<g:plusone size="small" annotation="inline"></g:plusone>

 

<!-- Place this render call where appropriate -->

<script type="text/javascript">

  (function() {

    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;

    po.src = 'https://apis.google.com/js/plusone.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);

  })();

</script> </div>

  </nav>

 

  </header>

 

 

<p><figure><a href="removals.php">Search Removals</a></figure> |</p>

<p><figure><a href="storage.php">Search Storage</a></figure> |</p>

<p><figure><a href="register00.php">Add Listing</a></figure> |</p>

<p><figure><a href="about.php">About</a></figure> |</p>

<p><figure><a href="contact.php">Contact</a></figure> |</p>

<p><figure><a href="login00.php">Login</a></figure></p>

<div class="content">

  <!--star main -->

 

  <main></main>

    <!--end main -->

    <!--start middle -->

    <middle>   

      <div class="section_slogan"><table>

<tr>

<td valign="top"><div class="abox">

      <figure>

      <fcapion>

    <h1><img src="images/thumbs/logo_1.jpg" alt="logo"/></h1>

      </fcaption></figure></div></td>

           

<td valign="top">

<div class="abox">

      <figure>

      <fcapion>

    <h1>Tennyson Lodge,<br>12 Tennyson Road,<br>Worthing,,BN11 4BY<br>phone: 01903201111<br>email: info@domesticremoval.co.uk<br>website: <a href='' target='_blank'>www.a1worthingmoves.com</a></h1>

      </fcaption></figure>

</div>

</td>

</tr>

        <tr>

<td><div class="abox">

      <figure>

      <fcapion>

    <h1>Company description:

      <hr>no description set - please log in to edit.</h1>

      </fcaption></figure>

</div></td>

</tr></table></div>

    </middle>

</div>

<!--end middle -->

<!--start footer -->

<footer> 

  <div id="footer"></div>

</footer>

<!--end footer -->

</div>

<!--end container -->

<!-- Free template distributed by http://freehtml5templates.com -->

  </body>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>

</html>

 

Link to comment
Share on other sites

Wowza's.  I wasn't expecting that reply.

 

I just meant for you point post the single line that has the anchor tag on it so I don't have to go sifting through a bunch of lines of completely irrelevant code.  I just want to see what's being outputted to the page to see what the issue might be.

 

In fear of this going back and forth for 20 minutes, I believe this is the line in question:

 

<h1>Tennyson Lodge,<br>12 Tennyson Road,<br>Worthing,,BN11 4BY<br>phone: 01903201111<br>email: info@domesticremoval.co.uk<br>website: <a href='' target='_blank'>www.a1worthingmoves.com</a></h1>

 

And even more specifically:

 

<a href='' target='_blank'>www.a1worthingmoves.com</a>

 

As you can see, the website is not being included within the href='' attribute.  That's why when you click the link it just takes you back to the same page... 'cause leaving that blank makes a reference to the current page.

Link to comment
Share on other sites

lol okay...

 

<?PHP 
			echo $row['street1'] . 
			"<br>" . $row['street2'] . 
			"<br>" . $row['city'] . "," .  $row['postcode'] .  
			"<br>phone: " . $row['phone'] .  
			"<br>email: " . $row['email'] . 
			"<br>website: <a href='$website' target='_blank'>" . $row['website'].'</a>'  ;  
			?>

 

maybe you could tell me why it's blank as i dont have a clue!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.