How do I transform my search form so that on enter it simply redirects users to what they wrote?
Date : March 29 2020, 07:55 AM
hope this fix your issue I want to transform the searchform so that when an user clicks enter it simply redirects him to http://chusmix.com/text , Use JavaScript.<form action="http://chusmix.com/" onsubmit="window.location = action + s.value; return false;">
<input name="s">
<input type="submit">
</form>
|
What can I do to keep default text from being submitted in a web form if a user does not enter information?
Date : March 29 2020, 07:55 AM
Hope this helps I have a form that asks for First/Last name, email and phone. I don't want to use "placeholder" since IE lacks that ability. I have tried many things but do not know enough about script coding on how I can strip the default text out of the field when someone submits their information. , Here's how I do it on a simple text input. HTML: <form id="myemailform">
<input class="text email" type="text" name="email" value="Enter e-mail address"/>
<input type="submit" value="Submit">
</form
<script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input.text').each(function() {
$.data(this, 'default', this.value);
}).focus(function() {
if (!$.data(this, 'edited')) {
this.value = "";
}
}).change(function() {
$.data(this, 'edited', this.value != "");
}).blur(function() {
if (!$.data(this, 'edited')) {
this.value = $.data(this, 'default');
}
});
$('#myemailform').submit(function() {
if($(".email").val() == "Enter e-mail address") {$(".email").val("");}
return true;
});
});
</script>
|
Using prepare statement in php form and not logging in when enter information
Tag : php , By : Vijayant Singh
Date : March 29 2020, 07:55 AM
should help you out Taken directly from the PHP website as an example of the sort of data you would be passing in to the function. password_verify <?php
// See the password_hash() example to see where this came from.
$hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq';
if (password_verify('rasmuslerdorf', $hash)) {
echo 'Password is valid!';
} else {
echo 'Invalid password.';
}
?>
<?php
/**
* We just want to hash our password using the current DEFAULT algorithm.
* This is presently BCRYPT, and will produce a 60 character result.
*
* Beware that DEFAULT may change over time, so you would want to prepare
* By allowing your storage to expand past 60 characters (255 would be good)
*/
echo password_hash("rasmuslerdorf", PASSWORD_DEFAULT)."\n";
?>
The above example will output something similar to:
$2y$10$.vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a
if( isset(
$_POST['submitlogin'],
$_POST['usernamelogin'],
$_POST['passwordlogin']
) && !empty( $_POST['usernamelogin'] ) && !empty( $_POST['passwordlogin'] ) ){
$inUsername=$_POST["usernamelogin"];
$inPassword=$_POST["passwordlogin"];
/* select two fields but only use username in where clause */
$stmt = $con->prepare("select `username`, `password` from `users` where `username` = ?");
if( $stmt ){
$stmt->bind_param('s', $inUsername );
$stmt->execute();
/* bind the results */
$stmt->bind_result( $username, $hashed_password );
$stmt->fetch();
$stmt->free_result();
$stmt->close();
/* use the given password and the returned hashed password - see if they match */
if( password_verify( $inPasswordDB, $hashed_password ) ){
$_SESSION['username']=$inUsername;
header( "location: UserProfile.php" );
} else {
echo "<h1>Incorrect username or password</h1>";
}
} else {
echo "statement failed";
}
}
|
How to enter django form information into the DB
Date : March 29 2020, 07:55 AM
|
I need to re-enter my ruby on rails sqlite console so I can do sqlite commands?
Date : March 29 2020, 07:55 AM
|