full code here : https://codepen.io/asmoun0801/pen/mGegjw
<div class="">
<p>Certifiée :</p>
<!-- Rounded switch -->
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
</div>
If I'm getting this right, you should place the <input> element inside a
<form method="POST" action=""> ... </form>
element in order to be able to POST it to a PHP server. Also you should set the name attribute of the input field.
css : https://codepen.io/asmoun0801/pen/eLJOXg
solution html :
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php if(isset($_POST['cert'])){
echo $cert[0] ;
}
?>
<form action="action.php" method="post">
<div class="">
<p>Certifiée :</p>
<!-- Rounded switch -->
<label class="switch">
<input type="checkbox" name="cert[]" value="true">
<span class="slider round"></span>
</label>
</div>
</form>
</body>
</html>
Related
I just want to simply echo 'OK!' when the input with type="button" name="calculateBtn" is clicked on, but PHP does not recognize that with the condition if (isset($_POST['calculateBtn'])) so wouldn't do anything, can somebody please tell me why is that?
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="row">
<form action="" method="post">
<div>
<input id="input" type="text">
<?php
if (isset($_POST['calculateBtn'])) {
echo 'ok';
}
?>
<input name="calculateBtn" value="change the value" type="button">
</div>
</form>
</div>
</div>
</body>
</html>
First, you don't have an action defined in the form, second the button type is set as a button instead of submit, it will not submit the form.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="row">
<form action="page.php" method="post">
<div>
<input id="input" type="text">
<?php
if (isset($_POST['calculateBtn'])) {
echo 'ok';
}
?>
<input name="calculateBtn" value="change the value" type="submit">
</div>
</form>
</div>
</div>
</body>
</html>
please set the page.php to the name of your page(file).
below is the original code, and
<html>
<head>
<title>slider</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="slider-container">
<form action="asd.php" method="GET">
<input type="range" min="0" max="10" value="5" id="slider">
</form>
<div id="selector">
<div class="SelectBtn1"></div>
<div id="SelectValue"></div>
</div>
<div id="Progressbar"></div>
</div>
<div class="nextcontainer">
Result »
</div>
the asd.php
<body>
<div class="result-head">
<h1 class="main-title ng-binding">Your excrement..</h1>
</div>
<div class="result-container">
<h1 class="area">can support annually<?php echo $_REQUEST['slider'];?></h1>
</div>
</body>
I made html file and php file, and I tried to get response from the survey and try to show it in the next page(asd.php)
However, when I input and surf the next page, it shows pure code like the picture. What did I do wrong?
You have to use the attribute name instead of the attribute id because that is how it is passed on. For example you could do
<html>
<head>
<title>slider</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="slider-container">
<form action="asd.php" method="GET">
<input type="range" min="0" max="10" value="5" id="slider" name="slider">
</form>
<div id="selector">
<div class="SelectBtn1"></div>
<div id="SelectValue"></div>
</div>
<div id="Progressbar"></div>
</div>
<div class="nextcontainer">
Result »
</div>
I m following the video demo and i can't get the result like video demo..
my code is as follows:
<!DOCTYPE html>
<html ng-app>
<head>
<title>Angular Practice</title>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js" >
</script>
</head>
<body ng-controller="TodosController">
<div>
<label for="name"> Name: </label>
<input type="text" ng-model="name" />
<hr>
<h1> Hello {{name}} </h1>
</div>
</body>
</html>
and my output is
enter image description here
Remove the ng-controller="TodosController". You haven't specified any controllers here!
<!DOCTYPE html>
<html ng-app>
<head>
<title>Angular Practice</title>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js" >
</script>
</head>
<body>
<div>
<label for="name"> Name: </label>
<input type="text" ng-model="name" />
<hr>
<h1> Hello {{name}} </h1>
</div>
</body>
</html>
I want to submit an app using phonegap, My app uses a lot of php which i know apple do not like so much and just decline the app and say its best to have a web app. I have an example index.html here
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>
</title>
<link rel="stylesheet" href="css/logout-button.min.css" />
<link rel="stylesheet" href="css/jquery.mobile-1.3.0.min.css" />
<link rel="stylesheet" href="css/my.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</script>
<script src="js/jquery.mobile-1.3.0.min.js"></script>
<script src="js/jquery.cookies.2.2.0.min.js"></script>
<script type="text/javascript">
var uid = $.cookies.get( 'uid' );
if(uid == null)
{
window.location ='account-login.html'; }
else
{ }
</script>
</head>
<body>
<div data-role="page" id="index4">
<div data-theme="a" data-role="header">
<a data-role="button" data-direction="reverse" data-rel="back" data-transition="slide"
data-icon="arrow-l" data-iconpos="left" class="ui-btn-left">
Back
</a>
<h3>
Event Details
</h3>
</div>
<div data-role="content">
<form id="eventForm" name="eventForm">
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="event">
Event
</label>
<input name="eventname" id="eventname" placeholder="eventname" value="" type="text" />
</fieldset>
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="about">
About
</label>
<textarea name="about" id="about" placeholder="about" value=""></textarea>
</fieldset>
</div>
<div data-role="fieldcontain">
<label for="dates">
Choose Dates
</label>
<div id="with-altField"></div>
<input type="hidden" id="altField" name="dates">
</fieldset>
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="enddate">
End Date
</label>
<div id="with-altfield1"></div>
<input type="hidden" id="altField1" name="enddate">
</fieldset>
</div>
<div data-role="fieldcontain">
<script>
$.get('event-details.php', function(data){
$('#yourdiv').html(data);
});
</script>
<div id="yourdiv"></div>
</div>
<div data-role="fieldcontain">
<label for="manual">Add Emails</label>
<textarea cols="40" rows="8" name="emails" id="emails"></textarea>
</div>
<input type="submit" value="Submit" id="submitEventButton">
</form>
</div>
</div>
</body>
</html>
I call event-details.php here
<?
require_once("../backend/functions.php");
dbconn();
$id = $CURUSER["id"];
$res = "SELECT username,email,status FROM users left join cal_contacts on cal_contacts.contactid = users.id WHERE cal_contacts.userid = $id";
$res1 = mysql_query($res);
?>
<label for="select-choice-1" class="select">
Choose Contacts:
</label>
<select name="contacts[]" id="contacts" multiple="multiple" data-native-menu="false">
<?
while($row = mysql_fetch_array($res1))
{
print "<option value=$row[email]>$row[email] ($row[status])</option>";
}
?>
</select>
<?
I have the select-menu created through php. I was wondering if there was another way to do this so the complete select html doesn't have to be on the php script. This would mean that it would be harder for me to change my app once submitted and i'm sure apple would accept it alot easier.
If your problem is just to remove the PHP processing on that HTML, you could just move it somewhere else as a web service then get it via ajax request. Then you can just use json, etc. to fetch the data and populate your select menu.
here is a doc on jquery! regarding how to make ajax requests.
i found a tutorial here which seem similar on what you want to achieve.
How To Write A Simple PHP/MySQL Web Service for an iOS App!
Okay.. this is the file lo_add.php:
<div class="rowElem">
<label>Item <? echo $i ?>:</label>
<div class="formRight searchDrop">
<select name="lo_item[]" class="chzn-select" data-placeholder="Choose an Item">
<option value=""></option>
<? $item_query = mysql_query("select id,code,title,price from items where domain_id='$domain_id' order by code");
while ($items = mysql_fetch_array($item_query)) { ?>
<option value="<? echo $items["id"] ?>"><? echo $items["code"]." - ".$items["title"]." - RM".$items["price"] ?></option>
<? } ?>
</select>
</div>
<label>Delivery Address :</label>
<div class="formRight searchDrop">
<select name="lo_site[]" class="chzn-select" data-placeholder="Choose a Delivery Address">
<option value=""></option>
<? $site_query = mysql_query("select id,name from sites where domain_id='$domain_id' order by name");
while ($sites = mysql_fetch_array($site_query)) { ?>
<option value="<? echo $sites["id"] ?>"><? echo $sites["name"] ?></option>
<? } ?>
</select>
</div>
<div class="fix"></div>
<label>Quantity:<span class="req">*</span></label>
<div class="formRight onlyNums">
<input type="text" name="lo_quantity[]" id="lo_quantity[]"/>
</div>
<div class="fix"></div>
</div>
And this is the html file that calls the css and what have you in the beginning:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>Mecacom Technologies® Maintenance System © 2012</title>
<link href="/css/main.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Cuprum' rel='stylesheet' type='text/css' />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#addElement').click(function() {
var data = '';
$.get('/ajax/lo_add.php', data, function(response){
$('#hello').append(response);
});
});
});
</script>
</head>
<body>
<div class="content" id="container">
<div class="title"><h5>Record New Local Order</h5></div>
<form action="<? echo $PHP_SELF ?>?add=1" id="valid" class="mainForm" method="post" enctype="multipart/form-data">
<fieldset>
<div class="widget">
<div class="head"><h5 class="iLocked2">New Local Order Credentials</h5></div>
<div class="rowElem noborder">
<label>Order ID:<span class="req">*</span></label>
<div class="formRight">
<input type="text" class="validate[required]" name="order_id" id="order_id"/>
</div>
<div class="fix"></div>
</div>
<div class="rowElem noborder">
<label>Order Date:<span class="req">*</span></label>
<div class="formRight">
<input type="text" name="order_date" class="datepicker validate[required]" />
</div>
<div class="fix"></div>
</div>
<div id="hello"></div>
<div class="fix"></div>
Click To Append More Item
<input type="submit" value="Next" class="greyishBtn submitForm" />
<div class="fix"><input type="hidden" name="addnow" value="1" /></div>
</div>
</fieldset>
</form>
</div>
</body>
</html>
sigh .. quite a handful ... How do you think that the css aren't being rendered correctly after the jquery append?
I can see from your live test page that you are using Chosen to process the dropdowns and jQuery validation plugin to validate the quantity field.
The first thing is to make sure you call chosen() on the newly created dropdowns. This has to be called for new elements, because Chosen doesn't only rely on CSS, but changes the entire HTML structure of the dropdowns. So add this line, following your append,
$(".chzn-select").chosen()
Second is to make sure you validate the newly created quantity textfields by calling validate() on them, or re-calling whatever javascript you called to initialize the validate plugin.