scarface83 Posted March 26, 2007 Share Posted March 26, 2007 Hi, at the moment this code is executed imediatly , <?php $query = mysql_query("SELECT tbl_colour.colour, absence_mgt.notes, absence_mgt.ID FROM tbl_colour,absence_mgt WHERE absence_mgt.datestamp='$date' ") or die(mysql_error()); $row = mysql_fetch_array( $query ); $any_entry = $row["colour"]; if($any_entry =="" OR $anye_ntry == "0") { require ('select_absence.php'); unset($date); } else { echo $row['ID'], " " ,$row['notes']; } mysql_close(); ?> how would i get it to run only if the link had been click , nb the link referes to the same file here is the rest of the code <?php function gen_day_url($data,$day) { return "<a href=\"new_cal.php3?date=$data\">$day </a>"; } require ('db_connect.inc'); $query = mysql_query("SELECT tbl_colour.colour, absence_mgt.notes, absence_mgt.ID FROM tbl_colour,absence_mgt WHERE absence_mgt.datestamp='$date' ") or die(mysql_error()); $row = mysql_fetch_array( $query ); $any_entry = $row["colour"]; if($any_entry =="" OR $anye_ntry == "0") { require ('select_absence.php'); unset($date); } else { echo $row['ID'], " " ,$row['notes']; } mysql_close(); ?> Link to comment https://forums.phpfreaks.com/topic/44337-a-little-help-please/ Share on other sites More sharing options...
trq Posted March 26, 2007 Share Posted March 26, 2007 Wrap it in an if(). Eg; <?php if (isset($_GET['date'])) { // execute code. } ?> Link to comment https://forums.phpfreaks.com/topic/44337-a-little-help-please/#findComment-215319 Share on other sites More sharing options...
WRXHokie Posted March 26, 2007 Share Posted March 26, 2007 Try adding something in your link in the onmouseclick field. Like a call to this particular php function. Link to comment https://forums.phpfreaks.com/topic/44337-a-little-help-please/#findComment-215321 Share on other sites More sharing options...
trq Posted March 26, 2007 Share Posted March 26, 2007 Like a call to this particular php function.[/url] PHP runs server side and is therefore oblivious to calls from Javascript (Client side). Link to comment https://forums.phpfreaks.com/topic/44337-a-little-help-please/#findComment-215324 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.