NorthGeorgiaWeather Posted May 27, 2023 Share Posted May 27, 2023 I have this code that I want to add a hyperlink to. The code works as is (this is obviously only part of it). The code is looking at the time stamp of the file and doing some calculations. I want to add the hyperlink to the code in red so the user can click on the linmk and open the file. The link in green is the path and file that would be in the hyperlink. if(file_exists('\emwin\adm\cwfmob.txt')) { do_check("NWS Mobile - CWFMOB",'\emwin\adm\cwfmob.txt',60*60*60,'\emwin\adm\cwfmob.txt'); Quote Link to comment https://forums.phpfreaks.com/topic/316348-help-with-syntax/ Share on other sites More sharing options...
Barand Posted May 27, 2023 Share Posted May 27, 2023 https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a Quote Link to comment https://forums.phpfreaks.com/topic/316348-help-with-syntax/#findComment-1608690 Share on other sites More sharing options...
NorthGeorgiaWeather Posted May 28, 2023 Author Share Posted May 28, 2023 21 hours ago, Barand said: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a Sorry, not much help. I know how to do hyperlinks, but in this case, not within this particular piece of PHP code. I'm looking for what quotes or other delimiters to stick the hyperlink "inside" of. Quote Link to comment https://forums.phpfreaks.com/topic/316348-help-with-syntax/#findComment-1608704 Share on other sites More sharing options...
NorthGeorgiaWeather Posted May 28, 2023 Author Share Posted May 28, 2023 Here's some code with and without the hyperlink. My confusion is where to use quotes and where to use ticks if(file_exists('\emwin\adm\cwfmob.txt')) { do_check('<a href="\emwin\adm\cwfmob.txt' title="Coastal Water Forecast" target="_self">CWFMOB</a>','\emwin\adm\cwfmob.txt',60*60*60,'\emwin\adm\cwfmob.txt'); This code works assuming I enter the correct file paths if(file_exists('TRACReport.txt')) { do_check("Nexstorm TRACreport",'TRACReport.txt',10*60+15,'file'); Quote Link to comment https://forums.phpfreaks.com/topic/316348-help-with-syntax/#findComment-1608705 Share on other sites More sharing options...
Solution Barand Posted May 28, 2023 Solution Share Posted May 28, 2023 Ticks are only used in SQL queries around identifiers. When using quotes (single or double) they should be in matching opening and closing pairs. do_check('<a href="\emwin\adm\cwfmob.txt' title="Coastal Water Forecast" target="_self">CWFMOB</a>','\emwin\adm\cwfmob.txt',60*60*60,'\emwin ...'); ^..............................^ ^......................^ ^.....^ ^.^ ^..........^ As you can see, you href does not have matching opening and closing quotes, throwinng other pairs out of synch. try do_check('<a href="\emwin\adm\cwfmob.txt" title="Coastal Water Forecast" target="_self">CWFMOB</a>','\emwin\adm\cwfmob.txt',60*60*60,'\emwin ...'); ^.....................^ ^......................^ ^.....^ ^........................................................................................^ ^.....................^ ^..........^ See https://www.php.net/manual/en/language.types.string.php Quote Link to comment https://forums.phpfreaks.com/topic/316348-help-with-syntax/#findComment-1608706 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.