need to catch posted value back in dropdown
<select name="ui3" oninput="load_ui('#ui3')" id="ui3" class="form-control" value="<?php echo isset($_POST["ui3"]) ? $_POST["ui3"] : ''; ?>">
<option value="IEC 60137: 2017">IEC 60137: 2017</option>
<option value="ANSI / IEEE C57.19.00/01">ANSI / IEEE C57.19.00/01</option>
<option value="other">Others</option>
</select>
1 answer
-
answered 2022-05-04 10:07
Haseeb Hassy
You need to check if
post
value is equal todropdown
options, like this:<select name="ui3" oninput="load_ui('#ui3')" id="ui3" class="form-control"> <option value="IEC 60137: 2017" <?= isset($_POST["ui3"]) && $_POST["ui3"] == 'IEC 60137: 2017' ? 'selected' : ''; ?>>IEC 60137: 2017</option> <option value="ANSI / IEEE C57.19.00/01" <?= isset($_POST["ui3"]) && $_POST["ui3"] == 'ANSI / IEEE C57.19.00/01' ? 'selected' : ''; ?>>ANSI / IEEE C57.19.00/01</option> <option value="other" <?= isset($_POST["ui3"]) && $_POST["ui3"] == 'other' ? 'selected' : ''; ?>>Others</option> </select>
do you know?
how many words do you know
See also questions close to this topic
-
How to upload a video using ACF in WordPress?
I am still at learning phase in WordPress. I cannot figure out in ACF which field type should I choose to upload a video file and which code should I write to show it at the front-end. Please look into the below code. I am using the_field('') but it isn't working. Can anyone help
<video width="954" height="535" controls class="tm-mb-40"> <source src="video/wheat-field.mp4" type="video/mp4"> Your browser does not support the video tag. </video>
-
delete a table form a database using laravel command
i need to delete a database table using laravel artisan command . not like this command php artisan migrate:rollback --step=5
i need to create like this route or controller code .
Route::get('/clear/database', function () {
Artisan::call('cache:clear'); return redirect('/');
});
. i also try public function dd()
{ Schema::drop('table_name'); }
but it not working . gives me error like this SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (SQL: drop table
table_name
)no foreign key for the table . what should i do ?
thanks in advance!
-
Creating Sticky Navbar with Drop Down Menu HTML
I am creating a HTML web page which contains a sticky navbar with drop down menu. However, when I created one, the dropdown menu does not works in the sticky navbar and so goes vise versa. below is the screenshot of both the result of the two codes.
*image with dropdown menu but without sticky navbar
*image with sticky navbar but without dropdown menu
below is the code for "image with dropdown menu but without sticky navbar"
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font- awesome/4.7.0/css/font-awesome.min.css"> <style> body {margin:0;font-family:Arial} .topnav { overflow: hidden; background-color: #333; } .topnav a { list-style-type: none; float: left; display: block; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; position: sticky; } .active { background-color: #04AA6D; color: white; } .topnav .icon { display: none; } .dropdown { float: left; overflow: hidden; } .dropdown .dropbtn { font-size: 17px; border: none; outline: none; color: white; padding: 14px 16px; background-color: inherit; font-family: inherit; margin: 0; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { float: none; color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } .topnav a:hover, .dropdown:hover .dropbtn { background-color: #555; color: white; } .dropdown-content a:hover { background-color: #ddd; color: black; } .dropdown:hover .dropdown-content { display: block; } @media screen and (max-width: 600px) { .topnav a:not(:first-child), .dropdown .dropbtn { display: none; } .topnav a.icon { float: right; display: block; } } @media screen and (max-width: 600px) { .topnav.responsive {position: relative;} .topnav.responsive .icon { position: absolute; right: 0; top: 0; } .topnav.responsive a { float: none; display: block; text-align: left; } .topnav.responsive .dropdown {float: none;} .topnav.responsive .dropdown-content {position: relative;} .topnav.responsive .dropdown .dropbtn { display: block; width: 100%; text-align: left; } } </style> </head> <body> <div class="header"> <h2>Scroll Down</h2> <p>Scroll down to see the sticky effect.</p> </div> <div class="topnav" id="myTopnav"> <a href="#home" class="active">Home</a> <a href="#news">News</a> <a href="#contact">Contact</a> <div class="dropdown"> <button class="dropbtn">Dropdown <i class="fa fa-caret-down"></i> </button> <div class="dropdown-content"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> </div> </div> <a href="#about">About</a> <a href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">☰</a> </div> <div style="padding-left:16px"> <h2>Responsive Topnav with Dropdown</h2> <p>Resize the browser window to see how it works.</p> <p>Hover over the dropdown button to open the dropdown menu.</p> </div> <h3>Sticky Navigation Bar Example</h3> <p>The navbar will <strong>stick</strong> to the top when you reach its scroll position.</p> <p><strong>Note:</strong> Internet Explorer do not support sticky positioning and Safari requires a -webkit- prefix.</p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <script> function myFunction() { var x = document.getElementById("myTopnav"); if (x.className === "topnav") { x.className += " responsive"; } else { x.className = "topnav"; } } </script> </body> </html>
below is the code for "image with sticky navbar but without dropdown menu"
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font- awesome/4.7.0/css/font-awesome.min.css"> <style> body { font-size: 20px; } body {margin:0;} ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; position: -webkit-sticky; /* Safari */ position: sticky; top: 0; } li { float: left; } li a { display: block; color: white; text-align: center; padding: 16px 20px; text-decoration: none; } li a:hover { background-color: #111; } /*======================================================================*/ body { background-color:white; } ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #38444d; } li { float: left; } li a, .dropbtn { display: inline-block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover, .dropdown:hover .dropbtn { background-color: red; } li.dropdown { display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } .dropdown-content a:hover {background-color: #f1f1f1;} .dropdown:hover .dropdown-content { display: block; } footer { text-align: center; padding: 3px; background-color: DarkSalmon; color: white; } </style> </head> <body> <div class="header"> <h2>Scroll Down</h2> <p>Scroll down to see the sticky effect.</p> </div> <ul> <li><a href="#home">Home</a></li> <li><a href="#news">News</a></li> <li class="dropdown"> <a href="javascript:void(1)" class="dropbtn">Dropdown</a> <div class="dropdown-content"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> </div> </li> </ul> <h3>Sticky Navigation Bar Example</h3> <p>The navbar will <strong>stick</strong> to the top when you reach its scroll position.</p> <p><strong>Note:</strong> Internet Explorer do not support sticky positioning and Safari requires a -webkit- prefix.</p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <p>Some text to enable scrolling. </p> <footer> <p>Author: Hege Refsnes<br> <a href="mailto:hege@example.com">hege@example.com</a></p> </footer> </body> </html>
Please i need some help with this as i am new to html and css.
-
How to clear user uploaded images if the limit of files exceeded in jquery
I have a simple form where a user can upload multiple images. I only want the user to upload 4 images at once, so I did the following:
$("#myfile").on("change", function() { if ($("#myfile")[0].files.length > 4) { alert("You can select only 4 images"); } });
<input type="file" id="myfile" class="form-control" name="pimage[]" multiple="multiple">
This gives an alert when the user uploads more than 4 images but doesn't stop them from submitting the form.
Can anyone please tell me how to clear the user uploaded images if the limit exceeds or disable the submit button?
-
Setting A $_GET Value From A Previously Defined Variable - PHP
I have a search form in the header of every page on a site that submits info to another page when undertaking a search query via the form's
action
attribute, namely a page calledsearch.php
and it takes the value of the search<input>
field and stores it as a variable calledsearchQuery
. Using PHP this searches a MySQL database. All of this works as expected.I would like the value of the search input field to be placed in the URL of the page the search is processed on, again namely
search.php
.I understand from other questions on SO that you can't add variables to a form's
action
attribute. If I add the key of the query string in the action attribute, the form still works OK:action="search.php?keyword="
From this I thought I would be able to then set the
$_GET
value on thesearch.php
page by using:if(isset($_POST['search-submit'])) { // make this variable available before HTML output $searchQuery = htmlspecialchars($_POST['search']); $_GET['keyword'] = $searchQuery; }
This however does not work, although it doesn't throw any errors in my PHP error logs.
Because I'm running the script on specific page allocated by the action attribute, I don't think I need to use a
$_SESSION
variable?HTML Form
Here is the form that is on every page in the header
<form action="search.php?keyword=" method="POST"> <label for="search">Enter Search</label> <input type="search" name="search" id="search"> <button type="submit" name="search-submit" id="search-submit">Search</button> </form>
-
How do I set default alignment for horizontal controls in Bootstrap-UI 3 for CakePHP 4?
This is a particularly obscure question about the Boostrap-UI plugin for CakePHP but I'm hoping someone might be able to help.
I’m using Bootstrap-UI (https://github.com/FriendsOfCake/bootstrap-ui) version 3.0, so using Bootstrap 4.6.
I’m trying to create a form that has controls that are aligned horizontally with their labels using the example from the readme here -
This works fine except I can’t see how to define the default column distribution ie so that the classes for the label and the control container are something like
col-4
andcol-8
without any breakpoint defined.If I try something like -
'align' => [ 'left' => 4, 'middle' => 8, ]
The classes created are
col-md-4
andcol-md-8
ie it seems to default to md as the breakpoint for the columns.I know this is a bit obscure but does anyone have any idea how to do what I want?
-
how can anyone send email to me on my website in js
I am creating a project as I have created a contact page. I want any user to send me a email by putting his email and message in input box of contact page. I have also tried smtpjs but with that I can send the email from my side and registered email on smtpjs but unknown user who put his email without putting his password can't send email to me
for eg-
my email - myemail@gmail.com
my password - mypassword
unknown user email - unknown@gmail.com
how can unknown user send me email by putting only his email on my website contact page
any js library and js code can use for this problem please tell me
-
Please help to find email out of this cipher
Please help me to extract the email from this cipher, i am not been able to identify what type of hash or cipher is this.email is encoded in this hash please help me find the email.
1AAXs0RyFR3OM9nZA3XVkD07AVOZmYUMsRvyeq2BoY42sNbkSUySHCdFdwwQx6LWghNDqiPyBzNE7KDXkerX4vt0klZ2
-
SMTP client send QUIT command before waitting for OKAY from server
There's a smtp issue here and it's weired. Our business partner failed to send email to us lately. After checking, we found our partner's smtp server sent QUIT command immediately after email content, before waiting for 250 OKAY from us. It causes the connection shutdown and our smtp server thinks the transaction is incomplete and drops the email.
It looks like against the RFC standard of SMTP protocol. Who has experienced this before? Thanks in advance!