newbie_07 Posted May 17, 2008 Share Posted May 17, 2008 I have CSS Tabs. I want to display php code in innerHTML. my code is: if (tab=="admin"){ main.innerHTML="<center><strong>Admin Details</strong></center> <?php $sql = "select * from payments where client_id = $_POST[c_id]"; print $sql; $res = mysql_query($sql); $row = mysql_fetch_assoc($res); $b_name = $row['bank_name']; echo "$b_name"; ?> "; } The php code isn't dispalying. Plz Help Link to comment https://forums.phpfreaks.com/topic/106040-displaying-php-in-innerhtml/ Share on other sites More sharing options...
Barand Posted May 17, 2008 Share Posted May 17, 2008 PHP runs on the server and sends the output to the client. Javascript runs on the client after the page has been sent. If you want to call PHP from the client wou will need AJAX, sending an xmlhttp request to the server and then assigning the output returned by the request to main.innerHTML. Link to comment https://forums.phpfreaks.com/topic/106040-displaying-php-in-innerhtml/#findComment-543457 Share on other sites More sharing options...
newbie_07 Posted May 17, 2008 Author Share Posted May 17, 2008 O i see......thanks alot. Link to comment https://forums.phpfreaks.com/topic/106040-displaying-php-in-innerhtml/#findComment-543459 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.