Jump to content

[SOLVED] PHP URL


greens85

Recommended Posts

Hi all,

 

I currently have a situation where I have a main site (advertsing jobs) and a few partner sites which also carry these job ads.

 

What i want is to have a 'Apply Now' link on the partner site that then takes the user to my main site and drops them at the relevant job ad!

 

I'm not quite sure how to make this work, can anyone offer me any advice?

 

This is the code that drags the ads out of my database. I have also commented the line where i am trying to link it to the mainsite.

 

<?
$sql = "SELECT * FROM jobs WHERE CS = 'Yes' ORDER BY jobid";
if ($result = mysql_query($sql)) {
  if (mysql_num_rows($result)) {
    while ($row = mysql_fetch_array ($result)) {
	echo '<font color="#246494"><strong>Job Title:</strong></font> ';
	echo $row['position'];
	echo '<br/>';
	echo '<font color="#246494"><strong>Description:</strong></font> ';
	echo $row['description'];
	echo '<br/>';
	echo '<br/>';
	echo '<font color="#246494"><strong>Job Reference:</strong></font> ';
	echo $row['jobref'];
	echo '<br/>';
	echo '<font color="#246494"><strong>Hours:</strong></font> ';
	echo $row['hour'];
	echo '<br/>';
	echo '<font color="#246494"><strong>Location:</strong></font> ';
	echo $row['subcounty'];
	echo '<br/>';
	echo '<font color="#246494"><strong>Working Term:</strong></font> ';
	echo $row['contract'];
	echo '<br/>';
	echo '<font color="#246494"><strong>Salary:</strong></font> ';
	echo $row['salary'];
	echo '<br/>';
	echo '<font color="#246494"><strong>Application Deadline:</strong></font> ';
	echo $row['deadline'];
      	echo '<br />';
<!-- this is what i have tried to make it work
	echo '<a href="http://www.mainsite.com/jobseekers/info.php?jobid=<?=$row[jobid]?>">Apply Now</font></a>';
end of attempted link -->
	echo '<br/>';
	echo '<hr style="background-color: rgb(204, 204, 204);" width="100%" size="1" noshade="noshade" color="#246494">';
    }
  }
}

?>

Link to comment
https://forums.phpfreaks.com/topic/154853-solved-php-url/
Share on other sites

Your already within php so theres no need for more php tags. eg;

 

echo '<a href="http://www.mainsite.com/jobseekers/info.php?jobid=<?=$row[jobid]?>">Apply Now</font></a>';

 

should be....

 

echo '<a href="http://www.mainsite.com/jobseekers/info.php?jobid=' . $row['jobid'] . '>Apply Now</font></a>';

Link to comment
https://forums.phpfreaks.com/topic/154853-solved-php-url/#findComment-814427
Share on other sites

If i have the following line:

 

echo '<a href="http://www.mysite.com/jobseekers/info.php?jobid=8?>">Apply Now</font></a>';

 

It drops me on the right page at the job ad, the problem is that i am dragging out multiple job ads in an array, therefore each one is going to have a different id.

 

Is there anyway to call a certain id, depending on what job ad you want to view?

 

Appologies for my lack of knowledge here, im relativley new to PHP!

Link to comment
https://forums.phpfreaks.com/topic/154853-solved-php-url/#findComment-814439
Share on other sites

Could this apply to one link?

 

As I only have the code written once and it is repeated using an array?

 

Therefore I couldnt write a 'a href' for each job.

 

I have seen something similar done like this:

 

<a href=<?=$fullurl?>/jobseekers/info.php?jobid=<?=$as[jobid]?>>View Full Details</font></a>

 

When u rollover the link, it gives you the relevant id, this is what i was trying to emulate but with little success!

 

Hope this makes sense!

Link to comment
https://forums.phpfreaks.com/topic/154853-solved-php-url/#findComment-814453
Share on other sites

Hi all,

 

I have now solved this problem. Incase anyone else needs this for reference in the future, this is the final code:

 

<a href="http://www.mysite.com/jobseekers/info.php?jobid=<?=$row['jobid']?>">Apply Now</a>

 

I basically close the php tags before i wrote the link, the added some php for the jobid.

 

Not sure how u add solved to a thread, so if admin could do that for me it would be great.

 

Thanks to all who replied

Link to comment
https://forums.phpfreaks.com/topic/154853-solved-php-url/#findComment-814466
Share on other sites

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.