Jump to content

A HREF link in dynamic table


marti314

Recommended Posts

I am building a table in a php function and am trying to create a dynamic href in one of the fields.   I want a user to be able to click on the reference link to have it open up windows explorer for that directory. (I know this only works in IE and not chrome or firefox)

 

$pathdir="file://///server/dir/dir1/dir2/".$cname;
 
$htmltable .=   "<td> <a href=$pathdir>    <div style="height:100%;width:100%">      Artifacts    </div>  </a>   </td>" ;
 
 
I keep getting this error: 
 
unexpected T_STRING on this line: $htmltable .=   "<td> <a href=$pathdir>    <div style="height:100%;width:100%">      Artifacts    </div>  </a>   </td>" ;
 
 
Link to comment
Share on other sites

You'll have to escape the double quotes in your div style as such:

 

 

<div style=\"height: 100%; width:100%\">

 

You're using the same quotes to open the string in PHP so essentially you're telling it to close after = and reopen before the > but since the semi-colon ends a line of php coding, the width partis actually a new php command.

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.