marti314 Posted March 17, 2017 Share Posted March 17, 2017 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>" ; Quote Link to comment Share on other sites More sharing options...
RMorrison Posted March 17, 2017 Share Posted March 17, 2017 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. Quote Link to comment Share on other sites More sharing options...
benanamen Posted March 17, 2017 Share Posted March 17, 2017 No need to escape, just use single quotes on the elements. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.