AndieB Posted January 22, 2009 Share Posted January 22, 2009 Hi all, I've created the following PHP script: <?php $bgcolor = "#aabbcc"; while ($sqlRows = mysql_fetch_assoc($sqlResult)) { $bgcolor = ($bgcolor == "#aabbcc")?"#ffffff":"#aabbcc"; echo "<tr style=\"background-color: " . $bgcolor . "\" onMouseOver=\"style.backgroundColor='#D87093'\" onMouseOut=\"style.backgroundColor='" . $bgcolor . "'\" onClick=\"document.open('event_info.php?e=" . $sqlRows["e_id"] . "', '')\" >\n"; echo "<td id=\"listLeft\" ><a href=\"event_info.php?e=" . $sqlRows["e_id"] . "\" target=\"_self\" >" . $sqlRows["e_date"] . "</a ></td >"; echo "<td id=\"listMiddle\" ><a href=\"event_info.php?e=" . $sqlRows["e_id"] . "\" target=\"_self\" >" . $sqlRows["e_city"] . "</a ></td >"; echo "<td id=\"listRight\" ><a href=\"event_info.php?e=" . $sqlRows["e_id"] . "\" target=\"_self\" >" . $sqlRows["e_country"] . "</a></td >\n"; echo "</tr >\n"; } ?> My problem is that when I click the row it does only open a BLANK page. I want it to open the event_info.php file and send the value with it so the PHP script can run through the database and fetch the data in order to present it. But again, my result above only creates a BLANK white page. What am I doing wrong? Thankful for any kind of help! Sincerely, Andreas Quote Link to comment Share on other sites More sharing options...
webster08 Posted January 22, 2009 Share Posted January 22, 2009 use window.open(); not document.open() Quote Link to comment Share on other sites More sharing options...
AndieB Posted January 23, 2009 Author Share Posted January 23, 2009 use window.open(); not document.open() Thank you for your answer. But window.open() opens up a brand new window. I want the page to be opened in the same window, just like if I was using a <A HREF...> TAG, but it should act when clicking on the ROW in the TABLE. Sincerely, Andreas Quote Link to comment Share on other sites More sharing options...
webster08 Posted January 23, 2009 Share Posted January 23, 2009 do this then (use document.location.href): <?php $bgcolor = "#aabbcc"; while ($sqlRows = mysql_fetch_assoc($sqlResult)) { $bgcolor = ($bgcolor == "#aabbcc")?"#ffffff":"#aabbcc"; echo "<tr style=\"background-color: " . $bgcolor . "\" onMouseOver=\"style.backgroundColor='#D87093'\" onMouseOut=\"style.backgroundColor='" . $bgcolor . "'\" onClick=\"document.location.href='event_info.php?e=" . $sqlRows["e_id"] . "'\" >\n"; echo "<td id=\"listLeft\" ><a href=\"event_info.php?e=" . $sqlRows["e_id"] . "\" target=\"_self\" >" . $sqlRows["e_date"] . "</a ></td >"; echo "<td id=\"listMiddle\" ><a href=\"event_info.php?e=" . $sqlRows["e_id"] . "\" target=\"_self\" >" . $sqlRows["e_city"] . "</a ></td >"; echo "<td id=\"listRight\" ><a href=\"event_info.php?e=" . $sqlRows["e_id"] . "\" target=\"_self\" >" . $sqlRows["e_country"] . "</a></td >\n"; echo "</tr >\n"; } ?> Quote Link to comment Share on other sites More sharing options...
AndieB Posted January 23, 2009 Author Share Posted January 23, 2009 That was the solution!! Thank you very much webster08! Sincerely, Andreas 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.