in my form tag i have two buttons named SIGNIN and SIGNUP and form should be submit if SIGNIN button press. and if SIGNUP button press it should redirect to url given in anchor tag below but it always submitting the form. please help me.
<form action="controllers/user/vauth.php" method="post" role="form" class="userLogin" style="padding:20px;">
<div class='alert alert-danger' id='errorLabel' style="display:none;"></div>
<?php
if(isset($_SESSION['error'])) {
echo "<div class='alert alert-danger' id='errorLabel'>";
foreach($_SESSION['error'] as $error) echo "<p><b>".$error."</b></p>";
echo "</div>";
unset($_SESSION['error']);
}
if(isset($_SESSION['message'])) {
echo "<div class='alert alert-success'>".$_SESSION['message']."</div>";
unset($_SESSION['message']);
}
?>
<div class="form-group">
<label for="email">Email</label>
<input type="text" name="vemail" id="vemail" class="form-control" placeholder="Enter Email" value="<?php if(isset($_SESSION['values'])) echo $_SESSION['values']['email']; ?>">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" name="vpassword" id="vpassword" class="form-control" placeholder="Enter Password">
</div>
<div class="form-group">
Forgot Password ?
</div>
<button type="submit" class="btn btn-default" name="vsubmit">LOG IN</button><button class="btn btn-success" name="signup" style="float:right;">SIGN UP</button>
</form>
Add type="button" to your signup button
Related
I have the following form:
<form action="../util/vcput.php" method="POST">
<input name="vockey" type="hidden" value="<?php echo getCsrfToken(); ?>">
<input name="a" value="addorgadmin" type="hidden">
<input name="m" value="editorg" type="hidden">
<input name="q1" value="orgid=<?php echo $org->id; ?>&orgadmins=1" type="hidden">
<input type="hidden" name="orgid" value="<?php echo $org->id; ?>">
<div class="container-fluid mt-3">
<div class="row">
<div class="col-5">
<input class="form-control" type="text" placeholder="Email" id="userEmail" name="userEmail" aria-label="New Admin Email"></input>
</div>
<div class="col-4">
<input class="form-control" type="text" placeholder="Name" id="userName" name="userName" aria-label="New Admin Name"></input>
</div>
<div class="col-3">
<!-- <button type="submit" class="btn btn-primary">Add admin</button> -->
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">Add admin</button>
</form>
However, when clicking the submit button nothing happens, no data is submitted/no action is taken. I know that the name/id values are correct, as the lines are copied over from an older version of the page (modified to bootstrap v5).
Am I doing something wrong here? The form is in in a modal-body and doesn't work, but works when outside.
EDIT: Figured it out... I had a form tag enclosing the entire page that I had forgotten about, so having this form nested was breaking functionality. Oops.
Figured it out... I had a form tag enclosing the entire page that I had forgotten about, so having this form nested was breaking functionality. Oops.
Im use form html my probleme after click submit send nothing in my brother
<form method="get" id="booking-form" role="form" action="">
<div class="col-md-3 col-sm-6">
<i class="fa fa-map-marker rechercheIndex"></i>
<label class="sr-only" >Recherche</label>
<input type="text" class="form-control" placeholder="Ville">
</div>
<div class="col-md-2 col-sm-4">
<input type="submit" class="btn btn-primary btn-block" >
</div>
</form>
After click button send nothing
Im expetected return value in my form
I found solution. Just add name in my input name="city"
<label for="city">Enter city: </label>
<input type="text" class="form-control" placeholder="Ville" name="ville">
set Action Attribute to specific Action Page
you should must PHP or other server side language to interact with forms
Index.php
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
Welcome.php
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
In first line ,we need to give path were form get collect
Ex :-
In this the form get collect in "/action_page.php"
The problem is that when i click on the button nothing happens at all which it should be at least to me.
I don't need a direct answer. Just a hint, or a pointer of what can be going on.
Here is part of the code for the modal form
<div class="modal-body">
<form Method="POST" id="Signin-Form" role="form">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></div>
<input name="txt_uname" id="txt" type="text" class="form-control input-lg" placeholder="Enter User Name" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span></div>
<input name="txt_umail" id="email" type="text" class="form-control input-lg" placeholder="Enter Email" required data-parsley-type="email" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></div>
<input name="txt_upass" id="pass1" type="password" class="form-control input-lg" placeholder="Enter Password" required data-parsley-length="[6, 10]" data-parsley-trigger="keyup" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></div>
<input name="txt_upass2" id="pass2" type="password" class="form-control input-lg" placeholder="Confirm Password" required data-parsley-length="[6, 10]" data-parsley-trigger="keyup" />
</div>
</div>
<button type="submit" class="btn btn-success btn-block btn-lg"><i class="glyphicon glyphicon-open-file">CREATE ACCOUNT!</i></button>
</form>
You need to add action attribute to the form to be able to send the form-data when the form is submitted.
Sample code below
<form action="submittedpage.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
After you click submit button, the form data is sent for processing to a PHP file named "submittedpage.php". The form data is sent with the HTTP POST method.
To display the submitted data you could simply echo all the variables. The "submittedpage.php" see the code below:
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
You can see this link for more info in form handling.
https://www.w3schools.com/php/php_forms.asp
Hope this helps.
I have an iOS application which views URL inside UIWebView. There is a form in this URL with two text input fields and one checkbox.
When the cursor is inside one of the text input fields and the keyboard is shown, then I check the checkbox, the screen becomes semi-black and the form dialog is removed. But when I check the checkbox normally - without the keyboard showing -, it works fine and no error happens.
Here is the form code:
<form action="<?php echo site_url('account/login');?>" class="form-horizontal" role="form" method="post">
<!-- Form Group -->
<div class="form-group">
<!-- Label -->
<label for="user" class="col-sm-3 control-label"><?php echo lang_key('email'); ?></label>
<div class="col-sm-9">
<!-- Input -->
<input type="text" class="form-control" name="useremail" placeholder="<?php echo lang_key('email'); ?>">
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-3 control-label"><?php echo lang_key('password'); ?></label>
<div class="col-sm-9">
<input type="password" class="form-control" name="password" placeholder="<?php echo lang_key('password'); ?>">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<input type="checkbox" name="remember"> <?php echo lang_key('remember_me'); ?>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<!-- Button -->
<button type="submit" class="btn btn-red"><?php echo lang_key('login'); ?></button>
<button type="submit" formaction="<?php echo site_url('account/signup');?>" class="btn btn-white"><?php echo lang_key('sign_up'); ?></button>
</div>
</div>
</form>
The 'remember_me' checkbox is the one which causes the issue if the keyboard is shown when it is checked
Keyboard delegates are what you are looking for.
Use the keyboard Will Show delegate to push the UIWebview up, and Use the keyboard will hide delegate to return push the UIWebview down.
Hope this helps!
I was wondering if it is possible to pass the control to bootstrap Modal Input so that i dont have to use mouse click to focus on that.Usually i have to click on the inputas soon as modal popsup. Here is a Simple code.
<div class="modal fade" id="myModal1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Password authentication</h4>
</div>
<?php $attributes = array('class' => 'check_user_password', 'id' => 'check_user_password'); ?>
<?php echo form_open('PswAuthentication', $attributes); ?>
<div class="modal-body">
<div class="form-group">
<label>Enter password:</label>
<input type="password" class="form-control" name="user_password" placeholder="Enter password">
</div>
<div class="col-xs-1" id="courseInfo" style="display:none;">
<input type="hidden" name="crs_id" id="courseId" value="<?php echo set_value('crs_id'); ?>">
<input type="hidden" name="crs_code" id="courseCode" value="<?php echo set_value('crs_code'); ?>">
</div>
<input type="hidden" name="event" id="crs_event" value="<?php echo set_value('event'); ?>">
<div class="form-group">
<button type="submit" class="btn btn-default btn-success check_user_password_btn">Submit</button>
</div>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
And here is the UI
I got the Answer guys. Sorry for asking this simple Question. I just had to put Autofocus in input field.
<input type="password" class="form-control" name="user_password" placeholder="Enter password" autofocus>
Due to how HTML5 defines its semantics, the autofocus HTML attribute has no effect in Bootstrap modals. To achieve the same effect, use some custom JavaScript:
$('#myModal').on('shown.bs.modal', function () {
$('#myInput').focus()
})
Read more
example code here codepen