
Originally Posted by
dog
Can anyone suggest another way of using the PHP to check the required fields have content without leaving the page?
You could utilize javascript to check the required fields. I think there are some on this website, as well as http://dhtmlgoodies.com. If you still wanted to use the PHP to check it, and have the info saved, you could utilize setcookie(); to save the entered items in the form and when it comes back to the form.php page, the values are already in the fields.
The second issue is more urgent but also more simple. When the form is filled out correctly, gets sent and the user arrives on form.php?send=yes and sees and echo telling the it's all good I'd also like to trigger some javascript. Can anyone suggest a trigger?
What kind of javascript are you trying to trigger? You could do the following in form.php:
Code:
if ($send == "yes") {
?>
<html>
<head>
<title>Message Sent</title>
<script language="Javascript">
/*Add JS here*/
</script>
</head>
<?
}
elseif ($send == "no") {
?>
<html>
<head>
<title>Message Not Sent</title>
<script language="Javascript">
/*Add JS here*/
</script>
</head>
<?php
}
else {
?>
<html>
<head>
<title>Send A Message</title>
</head>
<?php
}
?>
Hope this helps out
Bookmarks