View Single Post
Old 01-03-2013, 04:00 PM   PM User | #1
tifone7
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
tifone7 is an unknown quantity at this point
Problem with contacts form

Hi guys.
First of all it's been a long time since i follw you and your community.How many helps i f've found through these pages!!
So thank for any help you will able to give me in the future.I'm a newbie.Sorry for my english, i'm writing from Italy..
My problem is..I'm making a new site, full js based. In the contact form submit and clear buttons don't work. I'm pretty sure html code and php work, because they work well in onother site i made (html and css).
I think the problem is the instruction onClick="document.getElementById that doesn't work with js site..can you help me?

HTML code
Code:
<div class="wrapper contPad">
      <h2>Contattami</h2>
      <form id="form1" action="mail.php" method="post">
          <div>
    	   <fieldset>
			<label>NOME</label> 
									
    			<input name="field_name" input type="text" class="input" value="Almeno 3 caratteri" > 

    			<br>
										
			<label>E-MAIL:</label> 
										
                        <input name="field_email" input type="text" class="input" value="Indirizzo valido di posta elettronica"/>
    										
    			<br>
										
			<label>MESSAGGIO:</label>
										
    			<textarea name="field_message" cols="40" rows="7"></textarea>
    										
    			<br><br>
    								
                        <div class="btns right"> <a href="#" class="button" onClick="document.getElementById('ContactForm').reset()">clear</a>
							 <a href="#" class="button" onClick="document.getElementById('ContactForm').submit()">Send</a></div>
    	  </fieldset>
        </div>
    </form>
                          
</div>
PHP code
PHP Code:
<?php
$field_name 
$_POST['field_name'];
$field_email $_POST['field_email'];
$field_message $_POST['field_message'];
     
$mail_to 'deep_purple@tin.it';
$subject 'Richiesta di informazioni da parte di '.$field_name;
     
$body_message 'Nominativo: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Messaggio: '.$field_message."\n";


$headers 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
     
$mail_status mail($mail_to$subject$body_message$headers);
     
if (
$mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Grazie per la richiesta inoltrata. Sarete contattati quanto prima.');
window.location = 'contatti.html';
</script>
<?php
}
else { 
?>
<script language="javascript" type="text/javascript">
alert('Recapito fallito.Per favore riprovare ad eseguire la richiesta pił tardi');
window.location = 'contatti.html';
</script>
<?php
}
?>

Last edited by tifone7; 01-03-2013 at 04:04 PM..
tifone7 is offline   Reply With Quote