robsstevejobs
-
Posts
30 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by robsstevejobs
-
-
-
-
-
-
Hi guys, someone can help me for my database. I will only when registering the form that make the comparison to enter it, like username and email using ajax and php.
this is my code
<?phpif(isset($_POST['email'])){$servername = "localhost";$username = "root";$password = "Robss123";$dbname = "news";// Create connection$conn = new mysqli($servername, $username, $password, $dbname);$email = $_POST['email'];// Check connectionif ($conn->connect_error) {die("Connection failed: " . $conn->connect_error);}$name = mysqli_real_escape_string($conn, $_POST['name']);$email = mysqli_real_escape_string($conn, $_POST['email']);$sql = "INSERT INTO guyst(name,email)VALUES('$name', '$email')";$sql ="SELECT *FROM guyst WHERE guyst_email='$email'";$result = mysql_query($conn,$sql);if($result->num_row >0){echo 'cet email est déjà utilisée';}if ($conn->query($sql) === TRUE) {echo "New record created successfully";} else {echo "Error: " . $sql . "<br>" . $conn->error;}}$conn->close();function test_input($data){$data=trim($data);$data=stripslashese($data);$data=htmlspecialchars($data);return $data;}?> -
-
-
-
-
-
-
this is my query code
$(document).ready(function(){$('#submit').click(function(event){event.preventDefault();var name = $('#name').val();var email = $('#email').val();if(name == '' || email == ''){$('#error_message').html("Tous les champs sont obligatoire");}else{$('#error_message').html('');$.ajax({type:'POST',url:'connexion.php',data:{name:name, email:email},success:function(data){$("form").trigger("reset");$('#success_message').fadeIn().html(data);setTimeout(function(){$('#success_message').fadeOut("Slow");}, 2000);}});}});});,$(function(){$('#formu').validate({rules:{email:{required:true,email:true
}}
});
});</script>
-
-
-
-
-
-
-
Look my code
<form id="news" action="" method="POST">
<label for="name">Nom</label>
<input type="text" name="name" id="name" placeholder="votre nom" required>
<Br>
<br>
<label for="email">E-mail</label>
<input type="email" name="email" id="email" placeholder="votre mail" required>
<br>
<br>
<input type="submit" name="submit" id="submit" value="newsletters">
<span id="error_message" class="text-danger"></span>
<span id="success_message" class="text-success"></span>
</form>
This is Ajax code
$(document).ready(function(){
$('#submit').click(function(){
var name = $('#name').val();
var email = $('#email').val();
if(name == '' || email == '')
{
$('#error_message').html("All field are required");
}
else
{
$('#error_message').html('');
$.ajax({
url:"validate.php",
method:"POST",
data:{name:name, email:email},
success:function(data){
$("#news").trigger("reset");
$('#success_message').fadeIn().html(data);
setTimeout(function(){
$('#success_message').fadeOut("Slow");
}, 2000);
}
});
}
});
});
</script>
-
-
-
-
-
php pregmatch find string contain hashtag only
in PHP
Posted
Hello,
How I can filter the password with the function preg_mettre by specifying optional special charater but the first letter is mandatory uppercase is the rest or lowercase.