I tried to find a functin that equles to promt function on javascript
and i cant find one so im tring my luck over here...
ther is function that equle to "prompt" on javascript?
Well, since PHP is run on the server while JavaScript is run the client (the browser) - at least if we assume we're discussing a typical web application here - then there is no real corollary to JavaScript's prompt() function.
You could do something similar perhaps with an AJAX implementation. In fact, you could acutally use the JavaScript prompt() function as part of that implementation. But without knowing exactly what it is you want to do, I can't really say if that or something else would a better solution for you.
There is no php equivalent function in PHP for that. The only thing you could do is create a form, submit it to another script and display the results. There is nothing similar to the prompt function in javascript.
Thank you very much,
mm i have one more question,
i wonderd if somebody knows or if it possible to trasfare the data from the Prompt
to php var.
thx
you'd have to send the data either by a new URL sent by the JavaScript or by using AJAX.
bpat1434;10886851 wrote:you'd have to send the data either by a new URL sent by the JavaScript or by using AJAX.
thank you but i found better way..
to send the variabal to <input .....>
and then $_POST it...
some thing like that..
<html>
<head>
<script type="text/javascript">
function disp_prompt()
{
var name=("Please enter your name")
document.getElementById("i1").value = name;
}
</script>
</head>
<body>
<form action="testn.php" method="post">
<input id="i1" name="i1" value="">
<?php
if (isset($_POST['submit']))
{
$phpVar = $_POST["i1"];
echo 'this is php var'.$phpVar;
}
?>
<input type="submit" name="submit" value="שנה">
</form>
<input type="button" onclick="disp_prompt()"value="Display a prompt box" />
</body>
</html>