solarparadox Posted August 14, 2009 Share Posted August 14, 2009 Hi. First time posting here. I'm relatively new to PHP, but I have a contact form that links to a PHP mail script for processing, and every time I submit the form, it launches a second webpage with the URL of the script, which gives a server error. I've spoken to the host and according to them there is no problem and he has no idea why that page is coming up. PHP Script <?php $email = $_REQUEST['mail']; $message = $_REQUEST['message']; $name = $_REQUEST['name']; $to = "admin@chicunique.ca"; $body = "From: " . $name . " " . "\n" . "Message: " . $message; $headers = "From: $email"; $subject = "Chic Unique Contact Form"; ini_set(smtp_port, 25) ; ini_set("smpt", "smtp-out.promailbox.net"); mail($to,$subject,$body,$headers); ?> HTML Form <form id="form" method="post" target=”_blank” action="scripts/mail.php" name="form" > <div class="inp_h"> <input class="inp_2" type="text" name="name" value="Name:" onfocus="this.value=''" /> </div> <div class="inp_h"> <input class="inp_2" type="text" name="mail" value="E-mail:" onfocus="this.value=''" /> </div> <div><textarea class="inp_3" rows="8" cols="40" name="message" onfocus="this.value=''">Message:</textarea></div> <div style="padding:12px 0 0 0;"> <a href="#" onclick="document.getElementById('form').reset()"><img src="images/clear.gif" style="border:0px none;" alt="" /></a><img src="images/spacer.gif" alt="" width="6" height="1" /><a href="#" onclick="document.getElementById('form').submit()"><img src="images/submit.gif" style="border:0px none;" alt="" /></a><br /> </div> </form> As you can see the PHP script is fairly simple, and I don't see any code that would launch a second window (I know some launch a thankyou page, etc). Any ideas on that would be greatful. The web address is www.chicunique.ca, which is a work in progress but fairly well along. Thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/170281-php-contact-form-mail-script-launching-new-page-after-sent/ Share on other sites More sharing options...
mikesta707 Posted August 14, 2009 Share Posted August 14, 2009 <form id="form" method="post" target=”_blank” action="scripts/mail.php" name="form" > setting the target attribute to blank will launch a new window Quote Link to comment https://forums.phpfreaks.com/topic/170281-php-contact-form-mail-script-launching-new-page-after-sent/#findComment-898237 Share on other sites More sharing options...
solarparadox Posted August 14, 2009 Author Share Posted August 14, 2009 I removed that portion of the code, but now rather than a separate page coming up, the current page goes to the script url "www.chicunique.ca/scripts/mail.php" <-what I see in the URL. And I still get a weird server error "500 - Internal Server Error" Quote Link to comment https://forums.phpfreaks.com/topic/170281-php-contact-form-mail-script-launching-new-page-after-sent/#findComment-898240 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.