I am using the following code for a search bar. When you click the submit, it does nothing. It is not even directing to another page. I am using the Understrap theme.
<div id="search">
<form action="/" method="get">
<input type="search" placeholder="Type your search word(s) here" value="<?php get_search_query(); ?>" />
<button type="submit" class="btn btn-primary">Search</button>
</form>
</div>
Make action attribute your site url instead of '/'. Sometime '/' want be useful.
<div id="search">
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>">
<input type="search" placeholder="Type your search word(s) here" value="<?php get_search_query(); ?>" />
<button type="submit" class="btn btn-primary">Search</button>
</form>
</div>
Related
I'm building a wordpress website using Avada tamplate. I use the Avada login form in which the users insert their username and password. I would like to get the username of the user when he click on the form button and he's redirect to login.php page. I don't understand why I can't do that.
The code of the form (i removed "class" and "style" in order to reduce it) is:
<form name="loginform" id="loginform" method="post" action="http://www.mywebsite.com/es/wp-login.php">
<div>
<div>
<label for="user_login">Username</label>
<input type="text" name="log" placeholder="Username" value="" size="20" id="user_login" />
</div>
<div>
<label for="user_pass">Password</label>
<input type="password" name="pwd" placeholder="Password" value="" id="user_pass" />
</div>
</div>
<div>
<div>
<button type="submit" name="wp-submit">Log in</button>
<input type="hidden" name="user-cookie" value="1" />
<input type="hidden" name="redirect_to" value="login.php" />
<input type="hidden" name="fusion_login_box" value="true" />
<input type="hidden" name="_wp_http_referer" value="/es/area-privada/" /><span></span></div>
<div></div>
</div>
</form>
The login.php code is very simple:
<?php
$username = $_POST['log'];
echo $username;
?>
however the variable $username is blank and doesn't capture the username. Someone can help me please? thanks!
I'm trying to do a generalized script for any WordPress theme which will display a 'Login' or 'Sign-In' link, then show login username, pwds fields, and upon Submit POST to another site with the login info and log them in.
I've done some CSS and code in some themes' header.php file like this:
<div class="sign-in-wrapper">
<div class="sign-in-dropdown">
<form name="login" id="sign-in-form"
<?php if($_SERVER['SERVER_NAME'] == "www.mysite.com") { ?>
action="https://secure.mysite.com/"
<?php } ?>
method="POST">
<input type="hidden" name="thisaction" id="thisaction" value="">
<b>User Name:</b>
<input type="Text" name="UserName" size="41" class="forminput1" value="">
<b>Password:</b>
<input type="password" name="pwd" size="41" class="forminput1">
<input type="submit" value="Sign In" name="login" border="0">
</form>
</div>
</div>
<div id="sign-in-link"><a class="sign-in" url="#top">Sign in</a> </div>
It works in some themes but not in others.
Is there a good way to do this?
I'm trying do a few customizations to the wordpress default search form and I would like to replace the text "Search" in the value="Search" string with an icon.
Currently I have the following form:
<form role="search" method="get" id="searchform" class="searchform" action="//example.com/">
<div class="box">
<div class="container-1">
<input type="text" value="" name="s" id="s" placeholder="Search..." />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</div>
</form>
How can I put in the following icon instead? <i class="fa fa-search"></i>
Here is a bit of a workaround, I replaced the input with button, removed value completely
<form role="search" method="get" id="searchform" class="searchform" action="//example.com/">
<div class="box">
<div class="container-1">
<input type="text" value="" name="s" id="s" placeholder="Search..." />
<button type="submit" id="searchsubmit" />
<span class="icon"><i class="fa fa-search"></i></span>
</button>
</div>
</div>
</form>
Form seems to work just fine ..
I'm experiencing an issue with a booking form displayed on an hotel wordpress website.
It currently works on firefox and edge, but nothing to do with chrome...
Here is my website :
http://terranostra-ariege.com/
The booking form is the big grey block on the center : when you hit "Réserver", then you are redirected to the booking solution with the options you chose.
The form is made this way :
<div id="resa">
<form id="AVP" method="post" action="http://www.secure-hotel-booking.com/Terranostra-Bellevue/2VW1/search" target="_blank">
<input type="hidden" id="language" name="language" value="fr" />
<input type="hidden" id="AVP_arrivalDate" name="arrivalDate" value="" />
<input type="hidden" id="AVP_nights" name="nights" value="" />
<input type="hidden" id="guestCountSelector" name="guestCountSelector" value="ReadOnly" />
<div class="resa_inline_block">
<label for="AVP_list_days" class="resa_block_label"><?php _e('Arrivée','qns'); ?> :</label>
<select id="AVP_list_days" onchange="updateDDay();" class="days"></select>
<select id="AVP_list_months" onchange="setDays();" class="months"></select>
</div>
<div class="resa_inline_block">
<label for="AVP_list_nights" class="resa_block_label"><?php _e('Nombre de nuits','qns'); ?> :</label>
<select id="AVP_list_nights"></select>
</div>
<div class="resa_inline_block">
<label for="selectedAdultCount" class="resa_block_label"><?php _e('Adultes','qns'); ?> :</label>
<select id="selectedAdultCount" name="selectedAdultCount"></select>
</div>
<div class="resa_inline_block">
<label for="selectedChildCount" class="resa_block_label"><?php _e('Enfants','qns'); ?> :</label>
<select id="selectedChildCount" name="selectedChildCount"></select>
</div>
<div class="resa_inline_block bb">
<label for="selectedInfantCount" class="resa_block_label"><?php _e('Bébés','qns'); ?> :</label>
<select id="selectedInfantCount" name="selectedInfantCount"></select>
</div>
<div class="resa_inline_block">
<input type="button" value="<?php _e('Réserver','qns'); ?>" class="submit" />
</div>
</form>
<p><?php _e('Contactez-nous au <span style="font-size: 14pt; font-weight: bold;">05 61 05 52 06</span> pour toute demande ou pour réserver directement','qns'); ?></p>
<script type="text/javascript">
var months = new Array("janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");
var message='Date en dehors du planning';
</script>
<script type="text/javascript" src="http://www.secure-hotel-booking.com/Terranostra-Bellevue/2VW1/scripts/base.js"></script>
</div>
I first thought it was because I was opening the form action on a new tab, and redirecting the user to an acknowledgments page on the current tab. So i tried to make it the right way with a simple link, and the problem is still there.
Moreover the chrome console is not reporting any error.
Do you have any idea about how I could solve this ?
Thank you very much in advance,
Elliott
Change your input button to submit rather than button:
<input type="submit" value="<?php _e('Réserver','qns'); ?>" class="submit" />
I have an plugin to didsplay list of coupon code in WordPress. I would like to place search box for searching coupon code in coupon page.
<form method="get" id="searchform" action="">
<input type="text" value="Search" name="s" id="s" />
<input type="hidden" name="cat" value="5" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
When I click on search button it redirect me to wordpress post page instead of plugin default page.
Suggest me working solution for implement searching in plugin page.
We have to redirect it manually using this form:
<form method="get" action="<?php echo "edit.php?";?>" id="coupon">
<label class="screen-reader-text" for="tag-search-input">Search Coupon Code:</label>
<input type="hidden" name="post_type" value="wpsc-product" /> //required to redirect it coupon page
<input type="hidden" name="page" value="wpsc-edit-coupons" />//required to redirect it coupon page
<input type="search" id="search-input" name="s" value="">
<input type="submit" name="" id="submit" class="button" value="Search Coupon Code">
</form>
After this you will have to grape the result from $_GET['s'] and apply manual search on that file.