AJAX and PHP autocomplete(SuggestionsList) - php

I'm trying to show suggestionList on search, I have 4 questions
is it safe?
why it doesn't work on google chrome and working on firefox and ie
how i make it hide suggestions after 2 > seconds if the user
didn't choose any of the suggestions, i have tried to do but it
didn't work
[setTimeOut(document.getElementById("list").style.display="none",
2000)]
how to add quote in the sql query while im using WHERE > NAME LIKE
here is the piece of code
<script type="text/javascript">
function showSuggestions(str)
{
if(str=="")
return;
if(window.XMLHttpRequest())
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
var c = document.getElementById("list");
c.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "/ajax/character/"+str, true);
xmlhttp.send();
}
</script>
<form action="/characters/" onsubmit="window.location='/characters/'+this.name.value; return false;" class="form" autocomplete="off" method="post">
<p style="font-weight:200;color:brown;font-size:12px;">Find User.</p>
<div>Please enter a user name
<input name="name" type="text" onkeyup="showSuggestions(this.value)" maxlength="35" required="required" pattern="[A-Za-z\s]{3,35}" autofocus="autofocus"/>
<div id="list"></div>
</div>
<p style="text-align:center">
<input type="submit" class="button" value="Search"/>
</p>
</form>
<style>
.suggestionList {
margin: 0px;
padding: 0px;
padding-left: 10px;
line-height: 16px;
list-style: none outside none;
}
.suggestionList li {
margin: 0px 0px 3px 0px;
padding: 3px;
cursor: pointer;
}
.suggestionList li:hover {
background-color: #659CD8;
}
.suggestionsBox {
position: relative;
left: 230px;
margin: 10px 0px 0px 0px;
width: 200px;
background-color: #212427;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border: 2px solid #000;
color: #fff;
}
</style>
<?php
if(isset($_GET['name']) && strlen($_GET['name']) > 1) {
include('../main.php');
$name = $_GET['name'];
if(check_name($name)) {
?>
<div class="suggestionsBox" id="suggestions" style="display :block;">
<img src="/images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
<div class="suggestionList" id="SuggestionsList"><?
foreach(query('SELECT name FROM users WHERE name LIKE "'.$name.'" LIMIT 5')->fetchAll() as $q) {
echo '<li>'.$q['name'].'</li>';
} ?>
</div>
</div>
<?
}
else
echo 'Invalid name format';
}

Related

Results fixed on webpage

When I try to display content from another blade template, it will only show certain data on the webpage. What I want is inside this page, the content from test.blade.php together with the button, when click will pop up a form(I don't want the test.blade.php content to be inside). But whenever I try to do it, only certain information is shown and when I view page source, all the data has already been loaded. I have asked this question before already and someone told me it was the fault of my css, but I when I try to look at it, I don't really see anything which is causing this to happen. Can someone help me please? Thanks in advance!
I will put the screenshot here first in the question.
This is what it is suppose to look like where it will have a scroll down bar, and below there should be a button for the popup form.
But this is what I am getting (I have checked that all the data are already loaded)
elements.css (here is the css that I used)
#abc {
width: 100%;
height: 100%;
opacity: .95;
top: 0;
left: 0;
display: none;
position: fixed;
background-color: #313131;
overflow: auto;
}
img#close {
position: absolute;
right: -14px;
top: -14px;
cursor: pointer;
}
div#popupContact {
position: absolute;
left: 50%;
top: 17%;
margin-left: -202px;
font-family: 'Raleway', sans-serif;
}
form {
max-width: 300px;
min-width: 250px;
padding: 10px 50px;
border: 2px solid gray;
border-radius: 10px;
font-family: raleway;
background-color: #fff;
}
p {
margin-top: 30px;
}
h2 {
background-color: #FEFFED;
padding: 20px 35px;
margin: -10px -50px;
text-align: center;
border-radius: 10px 10px 0 0;
}
hr {
margin: 10px -50px;
border: 0;
border-top: 1px solid #ccc;
}
input[type=text] {
width: 82%;
padding: 10px;
margin-top: 30px;
border: 1px solid #ccc;
padding-left: 40px;
font-size: 16px;
font-family: raleway;
}
#name {
background-image: url(../images/name.jpg);
background-repeat: no-repeat;
background-position: 5px 7px;
}
#email {
background-image: url(../images/email.png);
background-repeat: no-repeat;
background-position: 5px 7px;
}
textarea {
background-image: url(../images/msg.png);
background-repeat: no-repeat;
background-position: 5px 7px;
width: 82%;
height: 95px;
padding: 10px;
resize: none;
margin-top: 30px;
border: 1px solid #ccc;
padding-left: 40px;
font-size: 16px;
font-family: raleway;
margin-bottom: 30px;
}
#submit {
text-decoration: none;
width: 100%;
text-align: center;
display: block;
background-color: #FFBC00;
color: #fff;
border: 1px solid #FFCB00;
padding: 10px 0;
font-size: 20px;
cursor: pointer;
border-radius: 5px;
}
span {
color: red;
font-weight: 700;
}
button {
width: 10%;
height: 45px;
border-radius: 3px;
background-color: #cd853f;
color: #fff;
font-family: 'Raleway', sans-serif;
font-size: 18px;
cursor: pointer;
}
evaltest.blade.php
<html>
<head>
<title>Popup form </title>
<meta name="robots" content="noindex, nofollow">
<link href="{{ asset('css/elements.css') }}" rel="stylesheet">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-43981329-1']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<!-- body starts here -->
<body id ="bdy" style="overflow:hidden;">
<div id="abc">
<!-- Popup div starts here -->
<div id="popupContact">
<!-- contact us form -->
<form class="form-horizontal" method="post" action="{{ url('/evaltest/'.$data0->id) }}">
{{ csrf_field() }}
<img id ="close" src="{{ URL::to('/image') }}/3.png" onclick ="div_hide()">
<input type="hidden" name="user_id" value="{{$data0->id}}">
<div class="form-group">
<label class="col-md-2"><b>Recommendation:</b></label>
<div class="col-md-6">
<input type="radio" id ="recommendation" name="recommendation" value="Yes"> Yes<br>
<input type="radio" id ="recommendation" name="recommendation" value="No"> No<br>
</div>
</div>
<div class="form-group">
<div class="col-md-6-offset-2">
<input id= "submit" type="submit" href="javascript: check_empty()" class="btn btn-primary" value="Save">
</div>
</div>
</form>
</div>
<!-- Popup Div Ends Here -->
// #include('test')
//it will show all data if I were to put here but I don't want to put it together with the popup form
</div>
<!-- Display Popup Button -->
//this will show a few info but no button
#include('test')
<h1>Click Button to Evaluate</h1>
<button id="popup" onclick="div_show()">Popup</button>
<script src="{{ asset('/js/my_js.js') }}"></script>
//this will show even lesser info but button is shown
//#include('test')
</body>
</html>
test.blade.php (there are more information inside but I only put some as an example of how I got the information)
<div class="container">
#foreach ($data as $object)
<b>Name: </b>{{ $object->Name }}<br><br>
<b>Alias: </b>{{ $object->Alias }}<br><br>
<b>Email: </b>{{$object->Email}}<br><br>
#endforeach
</div>
I have tried removing some of the things inside the css but nothing happen, I even try removing those with the position: fixed and also added .container but it still doesn't work.
myjs.js
// function to display popup
function div_show() {
document.getElementById('abc').style.display = "block";
}
// function to hide popup
function div_hide(){
document.getElementById('abc').style.display = "none";
}
I have figured it out how to show my data is that I have to remove the style="overflow:hidden;" part so that it will work

Custom modal login php form receives 404 resource not found error

I'm working on a custom PHP, modal login form. When I click the Login button, I receive the 404 resource not found, being my PHP file that handles the authentication.
The two files are here:
action_page.php
<?php
session_start();
$name = 'user1';
$pwd = 'home';
if(isset($_POST['submit'])){
// get vars
$username = $_POST['username'];
$password = $_POST['password'];
if ($username == $name and $password == $pwd){
redirect('http://www.mden.com');
} else {
redirect('http://www.youtube.com');
}
} else {
redirect('login.html');
}
?>
login.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
form {
border: 3px solid #f1f1f1;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
/* Change styles for span and cancel button on extra small screens */
#media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
/* The Modal (background) */
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.9);
background-color: rgb(0,0,0,0.4);
padding-top: 60px;
}
/* Modal Content/Box */
.modal-content {
background-color: #fefefe;
margin: 5px auto;
border: 1px solid #888;
width: 20%;
}
/* The Close Button */
.close {
/* Position it in the top right corner outside of the modal */
position: absolute;
right: 25px;
top: 0;
color: white;
font-size: 35px;
font-weight: bold;
}
/* Close button on hover */
.close:hover,
.close:focus {
color: red;
cursor: pointer;
}
/* Add Zoom Animation */
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
#-webkit-keyframes animatezoom {
from {-webkit-transform: scale(0)}
to {-webkit-transform: scale(1)}
}
#keyframes animatezoom {
from {transform: scale(0)}
to {transform: scale(1)}
}
</style>
</head>
<body>
<!-- Button to open the modal login form -->
<button onclick="document.getElementById('id01').style.display='block'">Login</button>
<!-- The Modal -->
<div id="id01" class="modal">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
<!-- Modal Content -->
<form class="modal-content animate" method="post" action="/action_page.php">
<!-- No Avatar!!! -->
<!-- Login Info -->
<div class="container">
<label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required><br /><br />
<label><b>Password</b></label>
<input type="text" placeholder="Enter Password" name="psw" required><br /><br />
<button name="do_login" type="submit">Login</button>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button>
</div>
</form>
</div>
<script>
// Get the modal
var modal = document.getElementById('id01');
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>
The file path used in your form's action is correct?
Try remove the "/" from action="/action_page.php" if action_page.php stay on same directory.

while setting cookies getting error of undefined index

<script>
$(document).ready(function(){
setTimeout(function(){
if(!mag_cookie_val)
$("#myNav").show();
}, 12000);
$("#close_magnet").click(function(){
$("#myNav").hide();
});
$("#magnet_email").keyup(function(){
$("#magnet_email").css("border-color","#67AEE9");
});
$("#magnet_continue").click(function(){
var MagEmail = $("#magnet_email").val();
atpos = MagEmail.indexOf("#");
dotpos = MagEmail.lastIndexOf(".");
if(atpos < 1 || ( dotpos - atpos < 2 ))
{
$("#magnet_email").css("border-color","red");
}else{
/*
$.ajax({
url: "leadmagnet_res.php",
method: 'POST',
data:{magemail:MagEmail}
}).done(function(data) {
//alert(data)
if(data !=0){
$("#myNav").css("height","0%");
}
});
*/
$.ajax({
url: 'leadmagnet_res.php',
type: 'post',
data: {magemail:MagEmail},
//processData: false,
success: function( res ){
//alert(res);
},
error: function(){
alert( "error occured" );
},
complete: function(){
$("#myNav").hide();
}
});
}
});
//Lead magnet close code End
$(document).ready(function() {
//setTimeout(function(){ $("#myNav").show(); }, 12000);
$("#magnet_email").css("border-color","#67AEE9");
//Lead magnet close code start
$("#close_magnet").click(function(){
$("#myNav").css("height","0%");
});
$("#magnet_email").keyup(function(){
$("#magnet_email").css("border-color","#67AEE9");
});
$("#magnet_continue").click(function(){
var MagEmail = $("#magnet_email").val();
atpos = MagEmail.indexOf("#");
dotpos = MagEmail.lastIndexOf(".");
if(atpos < 1 || ( dotpos - atpos < 2 ))
{
//alert(1);
$("#magnet_email").css("border-color","red");
}else
{
//alert(2);
$.ajax({
url: siturl_mag+"leadmagnet_res.php",
method: 'POST',
data:{magemail:MagEmail}
}).done(function(data) {
//alert(data)
if(data !=0){
$("#myNav").css("height","0%");
}
});
}
});
//Lead magnet close code End
</script>
<style>
.overlay_magnet {
height: 0% !important;
width: 100% !important;
position: fixed !important;
z-index: 94 !important;
top: 0;
left: 0;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0, 0.3);
transition: 0.5s;
}
.overlay_magnet-content {
margin-left: 27%;
margin-top: 30px;
position: relative;
text-align: center;
top: 0;
width: 45%;
}
.overlay_magnet a {
padding: 8px;
text-decoration: none;
font-size: 36px;
color: #818181;
display: block;
transition: 0.3s;
}
.overlay_magnet a:hover, .overlay a:focus {
color: #f1f1f1;
}
.overlay_magnet .closebtn {
position: absolute;
top: 20px;
right: 45px;
font-size: 60px;
}
#media screen and (max-height: 450px) {
.overlay_magnet {}
.overlay_magnet a {font-size: 20px}
.overlay_magnet .closebtn {
font-size: 40px;
top: 15px;
right: 35px;
}
}
.circle_magnet {
width: 100%;
padding: 10%;
background: white;
border-radius: 50px;
border-style: solid;
border-color: #FE0000;
border-width:4px;
}
.circle_magnet-wrapper {
margin: 0 5%;
position: relative;
}
.circle_magnet .list-inline {
font-size: 0px;
margin: 0;
}
.circle_magnet .list-inline li {
font-size: 20px;
display: block;
}
.circle_magnet p {
padding-top: 10%;
margin: 0;
}
#media (min-width:460px) {
.circle_magnet .list-inline li {
font-size: 50px;
display: inline-block;
}
.circle_magnet-wrapper {
width: 100%;
position: relative;
margin:0 auto;
}
.circle_magnet {
height: 0px;
padding: 50%;
border-radius: 50%;
}
.circle_magnet > div {
position: absolute;
text-align: center;
left: 10%;
right: 10%;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
top:20%\9; /* ie8 hack test this out it's a guess */
}
}
.circle_text_magnet{
cursor:pointer;
}
.circle_text_magnet:hover {
text-decoration: underline;
}
.arrow{
height:25px;
width:25px;
}
</style>
<div id="myNav" class="overlay_magnet hidden-xs hidden-sm" <?php if ($magstatus !=0){?>style="height:0% !important;display:none;" <?php }else{ ?>style="height:100% !important;display:none;" <?php } ?> >
<div class="overlay_magnet-content" >
<div class="circle_magnet-wrapper">
<div class="circle_magnet text-center">
<div class="row" style="margin-top:-40%;">
<div class="col-md-12">
<center>
<label style="font-family: Roboto;color: green;text-shadow: rgb(46, 46, 46) 0px 4px 5px;font-size: 42px;font-weight: bold !important;margin: 0 !important;">Sign Up!</label>
</center>
</div>
</div>
<div class="row" style="margin-top:-24%;">
<div class="col-md-12">
<center>
<label style="font-family: Roboto;color: #00006A;font-size: 20px;font-weight: normal !important;margin: 0 !important;">Join our Travel Community.</label>
<label style="font-family: Roboto;color: #00006A;font-size: 20px;font-weight: normal !important;margin: 0 !important;">Get Free Exclusive Travel Tips and<br> Links to our New Travel Videos.</label>
</center>
</div>
</div>
<div class="row" style="margin-top:-12%;">
<div class="col-md-12">
<center>
<label style="font-family: Roboto;color: #fe0000;font-size: 20px;font-weight: normal !important;margin: 0 !important;">Enter your email below</label>
</center>
</div>
</div>
<div class="row" >
<div class="col-md-12" style="border: 1px solid #00006A;border-radius: 7px;padding: 18px;box-shadow: inset 0px 0px 50px 0px #ABABAB, 0px 2px 9px 1px #242424;">
<div class="col-md-9">
<input id="magnet_email" class="form-control" placeholder="Enter your email address " type="text" >
</div>
<div class="col-md-3" >
<button class="btn btn-primary pull-left " id="magnet_continue">Continue</button>
</div>
</div>
</div>
<div class="row" style="margin-top:20%;">
<div class="col-md-12">
<span style="font-family: Roboto;color: #00006A;font-size: 12px;font-weight: normal !important; ">By clicking Continue, I agree to the </span>
<span> Terms of Service</span>
</div>
</div>
<div class="row" style="margin-top:35%;">
<div class="col-md-12">
<center><h2 id="close_magnet" class="circle_text_magnet" style="font-family: Roboto;color: #00006A;font-weight: normal !important; margin-left:10px; ">No Thanks</h2></center>
</div>
</div>
</div>
</div>
</div>
this is a code of cookies which i m setting for a form to be displayed
but always getting a error of Undefined
index: MagnetStatus in line 3
which is
$magstatus = $_COOKIE[$cookie_name];
code:
$magstatus = $_COOKIE[$cookie_name];
if(!$magstatus) {
$cookie_value = 0;
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
}
?>
so can u help me out or any idea regarding this
you can either use isset() or empty() to prevent such warnings if the cookie with the specified name doesnt exist
$magstatus = (isset($_COOKIE[$cookie_name])) ? $_COOKIE[$cookie_name] : 'default_value_here';
You have to use following code to check whether cookie is set or not:
if(!isset($_COOKIE[$cookie_name])) {
$cookie_value = 0;
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
}
Remove $magstatus = $_COOKIE[$cookie_name]; line only check cookie with isset method

Add more files separately using jquery [duplicate]

This question already has answers here:
Multiple file upload in php
(14 answers)
Closed 5 years ago.
My users are able to add more files separately. Now I am able to add multiple files at once, but I can't choose other files it getting replace. When user added one file there should be option for add more files. How can I achieve this? Here I have added only uploading scripts for this form.
PHP
if($_FILES['fil_attachment']['name'] != '') {
#copy(
$_FILES['fil_attachment']['tmp_name'],
'uploads/'.$_FILES['fil_attachment']['name']
);
$attachment[0] = "uploads"."/".$_FILES['fil_attachment']['name'];
$file_name=$_FILES['fil_attachment']['name'];
}
HTML
<form
class="form-request"
name="frmRequest"
method="post"
action
enctype="multipart/form-data"
>
<input
name="MyFile"
type="hidden"
id="MyFile"
tabindex="99"
size="1" />
<input
type="file"
name="fil_attachment"
multiple
id="fil_attachment"
onChange="MyFile.value=fil_attachment.value" />
<input type="submit">
</form>
Please refer to the PHP manual section on uploading multiple files here:
http://php.net/manual/en/features.file-upload.multiple.php
Also, have a look at this existing question:
Multiple file upload in php
JavaScript and jQuery help you to select multiple upload item. Here is the code snippet
$(function() {
var countFiles = 1,
$body = $('body'),
typeFileArea = ['txt', 'doc', 'docx', 'ods'],
coutnTypeFiles = typeFileArea.length;
//create new element
$body.on('click', '.files-wr label', function() {
var wrapFiles = $('.files-wr'),
newFileInput;
countFiles = wrapFiles.data('count-files') + 1;
wrapFiles.data('count-files', countFiles);
newFileInput = '<div class="one-file"><label for="file-' + countFiles + '">Attach file</label>' +
'<input type="file" name="file-' + countFiles + '" id="file-' + countFiles + '"><div class="file-item hide-btn">' +
'<span class="file-name"></span><span class="btn btn-del-file">x</span></div></div>';
wrapFiles.prepend(newFileInput);
});
//show text file and check type file
$body.on('change', 'input[type="file"]', function() {
var $this = $(this),
valText = $this.val(),
fileName = valText.split(/(\\|\/)/g).pop(),
fileItem = $this.siblings('.file-item'),
beginSlice = fileName.lastIndexOf('.') + 1,
typeFile = fileName.slice(beginSlice);
fileItem.find('.file-name').text(fileName);
if (valText != '') {
fileItem.removeClass('hide-btn');
for (var i = 0; i < coutnTypeFiles; i++) {
if (typeFile == typeFileArea[i]) {
$this.parent().addClass('has-mach');
}
}
} else {
fileItem.addClass('hide-btn');
}
if (!$this.parent().hasClass('has-mach')) {
$this.parent().addClass('error');
}
});
//remove file
$body.on('click', '.btn-del-file', function() {
var elem = $(this).closest('.one-file');
elem.fadeOut(400);
setTimeout(function() {
elem.remove();
}, 400);
});
});
input {
display: none;
}
.files-wr {
padding: 20px;
}
.files-wr label {
margin-bottom: 20px;
border-bottom: 1px dashed #177cca;
position: relative;
display: inline-block;
color: #177cca;
font-size: 18px;
font-weight: 400;
cursor: pointer;
transition: all .2s;
}
.files-wr label:after {
content: '+';
width: 32px;
height: 32px;
border-radius: 5px;
background-color: #177cca;
position: absolute;
top: -4px;
right: -47px;
font-size: 18px;
line-height: 32px;
color: #fff;
text-align: center;
transition: all .2s;
}
.files-wr label:hover,
.files-wr label:active {
color: #77c639;
border-color: #77c639;
}
.files-wr label:hover:after,
.files-wr label:active:after {
background-color: #77c639;
}
.files-wr .one-file~.one-file label {
display: none;
}
.files-wr .one-file.error {
border: none;
}
.files-wr .one-file.error .file-name {
color: #ca4a17;
}
.files-wr .file-item {
position: relative;
margin-top: 4px;
display: flex;
align-items: center;
}
.files-wr .file-item.hide-btn {
display: none;
}
.files-wr .file-name {
font-size: 16px;
font-style: italic;
line-height: 26px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding-right: 10px;
}
.files-wr .btn-del-file {
margin-left: 5px;
width: 16px;
min-width: 16px;
height: 16px;
line-height: 16px;
border-radius: 3px;
color: #fff;
text-align: center;
cursor: pointer;
transition: all .2s;
background-color: #177cca;
}
.files-wr .btn-del-file:hover,
.files-wr .btn-del-file:focus {
background-color: #ca4a17;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="files-wr" data-count-files="1">
<div class="one-file">
<label for="file-1">Attach file</label>
<input name="file-1" id="file-1" type="file">
<div class="file-item hide-btn">
<span class="file-name"></span>
<span class="btn btn-del-file">x</span>
</div>
</div>
</div>

text is displaying below after click on button

please visit link
you can see as in this image
please enter "560043" in zip code and click on "mouse button".than text "Check COD Availability At" is displaying below image. but i want to display the text above after clicking on "check" button also.
css
.block-check-delivery .block-title strong {background-image:none; font-size: 11px;}
.block-check-delivery .block-content {padding:0 10px; }
.block-check-delivery input{width: 107px;}
.block-check-delivery .button {
/* float: right; */
position:relative;
left:10px;
}
.block-check-delivery .block-content > br:first-child {
display: none;
}
.block-check-delivery .block-content > br:last-child {
display: none;
}
.block-title {
position: relative;
padding: 10px 0 0;
margin-bottom: 5px;
// border-top: 1px solid #cccccc; // remove this...
border-top: none !important; // Add this
display: inline-block; //
}
.block-content {
margin-top: 5px;
display: inline-block; //
}
.block-title {
position: relative;
padding: 10px 0 0;
margin-bottom: 5px;
border-top: none;
display: inline-block;
}
.std ul {
list-style: disc outside;
/* margin-bottom: 1.5em; */
}
.product-view .product-shop .short-description { margin-bottom: 5px; clear: both; }
.block, .col-left-first { margin-bottom:10px; }
phtml
<div class="block block-list block-check-delivery">
<div class="block-title">
<?php $blockLabel = Mage::getStoreConfig('checkdelivery/general/block_title'); ?>
<strong><span><?php echo $this->__($blockLabel) ?></span></strong>
</div>
<div class="block-content" >
<br>
<input name="zipcode" size="17" type="text" id="zipcode" value="<?php echo Mage::getModel('core/cookie')->get('zip'); ?>" maxlength="10" class="input-text" placeholder="<?php echo $this->__('Enter ZIP Code'); ?>"/>
<button type="button" name="zip-check" title="Check" class="button" id="zip-check" ><span><?php echo $this->__('Check'); ?></span></button>
<div id="delivery-message"></div>
<?php $defaultHtml = Mage::getStoreConfig('checkdelivery/general/default_html'); ?>
<div id="delivery-html"><?php if(Mage::getModel('core/cookie')->get('message')){
echo Mage::getModel('core/cookie')->get('message');
}
else{
$defaultHtml; } ?></div>
<br>
</div>
</div>
just add following css
.block-title{
float:left;
}
You can add this css in this class .block-title :
.block-title {
border-top: medium none;
display: inline-block;
margin-bottom: 5px;
padding: 10px 0 0;
position: relative;
float: left;
}

Categories