/    Sign up×
Community /Pin to ProfileBookmark

Intrigate Java script with PHP

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. 😮

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogApr 14.2005 — For example:
[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]
×

Success!

Help @unixbhaskar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...