Pb with php code returning blank page
Posted: Sun Sep 18, 2011 2:31 pm
Hi,
I have a short script that allows to enter newsletter registrations in the database , but it does not want to work .... not sure what could be wrong . The script does work on my local machine but not when put on the server .. any help would be appreciated.
Many thanks
This is my script :
I have a short script that allows to enter newsletter registrations in the database , but it does not want to work .... not sure what could be wrong . The script does work on my local machine but not when put on the server .. any help would be appreciated.
Many thanks
This is my script :
Code: Select all
<?php
include "config.php";
$nome=$_POST['nome'];
$email=$_POST['email'];
$telefone=$_POST['telefone'];
if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $str)) {
$msg = 'email is not valid';
}
else {
$valid = true;
}
$vr=mysql_query("select email from newsletter where email='$email'") or die(mysql_error());
if(mysql_num_rows($vr)>0){
echo"<script language='javascript'>
window.alert('E-mail já Cadastrado !');
window.history.go(-1);
</script>";
break;}
$cad=mysql_query("insert into newsletter (id, nome, email, telefone, id_grupo, id_hostel) values('', '$nome', '$email', '$telefone', '1', '') ") or die(mysql_error());
mysql_close();
echo"<script language='javascript'>
window.alert('Cadastro realizado com sucesso!');
window.location=('index.html');
</script>";
?>