Mail Form receiving emails with no content
Posted on
16th Feb 2014 07:03 pm by
admin
Hi, I hope someone here can help me.
I have a simple form in my website, it was working OK, after lots of trouble finding out how to make this form I managed to make it work.
I had to create an .htaccess file in the server with some lines inside and that prevented the email to come up with blank fields (meaning only the names of the fields came up in the received email, but with no info inside).
The thing is that this .htaccess file is not anymore in the server............. (i think that one of my partners erased it but he wont admit it!!!!!!!hahah)
and I never backed up this file...my misteka.... Now, i can't find the forum where I got the info on what I should put inside this file, i've been searching on google for two hours now and tried everything I found but nothing seems to work!
Could you please tell me what I should put in this .htaccess file in order to stop receiving emails with no info in the fields???
thanks a lot!!!
here is my code:
<form id="form" name="form" method="post" action="/PHP/noticia01.php">
Nombre:
<input name="nombre" type="text" id="nombre" />
Email:
<input name="email" type="text" id="email" />
Comentarios:
<textarea name="comentarios" cols="30" rows="3" id="comentarios"></textarea>
<input name="submit" type="submit" id="submit" value="Enviar!" />
</form>
--------------------------------
THE PHP FILE IS THE FOLLOWING
<?php
if (isset($_POST['submit'])) {
// We get all the variables
foreach ($_POST as $key=>$value) {
if ( gettype( $value ) == "array" ) {
//print "$key ==
n";
} else {
$key = $value;
}
}
$message = "FORMULARIO DE CONTACTOn" .
"nNombre: " . $nombre .
"nMail: " . $email .
"nTelefono: " . $telefono .
"nComentarios: " . $comentarios;
$to = 'xxxxxxxxxx@gmail.com';
$subject = 'Nuevo comentario en noticia01';
$headers = "From: xxxxxxxxxx@gmail.comrn";
mail($to,$subject,$message,$headers);
header('Location: gracias.html');
} else {
echo 'No podes acceder a este archivo directamente.';
}
?>
No comments posted yet
Your Answer:
Login to answer
116
9
Other forums
puting for loop in 1 value
hi ,
how do i put this code in 1 value:
Code: <?php
for ($i=1; $i<=5; $i
How to display random record from table?
I have the following code:
Code: <?php
$display_block .= "<input type=
big pagination problem in php
<?php
$connect = mysql_connect("localhost", "root", "")
Why doesn't this work? (SSH2)
This is my script:
Code: <?php
$connection = ssh2_connect('213.251.167.109', 22);
Display search result
Hi!
I have a SQL database with information about albums and track (music).
This is wh
Multiple Do / While Statements?
I'm still very new to PHP, and running in to a problem when trying to execute a do/while loop inside
Do not allow posting of whitespace
Currently the script below works if the user does not type a name/message, but if i create a whitesp
Beginner PHP code help
Hi I'm new to php but if someone could please read the question below and help it would be great.
getting a website's source code as a variable? How?
Hey guys, is there any way for me to get the source code of a website as a variable for me to work w
convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javasc