Link to home
Start Free TrialLog in
Avatar of aideyd
aideyd

asked on

PHP MYSQL- HREF LINK NOT THE SAME IN ALL BROWSERS

Hi Please see code below. When i click on the href link it works fine in Internet explorer but on safari or firefox it does'nt. Can someone help me with this?

Result in IE: file://secretary/EmployeePictures/1Aiden%20Donnelly%202.jpg (correct)
Result in Firefox: http://dove/mustointranet/\\secretary\EmployeePictures\1Aiden Donnelly 2.jpg

Code:

<?php
$db = mysql_connect(localhost, phonebook, d1r3ct66)
	or
die("could not connect");
mysql_select_db("phonebook",$db);

if($searchby == "Last Name") {$var1 = "lastname";}
if($searchby == "First Name") {$var1 = "firstname";}
if($searchby == "Job Title") {$var1 = "jobtitle";}
if($searchby == "Department") {$var1 = "department";}
if($searchby == "Email Address") {$var1 = "email";}
if($searchby == "Office") {$var1 = "office";}
if($searchby == "Office Phone") {$var1 = "phone";}
if($searchby == "Office Phone Ext") {$var1 = "phoneext";}
if($searchby == "Mobile") {$var1 = "mobile";}

if($var2){
$var2temp = "$var2";
}

if($var2temp){
$var2 = "$var2temp%";
}

if(!($var1)){
$var1 = "lastname";
}

$result = mysql_query("SELECT * FROM musto WHERE $var1 LIKE '$var2' ORDER BY lastname ASC",$db); 
echo("<table width='98%' border='0' cellpadding='2'><th>Name</th><th>Job Title</th><th>Dept</th><th>Location</th><th>Phone</th><th>Ext</th><th>Mobile</th><th>Picture</th>");
while ( $row = mysql_fetch_array($result) ) {
echo("<tr>" .
	"<td align='left'><a href=\"mailto:$row[email]\">$row[firstname] $row[lastname]</a></td> <td align='left'>" .
	"$row[jobtitle]</td><td align='left'>$row[department]</td><td align='left'>$row[office]</td><td align='left'> $row[phone]" .
	"</td><td align='left'>$row[phoneext]</td><td align='left'>$row[mobile]</td><td align='left'><a href=\"\\\secretary\EmployeePictures\\1$row[firstname] $row[lastname] 2.jpg\" rel=\"lightbox\" title=\"$row[firstname] $row[lastname] - $row[jobtitle]\">Photo</a></td>" .
	"</tr>\n\n");
}

if ($dofunction == "view"){
$result = mysql_query("SELECT * FROM musto WHERE musto.id = '$id'", $db);
print ("<div align='left'><left><table border='1' cellpadding='0' cellspacing='0' width='80%'><tr><td width='38%' bgcolor='#0099FF'><b>Name:</B> </td>      <td width='30%' bgcolor='#0099FF'><b>Title:</b></td>" .
"<td width='32%' bgcolor='#0099FF'><b>Company:</b></td></tr><tr><td width='38%'>$row[firstame] $row[lastname] </td>" .
"<td width='30%'>$row[jobtitle]</td><td width='32%'>$row[office]</td></tr></table></left></div>");
print ("<div align='left'><left><table border='1' cellpadding='0' cellspacing='0' width='80%'><tr><td width='38%' bgcolor='#0099FF'><b>E-Mail Address:</B> </td><td width='30%' bgcolor='#0099FF'><b>Web Site:</b></td>" .
"<td width='32%' bgcolor='#0099FF'><b>Affiliation:</b></td></tr><tr><td width='38%'><a href='mailto:$row[email]'>$row[email]</a> </td>" .
"<td width='30%'><a href='$row[phoneext]'>$row[department]</a></td><td width='32%'>$row[mobile]</td></tr></table></left></div>");
print ("<div align='left'><left><table border='1' cellpadding='0' cellspacing='0' width='80%'><tr><td width='25%' bgcolor='#0099FF'><b>Home Phone:</B> </td><td width='25%' bgcolor='#0099FF'><b>Work Phone:</b></td>" .
"<td width='25%' bgcolor='#0099FF'><b>Cell Phone:</b></td><td width='25%' bgcolor='#0099FF'><b>Fax Phone:</b></td></tr><tr><td width='25%'>$row[phone] </td>" .
"<td width='25%'>$row[phone]</td><td width='25%'>$row[mobile]</td><td width='25%'>$row[pager]</td></tr></table></left></div>");
print ("<div align='left'><left><table border='1' cellpadding='0' cellspacing='0' width='80%'><tr><td width='50%' bgcolor='#0099FF'><b>Affiliation:</B> </td><td width='50%' bgcolor='#0099FF'><b>Database ID:</b></td>" .
"<tr><td width='50%'>$row[department] </td>" .
"<td width='50%'>$row[id]</td></tr></table></left></div>");
print ("<div align='left'><left><table border='1' cellpadding='0' cellspacing='0' width='80%'><tr><td width='50%' bgcolor='#0099FF'><b>Address:</B> </td><td width='50%' bgcolor='#0099FF'><b>Notes:</b></td>" .
"<tr><td width='50%'></td>" .
"<td width='50%'></td></tr></table></left></div>");
print ("<HR color=#8eb6d2 size=-3><ul><H3>$row[NameF] $row[lastname]</H3>");
print ("<B>Company: $row[office] <p>Title: $row[jobtitle]");

//print ("<p>Affiliation: $row[Affiliation] <p>E-Mail Address: <a href='mailto:$row[Email]'>$row[Email]</a>");
//print ("<p>Address:<br>$addy");
// print ("<P>Notes:<br> $notes");
// print ("<P>Home Phone: $row[Home] <br> Work Phone: $row[Work] ");
// print ("<br>Cell Phone: $row[Cell] <br> Fax No: $row[Fax]<P>");
// print ("Database ID Number: $row[ID]");
// print "</B></ul><HR color=#8eb6d2 size=-3>";
}
?>

Open in new window

Avatar of ziycon
ziycon
Flag of Ireland image

The reason is due to the way you have the link set, browsers interpret links slightly differently.

Try replacing the back slashes with forward slashes in your link or use the fully qualified url for the link.
Avatar of mcbSolutions
mcbSolutions

If you use local files (\\secretary\......) please add file:// in front of the url. Also use slashes.
Avatar of aideyd

ASKER

I've tried adding file and it helps but there is still a difference of 1 backslash between different browsers. Can someone advise further?

Thanks.

Aiden
Try something like: <a href="file://///secretary/EmployeePictures/1Aiden%20Donnelly%202.jpg">File</a>
Avatar of aideyd

ASKER

Tried this and its fine in ie but in firefox its coming up with the 5 backslashes. Its beyond me!
In FF you need to open about:config in the address bar, scroll down to security.checkloadurl and set it to false. For security reasons the ability to open local files has been disabled by default.
ASKER CERTIFIED SOLUTION
Avatar of ziycon
ziycon
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aideyd

ASKER

Ok Mate. Many thanks for your efforts.

Aiden