I didn't want to have to ask a new question so I looked around everywhere, but I can't seem to find a solution to my question. So basically, I want to find an alternative way to prompt a user with a message box on a certain condition. Currently, I have a working form written in a PHP file and it forces the user to enter a valid email address. If they fail to do so, an alert box comes up telling them to do so. This is all fine and works well, but I wanted to get a nicer looking, styled alert box. I read about using Jquery but even using that, I haven't been able to do it. I think I may have done something wrong, mind you. But still, here's the current code I have:
if ($mailcheck==FALSE)
{
echo '<script type="text/javascript">alert("Please enter a valid email address!");
window.location.href="../index";
</script>';
}
else
{
$from = $_POST["from"]; // sender
$subject = $_POST["subject"];
$message = $_POST["message"];
Where I have the Javascript Alert box, how can I replace it with a custom box? Sorry if my question seems a little poorly worded.
Probably the most comfortable way is to use jQuery UI . But you can also make your own one with HTML/CSS and some JavaScript.
EDIT : Here is an example of using jQueryUI dialog box:
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#dialog" ).dialog();
});
</script>
</head>
<body>
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
</body>
</html>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.