how to submit form data with multiple buttons - laravel-9

I want to send data to database table. but there are two submit buttons. 1.Accept 2.Reject. When you click the Accept button, the database will receive the input "value = accepted," and when you click the Reject button, the database will receive the input "value = rejected." The problem is that if you click on any button, "input value = accepted" is sent to the table.
This is my form.
#foreach($attendance as $request)
<form class="d-sm-inline-block" method="POST" action="/update" enctype="multipart/form-data">
#csrf
<tr>
<th scope="row">
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['id']}}</label>
<input type="hidden" value="{{$request['id']}}" name="id" class="form-control">
</div>
</th>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['name']}}</label>
<input type="hidden" value="{{$request['name']}}" name="name" class="form-control">
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['class']}}</label>
<input type="hidden" value="{{$request['class']}}" name="class" class="form-control">
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['roll_number']}}</label>
<input type="hidden" value="{{$request['roll_number']}}" name="rollnumber" class="form-control">
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['subject_name']}}</label>
<input type="hidden" value="{{$request['subject_name']}}" name="subject" class="form-control" >
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['attendance']}}</label>
<input type="hidden" value="{{$request['attendance']}}" name="attendance" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['status']}}</label>
<input type="hidden" value="{{$request['status']}}" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
</td>
<td>
<div class="mb-3">
<input type="hidden" value="Accepted" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
<input type="hidden" value="Rejected" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
<button type="submit" class="btn btn-success" action="action" value="accept">accept</button>
<button type="submit" class="btn btn-warning" action="action" value="reject">Reject</button>
</tr>
</form>
#endforeach

remove:
<div class="mb-3">
<input type="hidden" value="Accepted" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
<input type="hidden" value="Rejected" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
and change this:
<button type="submit" class="btn btn-success" action="action" value="accept">accept</button>
<button type="submit" class="btn btn-warning" action="action" value="reject">Reject</button>
to:
<button type="submit" name="status" class="btn btn-success" action="action" value="accept">accept</button>
<button type="submit" name="status" class="btn btn-warning" action="action" value="reject">Reject</button>
Your submit buttons have no name attribute so their values won't be there in the request.

Related

Control alignment input-group-btn

I am trying to put on same line firstname,lastname inputs and button.
The total width of the above 3, should be equal to the 'xxxxxxx' input.
you can find the code here
http://jsfiddle.net/zxb53wjq/1/
<div class="container">
<form role="form" action="" method="post">
<div class="row setup-content" id="step-2">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<div class="form-group">
<input maxlength="200" type="text" class="form-control" placeholder="xxxxxxxx"/>
</div>
<div class="form-group">
<label class="control-label">Application:</label>
<div class="input-group">
<input style="width:50% " class="form-control " placeholder="first name" name="firstname" type="text" />
<input style="width:50% " class="form-control " placeholder="last name" name="lastname" type="text" />
</div>
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="addApplicationBtn" name="addApplicationBtn">Add</button>
</span>
</div>
</div>
</div>
</div>
</form>
</div>
using bootstrap css
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Bootstrap 4 is not the same as bootstrap 3. Most of the classes have been renamed and unlike bootstrap 3, bootstrap 4 uses flex box.
Bootstrap 4
Remove the two inputs' inline styles
Use input-group-append instead of input-group-btn.
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="basic-addon2">
<input class="form-control " placeholder="last name" name="lastname" type="text" />
<div class="input-group-append">
<button class="btn btn-default" type="button" id="addApplicationBtn" name="addApplicationBtn">Add</button>
</div>
</div>
http://jsfiddle.net/fhg3qx96/
Bootstrap 3
Use input-group-btn inside input-group
<div class="input-group mb-3">
<input class="form-control" style="width:50%" placeholder="first name" name="firstname" type="text" />
<input class="form-control" style="width:50%" placeholder="last name" name="lastname" type="text" />
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="addApplicationBtn" name="addApplicationBtn">Add</button>
</span>
</div>
https://codepen.io/anon/pen/dQrJeW

Angular 5 + materializecss Form reset

I have a form for adding new users and I am having problems with the form reset because it does not remove the valid class of materialize.
The form:
<div class="col s12 m12 l4 xl4">
<form (ngSubmit)="onSubmit(); newLabMember.reset()" #newLabMember="ngForm" ngNativeValidate>
<!-- New lab member form -->
<div class="section">
<h5>Add lab member</h5>
<div class="input-field">
<input type="text" name="firstName" [(ngModel)]="user.firstname" class="validate" id="firstName" validate required>
<label for="firstName">First name</label>
</div>
<div class="input-field">
<input type="text" name="lastName" [(ngModel)]="user.lastname" class="validate" id="lastName" validate required>
<label for="firstName">Last name</label>
</div>
<div class="input-field">
<input type="text" name="email" [(ngModel)]="user.email" class="validate" id="email" validate required>
<label for="email">Member email</label>
</div>
<blockquote>An email will be sent to the new user with a password and further instructions.
</blockquote>
<div class="input-field">
<button type="submit" class="waves-effect waves-light btn blue-grey darken-1">Add new member</button>
</div>
</div>
</form>
</div>
As you can see, when I submit the form I use reset() form but the class .valid from materialize still there.

how to make label field and text field to appear on same line in asp.net mvc4?

#using (Html.BeginForm()) {
<div>
<fieldset>
<legend>Form</legend>
<label for="FirstName">First Name:</label>
<input type="text" name="FirstName">
<label for="LastName">Last Name:</label>
<input type="text" name="LastName">
<label for="Period">Date:</label>
<input type="text" name="Period">
<p>
<input type="submit" value=" Send " />
</p>
</fieldset>
</div>
}
Here i want to make all the label field and text field to appear on same line?How could i do that?
Change Parent Div and paragraph display style to inline
<div style="display:inline">
<fieldset>
<legend>Form</legend>
<label for="FirstName">First Name:</label>
<input type="text" name="FirstName">
<label for="LastName">Last Name:</label>
<input type="text" name="LastName">
<label for="Period">Date:</label>
<input type="text" name="Period">
<p style="display:inline">
<input type="submit" value=" Send " />
</p>
</fieldset>
</div>

How to get widget data in POST method of form submission?

I have widget called List builder, which i used to sort list of contacts.
when i submit the form the, i should get these sorted list of contacts in my $_POST array.
I am getting the content from CGridview widget but not from the following widget:
$this->widget('ext.widgets.multiselects.XMultiSelects',array(
'leftTitle'=>'Email',
'leftName'=>'Contactlist[email][]',
'leftList'=>Contactlist::model()->findUsersByemail( ),
'rightTitle'=>'Email-List',
'rightName'=>'Contactlist[email][]',
//'rightList'=>Contactlist::model()->findUsersByemail( ),
'rightList'=>array(),
'size'=>20,
'width'=>'200px',
));
How to submit this widget data, so that i can access it from $_POST array?
Here is the code generated by this widget:
<form id="yw0" action="/amantran/index.php?r=invmgmt/contactlist/admin" method="get">
<div class="row">
<label for="Contactlist_econtact">Econtact</label> <input size="10" maxlength="10" name="Contactlist[econtact]" id="Contactlist_econtact" type="text" /> </div>
<div class="row">
<label for="Contactlist_fname">Fname</label> <input size="40" maxlength="40" name="Contactlist[fname]" id="Contactlist_fname" type="text" /> </div>
<div class="row">
<label for="Contactlist_lname">Lname</label> <input size="25" maxlength="25" name="Contactlist[lname]" id="Contactlist_lname" type="text" /> </div>
<div class="row">
<label for="Contactlist_email">Email</label> <input size="50" maxlength="50" name="Contactlist[email]" id="Contactlist_email" type="text" /> </div>
<div class="row">
<label for="Contactlist_mobile">Mobile</label> <input size="10" maxlength="10" name="Contactlist[mobile]" id="Contactlist_mobile" type="text" /> </div>
<div class="row">
<label for="Contactlist_address">Address</label> <input size="50" maxlength="50" name="Contactlist[address]" id="Contactlist_address" type="text" /> </div>
<div class="row buttons">
<input type="submit" name="yt0" value="Search" /> </div>
You are having method="get" in your form, change it to method="post"

How to send the http get in Rebol to download an wordpress xml backup file?

I would like to use rebol to download an xml backup of my blog from
http://reboltutorial.com/wp-admin/export.php
the form is
<form action="" method="get">
<h3>Options</h3>
<table class="form-table">
<tr>
<th><label for="author">Restrict Author</label></th>
<td>
<select name="author" id="author">
<option value="all" selected="selected">All Authors</option>
<option value='1'>admin</option></select>
</td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" class="button" value="Download Export File" />
<input type="hidden" name="download" value="true" />
</p>
</form>
I guess I would first need to log in http://reboltutorial.com/login/ and then what after ?
Any code example to do similar stuff (getting the cookie, ...) ?
<form name="loginform" id="loginform" action="" method="post">
<p>
<label>Username<br />
<input type="text" name="log" id="user_login" class="input" value="" size="20" /></label>
</p>
<p>
<label>Password<br />
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
</p>
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> Remember Me</label></p>
<p class="submit">
<input type="hidden" name="post-from" id="post-from" value="page" />
<input type="hidden" name="action" id="action" value="login" />
<input type="submit" name="wp-submit" id="wp-submit" value="Log In" />
<input type="hidden" name="redirect_to" value="http://reboltutorial.com/wp-admin/" />
<input type="hidden" name="testcookie" value="1" />
</p>
</form>
Try this
http://rebol.wik.is/Protocols/Http