vendredi 27 mars 2015

PHP query not working using form

This is my query for inserting:



<?php
require_once "config.php";
if(isset($_POST['submit'])){

$email = mysql_escape_string($_POST['txtemail']);

$str = "insert into subscribe(email,datetime) values ('$email',current_timestamp)";
$result = mysql_query($str);

print '<script type="text/javascript">';
print 'alert("Thank you for subscribing with us. We will be in touch with you very soon.")';
print '</script>';


}


this is code above is perfectly working, but when i put a value on the form action to redirect to another page like this, the query is not inserting.



<form action="/?sender=nopopup" method="POST">


I tried using header(location: 'url'), but its not working also. Any help will be appreciated, thank you.


Aucun commentaire:

Enregistrer un commentaire