1>How can I intrigate java script with php? 2>How can I use java script and php in the same file doing different action? 3>How can I combine php ,javascript and html to build page?
Show me the code of all three. 😮
[code=php] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang='en'> <head> <title>PHP and JavaScript</title> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'> <style type="text/css"> <!-- body { margin: 0; padding: 1em; font: medium arial, sans-serif; } --> </style> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method=post> <p>Select a date: <select name=date> <?php $now = time(); for($ix=0; $ix<7; $ix++) { echo "<option>".date("l j F", $now + $ix * 24*60*60)."</option>n"; } ?> </select> </p> <p><input type=submit value="Submit"></p> </form> <?php if(isset($_POST['date'])) { echo <<<EOD <script language="JavaScript" type="text/javascript"> <!-- alert("You selected {$_POST['date']}."); //--> </script> EOD; } ?> </body> </html> [/code]
Help @unixbhaskar spread the word by sharing this article on Twitter...