Forum Moderators: coopster
There is way too much code to post it all, but here is what im trying to do:
function js_function()
{
<?php
// I'm trying to echo an alert to see that my values are correct, I need to use this number later on in the script.
$number = $_POST['top_number'];
echo 'alert("' . $number . '");';
// This part is working and showing as it should with alert
$testing = 400;
echo 'alert ("' . $testing . '");';
?>
}
html…
<form name="myForm" method="post" onSubmit="js_function()">
<input type="image" src="mypic.jpg" width="45" height="45" value="submit">
<input name="top_number" type="text">
</form>
The $number value is returning nothing, when I alert it I dont get any number at all. Even the input text part contains a value. I've tried using both:
POST[ 'text' ] and POST[ "text" ] seems to do no difference at all. I'm not sure if the collection actually provides me with the correct info, or if I'm just trying to collect it from post incorrectly.
Regards, Markus
function js_function()
{
alert("");
alert ("400");
}
If you're trying to validate the user data before submitting it to the server, you'll need to use purely Javascript code to do that. Search the net for "javascript form validation" for lots of good examples.