forked from smanek/aurora-pharmacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.php
More file actions
39 lines (36 loc) · 2.49 KB
/
form.php
File metadata and controls
39 lines (36 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
// need to (slightly) validate the email and phone number.
?>
<h2>Send a message to the pharmacist</h2>
<form role="form" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
<div class="form-group">
<input type="text" name="username" placeholder="username" hidden="true">
<?php //fake username input to help catch bots (rather than using captcha)
?>
</div>
<div class="form-group">
<label for="name">Name</label>
<?php echo ($blnAttempted && !inputExists($_POST['name']) ? '<div class="alert alert-danger">Name is required</div>' : "");?>
<input type="text" class="form-control" name="name" placeholder="Your name" value="<?php echo ($blnAttempted && inputExists($_POST['name']) ? cleanInput($_POST['name']) : ""); ?>">
</div>
<div class="form-group">
<label for="email">Email address</label>
<?php echo ($blnAttempted && !validateEmail($_POST['email']) && !checkPhoneNumber($_POST['phone']) ? '<div class="alert alert-warning">Either a valid email or phone number is required</div>' : ""); ?>
<input type="email" class="form-control" name="email" placeholder="Your email address" value="<?php echo ($blnAttempted && inputExists($_POST['email']) ? cleanInput($_POST['email']) : ""); ?>">
</div>
<div class="form-group">
<label for="phone number">Phone</label>
<?php echo ($blnAttempted && !validateEmail($_POST['email']) && !checkPhoneNumber($_POST['phone']) ? '<div class="alert alert-warning">Either a valid email or phone number is required</div>' : ""); ?>
<input type="tel" class="form-control" name="phone" placeholder="Your phone number" value="<?php echo ($blnAttempted && inputExists($_POST['phone']) ? cleanInput($_POST['phone']) : ""); ?>">
</div>
<div class="form-group">
<label for="message">Message?</label>
<?php echo ($blnAttempted && !inputExists($_POST['message']) ? '<div class="alert alert-danger">A message is required</div>' : "");?>
<textarea class="form-control" rows="5" name="message" placeholder="Type your question here"><?php echo ($blnAttempted && inputExists($_POST['message']) ? cleanInput($_POST['message']) : "")?></textarea>
</div>
<p class="help-block">
Messages sent via this form are not encrypted.<br />
Please call or stop by if you need to discuss any confidential or medically sensitive information with the pharmacist.
</p>
<button type="submit" class="btn btn-default">Submit</button>
</form>