How to write a code which will remember when user click on picture "Vlado.jpg" and continue on form "forma_id"?
I need this information becouse when user submite form i will use this in my php.script in if block.
<html>
<div class="tab-pane fade Osiguranje_id">
<div class="container cont_osiguranje">
<div class="jumbotron jumb_osiguranje">
<a id="Osiguranje_id"><h2>Odaberi zastupnika</h2></a>
</div>
<div class="jumbotron">
<div class = "row">
<div class = "col-md-6 col-sm-6 col-xs-12">
<a data-toggle="pill" href="#forma_id"><img src="Vlado.jpg" class="img-rounded img-responsive" name="vlado"></a>
</div>
</div>
</div>
</div>
</div>
</br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>
<div id="forma_id" class="tab-pane fade">
<div class="container cont_forma">
<div class="jumbotron jumb_forma">
<a id="forma_id"><h2>Ispunite formu:</h2></a></br>
<form class="form-horizontal" role="form" action="proba4.php" method="POST">
<div class="form-group">
<label class="control-label col-sm-2" for="ime">Ime:</label>
<div class="col-sm-4"><input type="text" required class="form-control" name="ime" placeholder="Ime"></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-4"><input type="submit" name="submit" value="Pošalji"/></div>
</div>
</form>
</div>
</div>
</div>
</html>
You'll most likely want to create a hidden input in your form, and by default it's false, or has some other value (that means didn't click the img - for your situation), when the user clicks the image, use Javascript to change this hidden input value to true (or to a value that means they did click the img - for your situation).
Related
I have managed to pass an id to a form as a hidden input element and would like to use the same id as a parameter when sending a PATCH request to update a single row in database.
<div class="container">
<!-- update route which requires id of the row u are trying to update and the link-->
<form action="{{route('transactions.update', )}}" method="post">
#csrf
<div class="row ">
<div class="col-sm">
<p>Fullnames</p>
</div>
<div class="col-sm">
<h6 id="names"></h6>
</div>
</div>
<div class="row">
<div class="col-sm">
<p>Account</p>
</div>
<div class="col-sm">
<h6 id="account"></h6>
</div>
</div>
<div class="row">
<div class="col-sm">
<p>Meter</p>
</div>
<div class="col-sm">
<h6 id="meter"></h6>
</div>
</div>
<!-- id passed from a selected value in table-->
<input type="hidden" id="trans_id">
<div class="row justify-content-around">
<button type="submit" class="btn btn-sm m-2 w-75" style="background-color: #335b7d; color: white">Approve</button>
</div>
<div class="row justify-content-around">
Reject
</div>
</form>
</div>
</div>
Thank you
I would like to ask how to pull categories using tabs. I was able to pull all the items on one tab but I could not pull them per category. here is my code. The data comes from the database and seems to work on All items but I could not figure out how to pull them individually. I need some help with you expertise.
<div class="tab-content">
<div class="tab-pane container active" id="home">...</div>
<div class="tab-pane container fade" id="allItems">All Items
<div>
<div class="row">
<div class="col-12">
<div class="row">
#foreach($items as $per_item)
<div class="col-lg-4 col-6">
<div class="card mb-3">
<img src="{{$per_item->image_path}}" class="card-img-top">
<div class="card-body">
<small>{{$per_item->category->name}}</small>
<h4 class="card-title">
<a href="/items/{{$per_item->id}}">
{{$per_item->name}}
</a>
</h4>
<p class="card-text">{{$per_item->description}}</p>
<h3>{{$per_item->price}}</h3>
<form action="/cart/{{$per_item->id}}" method="POST">
#csrf
<div class="row">
<div class="col-12 col-md-5 col-lg-12 mb-2">
<input type="number" name="quantity" id="quantity"
class="w-100">
</div>
<div class="col-12 col-md-7 col-lg-12 mb-2">
<button type="submit" class="btn btn-primary">Add To
Cart</button>
</div>
</div>
</form>
</div>
</div>
</div>
#endforeach
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane container fade" id="consumables">Consumables
<div>
</div>
</div>
<div class="tab-pvane container fade" id="pnuematicTools">Pnuematic
Tools</div>
In an html page, I would like to recover the value of an amount and can change the value only in my admin panel.
In the file navbar.blade.php I have 250 which is the amount to edit for the example.
<div class="header-widgets hidden-xs" style="padding:0px;padding-top: 60px;">
<div id="text-3" class="widget widget_text">
<div class="textwidget">
<div class="info-icon">
<img src="/img/time.png">
<span style="font-size: 22px;color: #0d3863;font-weight: bold;"> 250</span>
</div>
</div>
</div>
</div>
I just seek to edit the amount (250) ...
In my Controller named tarrifcontroller I have that.
public function edit(Tariff $tariff)
{
return view('admin.tariffs.edit', compact('tariff'));
}
public function update(Request $request, Tariff $tariff)
{
$tariff->valeur = strip_tags($request->input('amount'));
$tariff->save();
return redirect('/tariffs');
}
In my edit.blade.php I have that
#section('content')
<div class="px-content">
<div class="page-header">
<div class="row">
<div class="col-md-4 text-xs-center text-md-left text-nowrap">
<h1><i class="px-nav-icon ion-android-apps"></i>Tarif {{$tariff->id}} </h1>
</div>
<hr class="page-wide-block visible-xs visible-sm">
<!-- Spacer -->
<div class="m-b-2 visible-xs visible-sm clearfix"></div>
</div>
</div>
<div class="row">
<div class="panel">
<div class="panel-body">
<div class="table-responsive">
<form class="panel-body" action="/tariff/edit/{{$tariff->id}}" method="POST">
#csrf
<fieldset class="form-group">
<label for="form-group-input-1">Amount</label>
<input type="text" name="amount" class="form-control" id="form-group-input-1" value="{{$tariff->amount}}">
</fieldset>
<button type="submit" class="btn btn-primary pull-right">MAJ</button>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
My problem is now in navbar.blade.php how should I do that 250 can interact with my edit / update function?
<span style="font-size: 22px;color: #0d3863;font-weight: bold;"> 250</span>
Thank you
I don't have experience with laravel but i guess like any other php framework you can echo variable from controller to view
<span style="font-size: 22px;color: #0d3863;font-weight: bold;"> <?php echo $variable ?></span>
after some googling: You can pass data to the view using the with method.
return View::make('blog')->with('posts', $posts);
I'm making a website with a guest and admin side to it. In the admin side there are additional page's in which you can fill in form's which contain text and titles for certain div's in other page's.
I was wondering how can I make it so that when you fill in these forms and press save, the variables will be used in the other page where you can actually see the title and text as html. The text and title have to be visible for everyone that visits the page and have to stay there until there are changes made.
I have code yet, since i don't know how to start, I do have the interfaces, you can see the HTML down here.
Interface Input:
<div class="panel-box">
<div class="titles">
<h4>Voeg vacatures toe</h4>
</div>
<form class="form-theme">
<div class="row">
<div class="form-group">
<div class="col-md-12">
<label for="name">Titel vacature</label>
<input type="text" required="required" value="" maxlength="100" class="form-control" name="Name" id="name">
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12">
<label for="description">Beschrijving</label>
<textarea rows="10" class="form-control" name="description" id="description" required="required" ></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="submit" value="Save" class="btn btn-lg btn-primary">
</div>
</div>
</form>
</div>
Output:
<!-- Content Central -->
<div class="container padding-top">
<div class="row">
<!-- content Column Left -->
<div class="col-md-12">
<!-- Experts -->
<div class="panel-box">
<div class="titles">
<h4> <!-- This is where the title should be --> </h4>
</div>
<div class="row">
<ul class="events-carousel events-no-carousel">
<!-- Item blog post -->
<li class="col-xs-6 col-sm-6 col-md-4">
<div class="info-post">
<h4>Vacature naam</h4>
<p><!-- This is where the text should be -->
<a class="btn btn-primary pull-right" href="{{ path('static_page', {template:'club/vacancy'}) }}">Bekijken</a></p>
</div>
</li>
<!-- End Item blog post -->
</ul>
<!-- End blog post-->
</div>
</div>
<!-- End Experts -->
</div>
</div>
</div>
<!-- End Testimonials -->
<!-- End Section Area - Content Central -->
Generally, you should store your form data in database, and then retrieve it from database to render on the other page.
So the PHP script on the page with form should save your form data, when other script on page where you want to show your data should take it from database.
I'm using the following code on my site. You'll notice that there is a checkbox outside the form (Towards the bottom). I need the value of the checkbox called to send_mail.php without creating a second form, and without placing it inside the form element. Is this even possible with PHP? `
<h2>Search for your dream home<br />
and save now!</h2>
<legend>Which Areas are you interested in?</legend>
<div class="areas row-fluid" style="text-align:left !important;">
<div class='span5' style='margin-left:0px !important;'>
<label>
<input type="checkbox" name="arrayValue[]" id="area[0]" value="test" style='margin-top:-5px !important;'> test</label>
</div>
</div>
<input type="button" onclick="jQuery('#myModal').modal('show')" value="CONTINUE" />
</div>
</div>
</div>
<!--banner area end-->
<!--content area 1 start-->
<div id="content1">
<div class="content1_in"> <span>
<h2 style="line-height:40px;font-size:40px;padding-bottom:10px">SOME CONTENT
</span>
<div class="img">
<img src="http://f14.co/realtor/assets/images/phone.png" alt="" />
</div>
</div>
</div>
<!--content area 1 end-->
<!--content area 1 start-->
<div id="content2">
<div class="content2_in"> <span> SOME CONTENT
</span>
<div class="img">
<img src="http://f14.co/realtor/assets/images/ipad-img.png" alt="" />
<div class="key"></div>
</div>
</div>
</div>
<!--content area 1 end-->
<!--content area 3 start-->
<div id="content3">
<div class="content3_in"> <span>
SOME CONTENT
</span>
<div class="img">
<img src="http://f14.co/realtor/assets/images/desktop-img.png" alt="" />
</div>
<div class="free"></div>
</div>
</div>
<!--content area 3 end-->
<div id="footer">
<div class="footer_in">
This Website Is Brought To You By: Test</div>
</div>
<!-- Modal -->
<div id="myModal" class="modal hide fade modal-survey" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel" class="survey_title">What type of home are you looking for?</h3>
</div>
<form method="post" class="form-horizontal" id="final_form" action="send_mail.php">
<input type="hidden" name="template" id="template" value="Buyers" />
<div class="modal-body" >
<div id="lead_info_1">
<div class="input select">
<div class=""></div>...
I would add a hidden input in your form.
Then, just before your post, assign the of the hidden textbox with the value of the checkbox.
(using jQuery)