echo $_SERVER['PHP_SELF'];
Posted: Sat Feb 12, 2011 9:34 pm
Hi all,
CMS Made Simple 1.7 "Cape Verde"
Apache version 2.2.17
PHP version 5.2.15
I have a contact form on a page that is validating and sending an email ok. However on clicking submit the user is directed to the site route instead of to the contact page with the successful submission html displayed. I'm using echo $_SERVER['PHP_SELF']; Does anyone know why the page is redirectiong to the homepage? Many thanks.
CMS Made Simple 1.7 "Cape Verde"
Apache version 2.2.17
PHP version 5.2.15
I have a contact form on a page that is validating and sending an email ok. However on clicking submit the user is directed to the site route instead of to the contact page with the successful submission html displayed. I'm using echo $_SERVER['PHP_SELF']; Does anyone know why the page is redirectiong to the homepage? Many thanks.
Code: Select all
{php} if(isset($hasError)) { //If errors are found {/php}
<p class="error">Please check if you've filled all the fields with valid information. Thank you.</p>
{php} } {/php}
{php} if(isset($emailSent) && $emailSent == true) { //If email is sent {/php}
<p><strong>Email Successfully Sent!</strong></p>
<p>Thank you <strong>{php} echo $name;{/php}</strong> for using my contact form! Your email was successfully sent and I will be in touch with you soon.</p>
{php} } {/php}
<form method="post" action="{php} echo $_SERVER['PHP_SELF']; {/php} " id="contactform">
<div>
<label for="name"><strong>Name:</strong></label>
<input type="text" size="40" name="contactname" id="contactname" value="" class="required" />
</div>
<div>
<label for="email"><strong>Email:</strong></label>
<input type="text" size="40" name="email" id="email" value="" class="required email" />
</div>
<div>
<label for="subject"><strong>Subject:</strong></label>
<input type="text" size="40" name="subject" id="subject" value="" class="required" />
</div>
<div>
<label for="message"><strong>Message:</strong></label>
<textarea rows="5" cols="60" name="message" id="message" class="required"></textarea>
</div>
<input type="submit" value="Send Message" class="submit" name="submit" />
</form>