ok, I have a form that submits data to a database. data that is colected from things like dropdown boxes, textboxes, checkboxes etc.
I want to put some conditions that prevent the user from submitting something that is missing important data.
I found a little tutorial that dose that, but it dosen't quite work because I neet to transfer a value from a thextbox to a function and make a check that it's not empty.
here's an example of what I would like to do ( the code obviously dose not work as is):
<HTML>
<HEAD>
<script language="JavaScript">
function ConfirmForm(N)
{
var cmp = N;
IF ( cmp != "" )
{
return confirm("are you sure you want to submit this?");
}
ELSE
{
return alert("You have not fild all of the necesary fields");
}
}
</script>
</HEAD>
<BODY>
ECHO "<FORM NAME=zzz METHOD=get ACTION=something.php TARGET='lll' OnSubmit='return ConfirmForm(N);'>";
ECHO "Name: <INPUT TYPE='text' NAME=N ID=N/>";
ECHO "<INPUT TYPE = submit NAME = button_submit VALUE = 'Submit'>";
</FORM>
</BODY>
</HTML>
I don't know how to pass value of the text box from php to the java script.
Normally I would imagine there would need to be a $GET[N] statement. but I don't know where to post it. don't think it works inside the script itself.
Can anybody tell me how to do this?