php adding SSL certificate - php

I have a problem.
My website is running an SSL on the checkout page. This is the current message I get.
The page at 'https://jonathanmichael.co.uk/checkout/' was loaded over
HTTPS, but is submitting data to an insecure location at
'http://jonathanmichael.co.uk/': this content should also be submitted
over HTTPS.
<form action="http://jonathanmichael.co.uk/" method="get" id="adminbarsearch"><input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150"><input type="submit" class="adminbar-button" value="Search"></form>
My question is how do I fix this? I'm using Wordpress, I have found this code which I think links to it.
searchform.php
<!-- Start SearchForm -->
<form method="get" class="searchform" role="search" action="<?php echo home_url(); ?>/">
<fieldset>
<input name="s" type="text" id="s" placeholder="<?php _e( 'Search', THB_THEME_NAME ); ?>" class="small-12">
</fieldset>
</form>
<!-- End SearchForm -->
I have zero knowledge of PHP for help would be appreciated.
Thanks!

Easy. Just explicitly change the form action to:
<form action="https://jonathanmichael.co.uk/checkout/"
Also, please use $_POST for your form.
$_GET should not be used for anything that is supposed to be secure.
<form action="https://jonathanmichael.co.uk/checkout/" method="POST" id="adminbarsearch">

You need to pass the $scheme parameter to the call to home_url()
This will let you generate the link with the https:\\ prefix.
See the documentation: http://codex.wordpress.org/Function_Reference/home_url
<!-- Start SearchForm -->
<form method="get" class="searchform" role="search" action="<?php echo home_url($scheme = https); ?>/">
<fieldset>
<input name="s" type="text" id="s" placeholder="<?php _e( 'Search', THB_THEME_NAME ); ?>" class="small-12">
</fieldset>
</form>
<!-- End SearchForm -->

Related

Unable to keep data in form after submitting

I've been searching online on how to keep data in the form after submitting it. But after trying for awhile it still doesn't work as expected
This is the code that I tried:
<form action="process_login" method="post" target="_self">
<div class="login-field">
<input type="text" id="login-email-field" name="login-email-field" value="<?php echo isset($_POST["login-email-field"]) ? $_POST["login-email-field"] : ''; ?>" required />
<label class="login-email-label" for="login-email-field">Email/Username</label>
</div>
<div>
<button class="submit-button" type="submit">
Login
</button>
</div>
</form>
I also tried replacing the input (with a 'TEST' string in the value field if the POST is empty) but the 'TEST' string did not appear after submitting the form.
<input type="text" id="login-email-field" name="login-email-field" value="<?php echo isset($_POST["login-email-field"]) ? $_POST["login-email-field"] : 'TEST'; ?>" required />
Any help would be appreciated thanks!
Action specifies a URL to which the form’s data is sent when submitted.
If you want to stay on the same page you can leave it out
<form method="post" target="_self">
or set the name of the actual page.
<form action="actualPage.php" method="post" target="_self">

Redirect search to home page

I have a custom search bar which works fine on my Wordpress home page, however when I place it on a different page of the site, the URL keeps directing to http://localhost/pageName/?s=searchTerm instead of http://localhost/?s=searchTerm. I've tried setting form action to
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
and also hardcoding my site URL but the redirect happens every time.
Here is my searchform.php file:
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div>
<input type="text" value="<?php echo the_search_query(); ?>" name="s" id="s" placeholder="Search" />
</div>
</form>
How would I get the form to direct to http://localhost/?s=searchTerm?
Just write
<form method="get" id="searchform" action="/">

Magento search box on Wordpress site

I have a WP site on http://subdomain.example.com and a Magento site at http://example.com.
I was wondering what is the easiest way to add a Magento search box on the WP installation?
This is the WP search box code, but i dont know what parameter to modify since i have no idea how Magento works :(
<form role="search" method="get" id="searchform" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div>
<label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
<input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="<?php echo esc_attr_x( 'Search', 'submit button' ); ?>" />
</div>
</form>
Any help would be greatly appreciated!
You can make a php script that gets the data from the magento site every time someone searchs . that would probably be the simplest way.
Put the Magento catalogsearch url in the form action, and an input field with name attribute value "q" such as:
<form method="get" action="http://example.com/catalogsearch/result/">
<input type="text" value="" name="q" />

Empty $_POST in Wordpress Archive Page

I have a custom form in my wordpress theme archive.php file but I can't get the post of that form. It's empty.
I have these:
<?php print_r($_POST); ?>
<div class="filtros">
<h3>Búsqueda de documentos</h3>
<form action="#" method="post">
<input type="text" id="name" name="f_name" placeholder="Buscar" value="<?php echo $_POST['f_name']; ?>" />
<div class="dates">
<input type="text" id="inicio" class="date" name="f_inicio" placeholder="Fecha de inicio" value="<?=$_POST['f_inicio']?>" /> /
<input type="text" id="final" class="date" name="f_final" placeholder="Fecha final" value="<?=$_POST['f_final']?>" />
</div>
<div class="submit"><input type="submit" value="Buscar" /></div>
</form>
</div>
Even if I pass the variables throw the URL I cant get that vars with $_GET.
¿Any idea?
While it's not advisable from a security point of view, you can change the method on your form from method="post" to method="get" to have variables posted as $_GET variables instead.
Change action="#" to action="<? echo $_SERVER['REQUEST_URI']?>"
Try change <?= to <? echo
You may need to point the action="myfile.php" to specific file.. See the solutions here:
$_POST returns empty on form submit in wordpress

Merge wordpress searchform code with custom html code

How do I make this code (custom):
<div id="sb-search" class="sb-search">
<form>
<input class="sb-search-input" placeholder="Search.." type="text" value="" name="search" id="search">
<input class="sb-search-submit" type="submit" value="">
<span class="sb-icon-search"></span>
</form>
</div>
retrieve search results like this one ( wordpress ) does:
<form method="get" class="searchform" action="<?php echo home_url('/'); ?>">
<div>
<input type="text" class="search" name="s" onblur="if(this.value=='')this.value='<?php _e('To search type and hit enter','typegrid'); ?>';" onfocus="if(this.value=='<?php _e('To search type and hit enter','typegrid'); ?>')this.value='';" value="<?php _e('To search type and hit enter','typegrid'); ?>" />
</div>
Basically I got this custom code for an awesome search box with on-click slide etc. It has a field where people can type, but it gets no results as used on my wordpress site. I wanna make it able to get results from wordpress content w/o changing divs thus not altering its design. Please help, I'm stuck!!
This would do it:
<div id="sb-search" class="sb-search">
<form action="<?php echo home_url('/'); ?>">
<input class="sb-search-input" placeholder="Search.." type="text" value="" name="s" id="search">
<input class="sb-search-submit" type="submit" value="">
<span class="sb-icon-search"></span>
</form>
</div>
All you have to do is add the form action, and make the name of the search input to be "s".
<form method="get" class="searchform" action="<?php echo home_url('/'); ?>" >
<input class="sb-search-input" placeholder="Search.." type="text" value="" name="s" id="search">
<input class="sb-search-submit" type="submit" value="">
<span class="sb-icon-search"></span>
</form>
homeurl ?s=anything will call wordpress search function, so just make form's action GET and ACTION = your home url

Categories