hide chekbox, highlight selected pitures - php

I would like to hide the chekboxes in my from and replace them with pictures. At the moment i already have the pictures but i would also like to hide the check3boxes themself. if one of the pictures gets selected, it should get a highlighted border. I would be really glad for any help
here's my current form code
<form type="post" action="photoselection.php">
<div id="photowrapper">
<div class="photo">
<input type="checkbox" value="" name="bild1">
<label class="label_item" for="rbild1"><img src="bild1.jpg"/></label>
</div>
<div class="photo">
<input type="checkbox" value="" name="bild2" id="rbild2">
<label class="label_item" for="rbild2"><img src="bild2.jpg"/></label>
</div>
<div class="photo">
<input type="checkbox" value="" name="bild3" id="rbild3">
<label class="label_item" for="rbild3"><img src="bild3.jpg"/></label>
</div>
<div class="photo">
<input type="checkbox" value="" name="bild4" id="rbild4">
<label class="label_item" for="rbild4"><img src="bild4.jpg"/></label>
</div>
<div class="photo">
<input type="checkbox" value="" name="bild5" id="rbild5">
<label class="label_item" for="rbild5"><img src="bild5.jpg"/></label>
</div>
<div class="photo">
<input type="checkbox" value="" name="bild6" id="rbild2">
<label class="label_item" for="rbild2"><img src="bild2.jpg"/></label>
<Input type = "Submit" Name = "Submit" VALUE = "Bild anzeigen">
</div>
</div>
</form>

You can do it using CSS
<style>
.photo > input{
display:none;
}
.photo > input:checked + label > img{
border: 3px solid black;
}
</style>
Hope it should work

As I said in my comment (and as #roullie mentioned), one way to do it is with jQuery / JS, a simple way to hide the checkboxes would be to do it like this:
jQuery example:
$(document).ready(function() {
$( ".checkbox" ).click(function() {
$( this ).hide();
});
});
And then apply the checkbox class to any of the checkboxes you want to hide when a image is shown.
This can also be used to show the checkbox again or add some other logic to be executed when the image is shown.

Use your image as background-image and with the help of a wrapper you can hide the checkbox completly. Works also with radio buttons (with a slight addition)
//HTML
<div class="checkbox">
<input id="check" value="" name="check" checked="checked" type="checkbox">
<label for="check"></label>
</div>
//CSS:
.checkbox input[type="checkbox"] {
display: none;
}
.checkbox input[type="checkbox"] + label {
display: block;
float: left;
border: 1px solid grey;
width: 100px;
height: 50px;
background: transparent url("https://placehold.it/100x50/4DA61F") no-repeat scroll 0 0;
}
.checkbox input[type="checkbox"]:checked + label {
border: 1px solid darkred;
background: transparent url("https://placehold.it/100x50/F3C914") no-repeat scroll 0 0;
}
JSFiddle Example 1
Here a second solution with a inline image:
//HTML
<div class="checkbox">
<input id="check" value="" name="check" type="checkbox"/>
<label for="check">
<img src="https://placehold.it/100x50/deff00" alt=""/>
</label>
</div>
//CSS
.checkbox input[type="checkbox"] {
display: none;
}
.checkbox input[type="checkbox"] + label {
display: block;
float: left;
font-size: 0;
border: 2px solid #f4f4f4;
}
.checkbox input[type="checkbox"]:checked + label {
border: 2px solid red;
}
JSFiddle Example 2

Related

Login/Signup on the same page

Currently I have a login form like this This is how it looks like:
<body>
<div class="wrapper fadeInDown">
<div id="formContent">
<!-- Tabs Titles -->
<h2 class="active"> Sign In </h2>
<h2 class="inactive underlineHover">Sign Up </h2>
<!-- Icon -->
<div class="fadeIn first">
<img src="abc-logo.png" id="icon" alt="User Icon" style='height: 25%; width: 25%; object-fit: contain' />
</div>
<!-- Login Form -->
<form>
<input type="text" id="login" class="fadeIn second" name="login" placeholder="login">
<input type="text" id="password" class="fadeIn third" name="login" placeholder="password">
<input type="submit" class="fadeIn fourth" value="Log In">
</form>
<!-- Remind Passowrd -->
<div id="formFooter">
<a class="underlineHover" href="#">Forgot Password?</a>
</div>
</div>
</div>
</body>
How can I add some sort of "switch function(?)" that when the user press "Sign up" is shows sign up boxes insted?
You can use tabs try this,
/*
CSS for the main interaction
*/
.tabset > input[type="radio"] {
position: absolute;
left: -200vw;
}
.tabset .tab-panel {
display: none;
}
.tabset > input:first-child:checked ~ .tab-panels > .tab-panel:first-child,
.tabset > input:nth-child(3):checked ~ .tab-panels > .tab-panel:nth-child(2),
.tabset > input:nth-child(5):checked ~ .tab-panels > .tab-panel:nth-child(3),
.tabset > input:nth-child(7):checked ~ .tab-panels > .tab-panel:nth-child(4),
.tabset > input:nth-child(9):checked ~ .tab-panels > .tab-panel:nth-child(5),
.tabset > input:nth-child(11):checked ~ .tab-panels > .tab-panel:nth-child(6) {
display: block;
}
/*
Styling
*/
body {
font: 16px/1.5em "Overpass", "Open Sans", Helvetica, sans-serif;
color: #333;
font-weight: 300;
}
.tabset > label {
position: relative;
display: inline-block;
padding: 15px 15px 25px;
border: 1px solid transparent;
border-bottom: 0;
cursor: pointer;
font-weight: 600;
}
.tabset > label::after {
content: "";
position: absolute;
left: 15px;
bottom: 10px;
width: 22px;
height: 4px;
background: #8d8d8d;
}
.tabset > label:hover,
.tabset > input:focus + label {
color: #06c;
}
.tabset > label:hover::after,
.tabset > input:focus + label::after,
.tabset > input:checked + label::after {
background: #06c;
}
.tabset > input:checked + label {
border-color: #ccc;
border-bottom: 1px solid #fff;
margin-bottom: -1px;
}
.tab-panel {
padding: 30px 0;
border-top: 1px solid #ccc;
}
/*
Demo purposes only
*/
*,
*:before,
*:after {
box-sizing: border-box;
}
body {
padding: 30px;
}
.tabset {
max-width: 65em;
}
<div class="tabset">
<!-- Tab 1 -->
<input type="radio" name="tabset" id="tab1" aria-controls="marzen" checked>
<label for="tab1">Märzen</label>
<!-- Tab 2 -->
<input type="radio" name="tabset" id="tab2" aria-controls="rauchbier">
<label for="tab2">Rauchbier</label>
<div class="tab-panels">
<section id="marzen" class="tab-panel">
<h2>Login page</h2>
</section>
<section id="dunkles" class="tab-panel">
<h2>Sign up</h2>
</section>
</div>
</div>
First, you need your sign in and sign up text to make it buttons and after that you need to make two divs first will contain your sign in section and second sign up section and add at sign up div display: none; and you can use javascript with add event listener to the sign up button, basically when you click on the sign up button your sign in box will disappear and sign up box appear.
Something like that.
let signInButton = document.querySelector(".firstButton");
let signUpButton = document.querySelector(".secondButton");
let signIn = document.querySelector(".firstBox"); // firstBox is the class of sign in div you can add which name you want
let signUp = document.querySelector(".secondBox");
signUpButton.addEventListener("click", () => {
signIn.style.display = "none";
signUp.style.display = "block";
})
signInButton.addEventListener("click", () => {
signUp.style.display = "block";
signIn.style.display = "block";
})
Also you can add some animation to make it smoother.
To make it more clear to you, the classes from querySelector doesn't exist you need to make your own divs with some classes and change with them on the JS code.
You could do it like this using Javascript:
Below your Login Form you add divs around the elements of the Login and Signup Forms, and for the Signup Form you add the attribute style="display:none" to hide it.
<!-- Login Form -->
<div id=loginElements>
<form>
<input type="text" id="login" class="fadeIn second" name="login" placeholder="login">
<input type="text" id="password" class="fadeIn third" name="login" placeholder="password">
<input type="submit" class="fadeIn fourth" value="Log In">
</form>
</div>
<div id=signupElements style="display:none">
<form>
<input type="text" id="signup" class="fadeIn second" name="signup" placeholder="signup">
<input type="text" id="signupPassword" class="fadeIn third" name="signupPassword" placeholder="password" style="display:none">
<input type="submit" class="fadeIn fourth" value="Sign Up">
</form>
</div>
and then you add onclick functions to the tabs titles that changes what is displayed. Example that hides the Login Form and shows the Signup Form:
<h2 class="inactive underlineHover" onclick=showSignUp()>Sign Up </h2>
and implement it like this:
function showSignUp() {
// Hide login form
var loginElements = document.getElementById("loginElements");
loginElements.setAttribute('style', 'display:none');
// Display signup form
var signupElements = document.getElementById("signupElements");
signupElements.setAttribute('style', '');
}
You can implement the function that hides the Signup Form and shows the Login Form similar to this.
Also you probably need to change the classes of the tab titles so that the correct one is displayed as active. This is also very similar to the code above, you just need to give them ids, so you can access the elements with Javascript and then use .setAttribute('class', 'active'); to set the correct class.

my UI goes disturbed when i use <?php echo form_open();?> in CodeIgniter

my web page design remains normal until i write
once i use it, the content portion of the web just disturb code is given below
<?php echo form_open('regform/register');?>
<div class="first">
<fieldset>
<label for="name"><strong>Name:<br /></strong> </label><input type="text" name="name" maxlength="55" id="name" class="inputtext" />
<label for="email"><strong>Email:<br /></strong></label><input type="text" name="email" maxlength="55" id="email" class="inputtext" />
<label for="password"><strong>Password:<br /></strong></label><input type="text" name="password" maxlength="55" id="password" class="inputtext" />
<label for="confirmpass"><strong>Confirm Password:<br /></strong></label><input type="text" name="confirm" maxlength="55" id="confirmpass" class="inputtext" />
<div>
<label for="newsletter"><input type="checkbox" id="newsletter" /><span>Subscribe to newsletter</span></label>
<label class="terms" for="terms"><input type="checkbox" id="terms" /><span>I agree to the Terms and Conditions</span></label>
</div>
</fieldset>
</div>
<div>
<fieldset>
<label for="completename"><strong>Complete name:</strong></label><input type="text" maxlength="55" id="completename" class="inputtext" />
<label for="address"><strong>Primary address:</strong></label><input type="text" maxlength="55" id="address" class="inputtext" />
<label for="billing"><strong>Billing address:</strong></label><input type="text" maxlength="55" id="billing" class="inputtext" />
<label for="city"><strong>City:</strong></label><label class="zipcode" for="zipcode"><strong>Zip Code:</strong></label>
<input type="text" maxlength="30" id="city" />
<input type="text" maxlength="30" id="zipcode" class="zipcode" />
<div>
<label for="shipping"><input type="checkbox" id="shipping" /><span> Same Shipping and Billing address</span></label>
<label class="saveas" for="saveas"><input type="checkbox" id="saveas" /><span> Save as default address</span></label>
</div>
</fieldset>
</div>
<input type="submit" value="" id="createaccount" />
</form>
</div>
this is how it looks after using "php echo form_open"
this is .css file for that portion
content div form div {
background: url(../images/bg-form.jpg) no-repeat;
float: left;
height: 396px;
margin: 0 0 0 24px;
padding: 0;
width: 463px;
}
#content div form div.first {
margin-left: 0;
}
#content div form div fieldset {
border: 0;
margin: 20px auto;
width: 386px;
}
#content div form div fieldset input.inputtext {
background: url(../images/sprites-inputs.gif) no-repeat 0 -42px;
border: 0;
height: 31px;
margin: 10px 0;
padding: 0 5px;
width: 376px;
}
#content div form div fieldset input#city {
background: url(../images/sprites-inputs.gif) no-repeat 0 0;
border: 0;
height: 32px;
margin: 10px 0;
padding: 0 5px;
width: 172px;
}
#content div form div fieldset label.zipcode {
margin-left: 168px;
}
#content div form div fieldset input#zipcode {
background: url(../images/sprites-inputs.gif) no-repeat 0 0;
border: 0;
height: 32px;
margin: 0 0 0 15px;
padding: 0 5px;
width: 172px;
}
#content div form div div {
background: none;
float: none;
height: auto;
margin-left: 0;
margin-top: 33px;
width: auto;
}
i think You have missed classes for the form element
just use it like
echo form_open('your_url', array(
'class' => 'your classes',
'role' => 'role of form'
));

jquery mobile control group with different width of radiobutton input in ui-grid-b

Hello i have a difficulty in setting up the width for the input radio button.
As you can see i'm using a ui-grid-b. the problem here is in the ui-block-c.. where in block-c i'm insert the control group for the radio button. I want to set the width for radio button for id 'full' is 60%, radio button id'half' is 20% and for the radio button id'one' is 20%.. which mean it total 100% that equal to the width for the ui-controlgroup-controls. i want to use the maximum width for the ui-controlgroup-controls with the different width for each radio button
<style>
.ui-grid-b>.ui-block-a {
width: 25%;
}
.ui-grid-b>.ui-block-b, .ui-grid-b>.ui-block-c {
width: 15%;
}
.ui-grid-b>.ui-block-c {
width: 60%;
}
#myGroup {
font-size: 84%;
}
#myGroup .ui-controlgroup-label{
float: none;
display: block;
text-align: center;
width: 100%;
}
#myGroup .ui-controlgroup-label legend{
font-weight: bold;
font-size: 130%;
width: 100%;
margin-bottom: 8px;
}
#myGroup .ui-controlgroup-controls {
float: none;
display: block;
width: 100%;
}
#myGroup .ui-radio{
width: 33.33%;
}
#myGroup .ui-radio label{
text-align: center;
white-space: nowrap;
}
</style>
</head>
<body>
<div data-role="page" id="login">
<div data-role="header" style="background-color:rgba(4, 165, 52, 0.86);">
<h1 align="center">
Header
</h1>
</div>
<div data-role="content" class="content">
<div class="ui-grid-b">
<div class="ui-block-a">
<input type="text" value="Input"/>
</div>
<div class="ui-block-b">
</div>
<div class="ui-block-c">
<div id="myGroup" data-role="fieldcontain">
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="false" data-theme="b" data-corners="false"> <!-- strength -->
<input type="radio" name="full" id="full" value="" />
<label for="full" >Full</label>
<input type="radio" name="half" id="half" value="" />
<label for="radio-view-b" >Half</label>
<input type="radio" name="one" id="one" value="" />
<label for="one" >One</label>
</fieldset>
</div>
</div>
</div>
</div>
<div class="footer" data-role="footer" data-position="fixed">
<h1 align="center"><i>Footer</i></h1>
</div>
</div>

css style for add some space before text

I want to add some space before the text which is in 'content' div tag.
Now all my text are stick to left side.all text in content are sticked into left.
I added margin-left style for p tag. fiddle
I tried
margin-left:10px;
But till having problem.
.sidemenu {
float: left;
margin-top: 150px;
width: 100%;
}
.content {
}
hr {
margin: 0;
width: 1px;
height: 660px;
border: 0;
background: #fff;
float: left;
}
.side{
width: 24%;
float: left;
display: inline-block;
}
.rest {
height: 685px;
background: -o-linear-gradient(bottom, #e5e3e3 5%, #ffffff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #e5e3e3), color-stop(1, #ffffff));
background: -moz-linear-gradient(center top, #e5e3e3 5%, #ffffff 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr="#e5e3e3", endColorstr="#ffffff");
background: -o-linear-gradient(top, #e5e3e3, ffffff);
background-color: #e5e3e3;
border: 1px solid #f9f2f2;
border-width: 0px 0px 0px 0px;
border-radius: 0px 0px 10px 10px;
padding: 0px 7px;
}
.outer {
margin-left: 20%;
margin-top: 3%;
margin-bottom: 3%;
height: 737px;
width: 60%;
box-shadow: 10px 10px 5px #888888;
border: 1px solid #f9f2f2;
border-radius: 10px;
}
p{
margin-left:100px;
}
<div class="outer">
<div class="log">
<h1>Profile</h1>
<form method="post" class="lout" > <button class="logout" name="logout" >Logout</button></form>
</div> <!--End of log div -->
<div class="rest">
<div class="side">
<div class="sidemenu">
<div class="1 menu">
Profile
</div> <!--End of menu1 -->
<div class="2 menu">
Clients
</div> <!--End of menu 2-->
<div class="3 menu">
Employees
</div> <!--End of menu 3-->
<div class="menu 4">
Documents
</div> <!--End of menu 4-->
</div> <!--End of side menu -->
</div> <!--End of side div -->
<hr>
<!-- <div class="heading" >
<h1>Profile</h1>
</div> End of heading div -->
<div class="content">
<?php
include "config.php";
if($ses!='')
{
$sql="select * from register where id=$ses";
$sql1=mysql_query($sql);
$fet=mysql_fetch_assoc($sql1);
$name=$fet['name'];
$email=$fet['email'];
$phone=$fet['phone'];
$cname=$fet['company_name'];
$street=$fet['street'];
$add=$fet['address'];
$city=$fet['city'];
$state=$fet['state'];
$ein=$fet['ein'];
$id=$fet['id'];
}
?>
<form name="profile" method="post">
<p>Name<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $name; ?>"</p>
<p>Email<input type="text" size=20 name="mail" maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $email; ?>"</p>
<p>Phone<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $phone; ?>"></p>
<p>Company name<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $cname;?>"></p>
<p>Street<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $street;?>"></p>
<p>Address<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $add; ?>"></p>
<p>City<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $city;?>"></p>
<p>State<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $state; ?>"></p>
<p>EIN<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $ein;?>"></p>
<a class="change">Change Password</a><br>
<div class="pass">
<br><input type="password" class="textbox" placeholder="Current Password" name="old" id="old" size="20"/><br><br>
<input type="password" class="textbox" placeholder="New Password" name="new" id="new" size="20"><br>
<br><br><br><br><button class="add" name="go" id="go">Go</button><a style="padding-right:2ex;"></a><a class="change"><button class="add" name="cancel" id="cancel">Cancel</button></a>
</div>
<br>
<div class="tri"><button name="edit" class=add>&nbsp&nbspEdit&nbsp</button><button name="add" class="upload" onclick="admin()">Add New</button></div></form>
</div> <!--End of content -->
</div> <!--End of rest div -->
</div> <!--End of outer div-->
you can see the demo here
demo
i have made change in form{padding-left:31%;}
Try the new with top margin
See Demo
in this i modified .rest{margin-top:15%;}
see demo i can add some css
http://jsfiddle.net/Lrh19c50/1/
form[name=profile] p{
padding-left:30%;
}
You want to add some spaces to a div into content class, so you can use .content div as a css selector. That means each div under content class, you can give padding as you want.
.content div { padding-left : 30px; }

Aligning different elements inside div in html

I am new to php.
And i am using following code to show a form
<div class="wrapperReg">
<div id="searchContainer" style="display: inline; margin-top: 20px">
<form>
<label class="ringSetName" style="font-size: 16pt;" >Firstname</label>
<input id="nameBox" style="width:250px; margin-top:10px; margin-left: 30px; height:30px;" name="q" type="text"/>
</form>
</div>
<div id="searchContainer" style="display: inline; margin-top: 20px">
<form>
<label class="ringSetName" style="font-size: 16pt;" >Lastname</label>
<input id="nameBox" style="width:250px; margin-top:10px; margin-left: 30px; height:30px;" name="q" type="text"/>
</form>
</div>
<div id="searchContainer" style="display: inline; margin-top: 20px">
<form>
<label class="ringSetName" style="font-size: 16pt;" >Email</label>
<input id="nameBox" style="width:250px; margin-top:10px; margin-left:30px; height:30px;" name="q" type="text"/>
</form>
</div>
<div id="searchContainer" style="display: inline; margin-top: 20px">
<form>
<label class="ringSetName" style="font-size: 16pt;" >Phone</label>
<input id="nameBox" style="width:250px; margin-top:10px; margin-left: 30px; height:30px;" name="q" type="text"/>
</form>
</div>
<div class="submit" style="display: inline;" style="margin-top: 10px">
<input type="button" value="Submit" class="submit-text"/>
</div>
CSS is as follow
.wrapperReg{
overflow: hidden;
width: 100%;
height: 100%;
}
It is showing stuff as below
How can i align so that all the elements are aligned horizontally inside the main div and The Text should be base aligned and also the Input fileds be vertically aligned to each.
Also Need to place the submit button aligned horizontally too.
How about using float?
label{float: left;}
label + input{float: right;}
And add overflow:hidden to your form. And wrap your form elements in one form.
label {float: left; width: 200px; clear: left}
label + input {float: left; width: 150px}
ID should be unique in whole document, use class for searchContainer.

Categories