I have some PHP code in which is using codeigniter. How can I check validation on the filed that are marked check? My code is below.
Can you please let me know how can I check if item is checked and force the validation accordingly?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/Javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/site.css"></link>
</head>
<body>
<script type="text/Javascript">
$(function () {
$('.checkall').click(function () {
$(this).parents('fieldset:eq(0)').
find(':checkbox').attr('checked', this.checked);
});
});
</script>
<? $attributes = array('class' => '', 'id' => ''); ?>
<? echo form_open('ShoppingListController', $attributes); ?>
<div class="divTable">
<fieldset>
<!-- these will be affected by check all -->
<div class="divRow">Product Name | Quantity | Packages</div>
<div class="divRow"><input type="checkbox" size="100" class="checkall"> Check all</div>
<br>
<?php foreach ($records as $rec) {
?>
<div class="divRow"><input type="checkbox">
<input size="5" type="hidden" value="<? echo $rec->id; ?>" name="id"></input>
<input size="20" type="text" value="<? echo $rec->name; ?>" name="name"></input>
<label for="quantity">Value <span class="required">*</span></label>
<span class="required"><?php echo form_error('quantity'); ?></span>
<input size="5" type="text" value="" name="quantity"></input>
<select name="package">
<option name="case">Case</option>
<option name="box">Box</option>
<option name="box">Single Bottle</option>
</select>
</div>
<br>
<?
}
?>
</fieldset>
</div>
<div><input type="submit" name="submit"/></div>
</form>
</body>
you can use code below:
var divRows = $('.divRow');
var count = divRows.length;
divRows.each(function() {
if ($(this).find('input[type=checkbox]').is(':checked')) {
count--;
}
});
if (count != 0) {
alert(count + ' checkboxes not checked');
}
http://jsfiddle.net/SKgA8/
Related
This question already has an answer here:
PHP form - if honeypot input field is filled - redirect to another page
(1 answer)
Closed 9 months ago.
I have a 2-page form to gather potential client data, and using a honeypot field to stop spam from entering our database table.
The code inserts the data into the table, so that is not an issue.
What I want to have happen is if the honeypot field is NOT NULL, then I want it to redirect to the noway.html file. Otherwise, redirect to the home.html file.
index.php:
<?php
session_start();
require_once 'config/config.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Purchase Form | HomePromise</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie#2/src/js.cookie.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../../assets/css/style.css" />
</head>
<body>
<div class="container box">
<h2 class="page-title" align="center">Purchase Form</h2><br />
<form method="post" id="refi_form" action="index2.php">
<div class="tab-content" style="margin-top:16px;">
<div class="tab-pane active" id="fins_details">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-group">
<!-- Refi label: <label>What's the value of your home?</label> -->
<input type="hidden" name="branch" id="branch" class="form-control" value="Army" />
</div>
<div class="form-group">
<label>What is the sales price of your home?</label>
<select name="salesprice" id="salesprice" class="form-control">
<option value="">Select One</option>
<option value="75000">50,000 - 99,999</option>
<option value="150000">100,000 - 199,999</option>
<option value="250000">200,000 - 299,999</option>
<option value="350000">300,000 - 399,999</option>
<option value="450000">400,000 - 499,999</option>
<option value="550000">500,000 - 599,999</option>
<option value="650000">600,000 - 699,999</option>
<option value="700000">Over 700,000</option>
<span id="error_salesprice" class="text-danger"></span>
</select>
</div>
<div class="form-group">
<label>What loan amount do you want?</label>
<select name="loan_amount" id="loan_amount" class="form-control">
<option value="">Select One</option>
<option value="75000">50,000 - 99,999</option>
<option value="150000">100,000 - 199,999</option>
<option value="250000">200,000 - 299,999</option>
<option value="350000">300,000 - 399,999</option>
<option value="450000">400,000 - 499,999</option>
<option value="550000">500,000 - 599,999</option>
<option value="650000">600,000 - 699,999</option>
<option value="700000">Over 700,000</option>
<span id="error_loan_amount" class="text-danger"></span>
</select>
</div>
<div class="form-group">
<label>What is your yearly income?</label>
<select name="income" id="income" class="form-control">
<option value="">Select One</option>
<option value="25000">Under 25k</option>
<option value="37000">25k - 49k</option>
<option value="62000">50k - 74k</option>
<option value="87000">75k - 99k</option>
<option value="125000">100k - 149k</option>
<option value="175000">150k - 200k</option>
<option value="200000">Over 200k</option>
<span id="error_income" class="text-danger"></span>
</select>
</div>
<br />
<div align="right">
<input type='submit' name='save' id='btn_fins_details' style="background-color:rgb(50,50,200);color:#fff;font-size:1.5em;padding:10px;" value="Next">
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</body>
<script src="../assets/js/script.js"></script>
</html>
index2.php (Note: I am only echoing the values to verify that the honeypot and other values are being stored in their sessions.):
<?php
session_start();
$_SESSION['branch'] = $_POST['branch'];
$_SESSION['salesprice'] = $_POST['salesprice'];
$_SESSION['loan_amount'] = $_POST['loan_amount'];
$_SESSION['income'] = $_POST['income'];
$_SESSION['formurl'] = $_SERVER['HTTP_REFERER'];
echo $_SESSION['branch']; ?><br><?php
echo $_SESSION['salesprice']; ?><br><?php
echo $_SESSION['loan_amount']; ?><br><?php
echo $_SESSION['income']; ?><br><?php
echo $_SESSION['formurl']; ?><br><?php
$client_url = $_POST['client_url'];
require_once 'config/config.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Refinance Form | HomePromise</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../../assets/css/style.css" />
</head>
<body>
<div class="container box">
<br />
<h2 class="page-title" align="center">Purchase Form</h2><br />
<form method="post" id="refi_form" action="submit.php">
<div class="tab-content" style="margin-top:16px;">
<div class="tab-pane active" id="fins_details">
<div class="panel panel-default">
<div class="panel-body">
<table class="center">
<tr>
<td class="left">
<div class="form-group">
<label>First Name</label>
<input type="hidden" name="formurl" value="<?php echo $_SESSION['formurl']; ?>">
<input type="hidden" name="client_url" value="<?php echo $_SESSION['client_url']; ?>">
<input type="hidden" name="ip" value="<?php echo $_SESSION['ip']; ?>"></input>
<input type="hidden" name="branch" value="<?php echo $_SESSION['branch']; ?>"></input>
<input type="hidden" name="salesprice" value="<?php echo $_SESSION['salesprice']; ?>"></input>
<input type="hidden" name="loan_amount" value="<?php echo $_SESSION['loan_amount']; ?>"></input>
<input type="hidden" name="income" value="<?php echo $_SESSION['income']; ?>"></input>
<input type="hidden" name="transaction_type" id="transaction_type" value="Purchase">
<input type="text" name="fName" id="fName" class="form-control" />
<span id="error_fName" class="text-danger"></span>
</div>
</td>
</tr>
</table>
<br />
<div class="text-message" style="display: block;">
<p>By clicking submit below, I/we acknowledge that I/we have read and agree to the User Agreement and acknowledge that I/we have read the Privacy Statement, and Disclosures.</p>
<br />
</div>
<div align="right">
<input type='submit' name='save' id='btn_personal_details' style="background-color:rgb(50,50,200);color:#fff;font-size:1.5em;padding:10px;" value="Submit">
</div>
</div>
</div>
</div>
</form>
</div>
</body>
<script src="..assets/js/script.js"></script>
</html>
submit.php:
<?php
session_start();
$_SESSION['branch'] = $_POST['branch'];
require_once 'config/config.php';
if (isset($_POST['client_url']) && $_POST['formurl'] && $_POST['ip'] && $_POST['salesprice'] && $_POST['loan_amount'] && $_POST['transaction_type'] && $_POST['fName'] && (empty($_POST['branch']))) {
$client_url = $_POST['client_url'];
$formurl = $_POST['formurl'];
$ip = $_POST['ip'];
$salesprice = $_POST['salesprice'];
$loan_amount = $_POST['loan_amount'];
$income = $_POST['income'];
$transaction_type = $_POST['transaction_type'];
$fName = $_POST['fName'];
$sql = "INSERT INTO whp (client_url, formurl, ip, salesprice, loan_amount, income, transaction_type, fName) VALUES ('$client_url', '$formurl', '$ip', '$salesprice', '$loan_amount', '$income', '$transaction_type', '$fName')";
$db_con->exec($sql);
header("Location: home.html");
} else {
header("Location: noway.html");
}
?>
Create your honeypot input (name can be whatever, in my example I'm using honeypot).
if (empty($_POST['honeypot'])){
Add that just after the $sql string is set (or just before).
empty will return true if the variable is undefined or set to false. In terms of a POST value, that means it will be true if the POST value is not set or is blank (and you should trigger home.html). If it's filled, it it will return false and you should trigger the else noway.html.
I the below script does not work. I am trying to pass values generated using a jquery function to php. when I run this code it. The form slides to the right, but no values are encoded. I am thinking I am doing something simple wrong.
<!DOCTYPE html>
<html>
<head>
<title>Target Example</title>
<?php
$x = $_POST['total'];
echo $x;
?>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.css" />
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.js"></script>
<script>
$(document).ready(function() {
function compute() {
var a = $('#a').val();
var b = $('#b').val();
var total = a * b;
$('#total').val(total);
}
$('#a, #b').change(compute);
});
</script>
</head>
<body>
<form action="<?php echo $PHP_SELF;?>" method="post">
<div data-role="page" id="irr">
<div data-role="header">
<h1>Calculation</h1>
</div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="a">Diameter:</label>
<input type="number" name="a" id="a" value="" />
<label for="b">Diver:</label>
<input type="number" name="b" id="b" value="" />
<label for="total">Result:</label>
<input type="text" name="total" id="total" value="" />
<input type="submit">
</div>
What did we do here?
</div>
</div>
</form>
</body>
</html>
Your form action was not set correctly. Use $_SERVER['SCRIPT_NAME'] instead. Also, I used the short hand echo feature in case you are wondering. Hopefully that fixes it for you :)
<!DOCTYPE html>
<html>
<head>
<title>Target Example</title>
<?php
$x = $_POST['total'];
echo $x;
?>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.css" />
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.js"></script>
<script>
$(document).ready(function() {
function compute() {
var a = $('#a').val();
var b = $('#b').val();
var total = a * b;
$('#total').val(total);
}
$('#a, #b').change(compute);
});
</script>
</head>
<body>
<form action="<?=($_SERVER['SCRIPT_NAME'])?>" method="post">
<div data-role="page" id="irr">
<div data-role="header">
<h1>Calculation</h1>
</div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="a">Diameter:</label>
<input type="number" name="a" id="a" value="" />
<label for="b">Diver:</label>
<input type="number" name="b" id="b" value="" />
<label for="total">Result:</label>
<input type="text" name="total" id="total" value="" />
<input type="submit">
</div>
What did we do here?
</div>
</div>
</form>
</body>
</html>
I'm trying to create an update form. When I send the form it shows me that the variable person has not been defined. It's important to say that this variable contains the information obtained in the first query that is used to fill out the first table.
So far everything works well. However, when the user presses the button modify, a message saying that the variable person has not been defined. When i try to re-use the variable serial in the last query it tells me that isn't defined either. I don't really know why if i did at the beginning of the script.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CTE Modificar Registro</title>
<?php
include "conexiondblocal.php";
if(!isset($_POST['submit'])){
$serial = mysqli_real_escape_string($con,$_GET['numeroorden']);
$qry= "SELECT * FROM producto WHERE numeroorden = $serial";
$muestra = mysqli_query($con,$qry);
$person=$muestra->fetch_array();
}
?>
<style type="text/css">
#cuerpo form table {
text-align: center;
}
</style>
<link href="../CTE/estilospaginas.css" rel="stylesheet" type="text/css">
<style type="text/css">
body {
background-color: #FFF;
}
</style>
</head>
<body>
<div id="cuerpo">
<script>
$( "#entregaacliente,#fecharecepcion").datepicker();
</script>
<div id="formulario">
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<div> <label for="inputproducto">Producto</label> <input name="inputproducto"type="text" class="tabla" id="producto" value = "<?php echo $person['producto']; ?>" />
</div>
<div> <label for="inputproducto">Orden número</label> <input name="inputcedula"type="text" class="tabla" id="inputcedula" value = "<?php echo $person['cedula']; ?>" />
</div>
<div> <label for="inputtipodeservicio">Cedula</label> <input name="inputtipodeservicio"type="text" id="inputtipodeservicio" value = "<?php echo $person['tipodeservicio']; ?>" />
</div>
<div> <label for="inputnumeromarca">Numero de Marca</label> <input name="inputnumeromarca"type="text" id="inputnumeromarca" value = "<?php echo $person['numeromarca']; ?>" />
</div>
<div> <label for="inputmarca">Marca</label> <input name="inputmarca"type="text" id="inputmarca" value = "<?php echo $person['marca']; ?>" />
</div>
<div> <label for="inputtelefono">Modelo</label> <input name="inputmodelo"type="text" id="inputmodelo" value = "<?php echo $person['modelo']; ?>" /> </div>
<div> <label for="inputproducto">Almacen</label> <input name="inputalmacen"type="text" id="inputalmacen" value = "<?php echo $person['almacen']; ?>" /> </div>
<div> <label for="inputmarca">Dano</label> <input name="inputdano"type="text" id="inputdano" value = "<?php echo $person['dano']; ?>" /> </div>
<div> <label for="inputfecharecepcion">Fecha de Recepción</label> <input name="inputfecharecepcion"type="text" id="inputfecharecepcion" value = "<?php echo $person['fecharecepcion']; ?>" />
</div>
<div> <label for="inputfecharecepcion">Técnico</label>
<textarea name="inputtecnico" cols="30" id="inputtecnico" /><?php echo $person['tecnico']; ?>
</textarea> </div>
<div> <label for="inputestado">Estado</label> <select name="inputestado"type="text"value = "<?php echo $person['estado']; ?>" id="inputestado"> <option>Reparado </option>
<option>Pendiente </option>
<option>Entregado</option>
</select> </div>
<div> <label for="inputsede">Sede</label> <select name="inputsede"value = "<?php echo $person['sede']; ?>"type="text" id="inputsede"> <option>Centro </option>
<option>Calipso </option>
</select> </div>
<div> <label for="inputentregaacliente">Entrega a Cliente</label> <input name="inputentregaacliente"type="text" id="inputentregaacliente" value = "<?php echo $person['entregaacliente']; ?>" /> </div>
<div id="enviarboton">
<input type = "submit" name = "submit" value= "Modificar"/>
</div>
<input type="hidden" name="numeroorden" value="<?php echo $serial;?>"/>
</form>
</div>
<?php
if (isset($_POST['submit'])){
$producto=
"UPDATE producto
SET producto = '$_POST[inputproducto]',
cedula = '$_POST[inputcedula]',
tipodeservicio = '$_POST[inputtipodeservicio]',
numeromarca = '$_POST[inputnumeromarca]',
marca = '$_POST[inputmarca]',
modelo = '$_POST[inputmodelo]',
almacen = '$_POST[inputalmacen]',
dano = '$_POST[inputdano]',
fecharecepcion = '$_POST[inputfecharecepcion]',
tecnico = '$_POST[inputtecnico]',
estado = '$_POST[inputestado]',
sede = '$_POST[inputsede]',
entregaacliente = '$_POST[inputentregaacliente]',
numeroorden = '$_POST[numeroorden]'
WHERE numeroorden = $serial";
mysqli_query($con,$producto);
echo "El usuario ha sido modificado";
}
?>
</body>
</html>
<?php
include('config.php');
$query_parent = mysql_query("SELECT * FROM categories") or die("Query failed: ".mysql_error());
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Dependent DropDown List</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#parent_cat").change(function() {
$(this).after('<div id="loader"><img src="img/loading.gif" alt="loading subcategory" /></div>');
$.get('loadsubcat.php?parent_cat=' + $(this).val(), function(data) {
$("#sub_cat").html(data);
$('#loader').slideUp(200, function() {
$(this).remove();
});
});
});
});
</script>
</head>
<body>
<form method="get">
<label for="category">Parent Category</label>
<select name="parent_cat" id="parent_cat">
<?php while($row = mysql_fetch_array($query_parent)): ?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['category_name']; ?></option>
<?php endwhile; ?>
</select>
<br/><br/>
<label>Sub Category</label>
<select name="sub_cat" id="sub_cat"></select>
<td><label>
<input type="submit" name="button" id="button" value="Search" />
</label></td>
</form>
</body>
</html>
/the above is the index.php file.
after I click search button, I want some data to be displayed depending on the selections made at 2 drop down lists. and the data should be fetched from the database../
this is my form, my input reset don't reset all my input and submit don't send my form,
when I press input reset it doesn't work and dont know why and the same happening with submit
what should i do??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Agregar Publicidad</title>
<link rel="stylesheet" type="text/css" href="../css/EstiloLocales.css"/>
<link rel="stylesheet" type="text/css" href="../libs/css/ui-lightness/jquery-ui-1.8.18.custom.css"/>
<script src="../libs/js/jquery-ui-1.8.18.custom.min.js" type="application/javascript"></script>
<script src="../libs/js/jquery-1.7.1.min.js" type="application/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.checkin').click(function(){
var labelId = $(this).attr('name');
var colorActual = $('#'+labelId).css('color');
var checkeo = $(this).attr('checked');
$('#COLOSH').val(checkeo);
if(checkeo == 'checked'){
$('#'+labelId).css('color','#f00');
}else{
$('#'+labelId).css('color','#000');
}
var n = $("input:checkbox").length;
var str = '';
for(var cj=1; cj < n; cj++){
var check = document.getElementById(cj+'1').checked;
if(check == true){
str += cj+' ';
}
}
$('#myArr').val(str);
});
});
function cargarCategorias(cadena){
var ar= cadena.split(" ");
if(ar.length < 3){
$('#'+ar+'1').prop("checked", true);
$('#label'+ar).css("color", "#f00");
}else{
ar = ar.split(' ');
for(var i=0;i < ar.length; i++){
$('#'+ar[i]+'1').prop("checked", true);
$('#label'+ar[i]).css("color", "#f00");
}
}
}
function porDefecto(){
$('.label').css('color','#000');
//$(':input').attr('value','');
//$('#descripcion').attr('value','');
}
function loaddefimages(Id)
{
//this.src='../Info/Fotos/fotogenerica.jpg
document.getElementById(Id).src="../Info/Fotos/fotogenerica.jpg";
}
</script>
</head>
<body>
<?php
include "../src/defines.php";
$numero = $_GET['numero'];
$doc = new DOMDocument;
$doc->load(DIR_LOCALES);
$xpath = new DOMXPath($doc);
$elements = $xpath->query('//item[#numero="'.$numero.'"]');
//if ($elements->length >= 1) {
$element = $elements->item(0);
$ar = buscar_categorias( $element->getAttribute('nombre'),DIR_PUBLICIDADES);
if($ar != ''){
$t= implode(' ',$ar);
?>
<script language="javascript">
var cadena = <?php echo $t;?>
cargarCategorias(cadena);
</script>
<?php
}
// }
?>
<form id="form1" name="form1" enctype="multipart/form-data" method="post" action="add_local.php">
<input type="hidden" id="myArr" name="myArr" value="">
<input type="hidden" id="oldvalue" name="oldvalue" value="">
<input type="hidden" id="accion" name="accion" value="1">
<input type="hidden" id="oldName" name="oldName" value="">
<div class="div_principal">
<div class="contenido">
<div class="contenido-uno">
<div class="datos"><!--BEGIN DATOS -->
<div class="datos-uno"><!--BEGIN DATOS UNO -->
<div>
<label for="nombre">Nombre</label>
<input name="nombre" type="text" id="nombre" maxlength="21" style="margin-left:15px;" value="<?php if($element->getAttribute('nombre') == ''){ echo "NO ASIGNADO";}else{echo $element->getAttribute('nombre');} ?>" />
</div>
<div>
<label for="telefono">Teléfono</label>
<input type="text" name="telefono" id="telefono" style="margin-left:10px;" value="<?php if($element->getAttribute('telefono') == ''){ echo "NO ASIGNADO";}else{echo $element->getAttribute('telefono');} ?>"/>
</div>
<div>
<label for="web">Web</label>
<input type="text" name="web" id="web" value="<?php if($element->getAttribute('web') == ''){ echo "NO ASIGNADO";}else{echo $element->getAttribute('web');} ?>" />
</div>
<div>
<label for="correo">Correo:</label>
<input type="text" name="correo" id="correo" value="<?php if($element->getAttribute('correo') == ''){ echo "NO ASIGNADO";}else{echo $element->getAttribute('correo');} ?>"/>
</div>
<div>
<label for="encargado">Encargado</label>
<input type="text" name="encargado" id="encargado" value="<?php if($element->getAttribute('encargado') == ''){ echo "NO ASIGNADO";}else{echo $element->getAttribute('encargado');} ?>"/>
</div>
</div><!--END DATOS UNO -->
<div class="datos-dos"><!--BEGIN DATOS DOS -->
<div>
<label for="numero">Número</label>
<input type="text" disabled="disabled" style="margin-left:30px;" name="numero" id="numero" value="<?php echo $element->getAttribute('numero') ?>" />
</div>
<div>
<div>
<label for="descripcion"> Descripción</label>
</div>
<div style=" position:relative; top:-20px; left:100px;">
<textarea name="descripcion" id="descripcion" style="width:240px; height:100px;" ><?php if($element->getAttribute('descripcion') == ''){ echo "NO ASIGNADO";}else{echo $element->getAttribute('descripcion');} ?></textarea>
</div>
</div>
<div>
<label for="promocion">Promoción</label>
<input type="text" name="promocion" id="promocion" value="<?php if($element->getAttribute('promocion') == ''){ echo "NO ASIGNADO";}else{echo $element->getAttribute('promocion');} ?>" style="margin-left:15px;" />
</div>
</div>
</div><!-- FIN DATOS -->
<div class="imagenes"><!-- BEGIN IMAGENES -->
<div class="ima-uno">
<div class="div-foto">
<img id="foto" onerror="javascript:loaddefimages(this.id);" src="../Info/Fotos/Localimg/<?php echo strtolower($element->getAttribute('numero').'jpg'); ?>" alt="Foto" name="foto" width="310" height="115" />Imagen 297 x 110 px
</div>
<div class="div-btn">
<img src="../src/Img/paneldecontrol-15.png" width="23" height="23" style="position:absolute;" />
<input style="width:67px; z-index:2; opacity:0;" type="file" name="dir_foto" />
</div>
</div>
<div class="ima-dos">
<div class="div-logo">
<img id="logo" src="../Info/Fotos/logos/<?php echo strtolower($element->getAttribute('numero').'png'); ?>" onerror="javascript:loaddefimages(this.id);" alt="logo" width="150" height="115" /></div>
<div class="div-btn-logo">
<img src="../src/Img/paneldecontrol-15.png" width="23" height="23" style="position:absolute;" />
<input style="width:67px; z-index:2; opacity:0;" type="file" name="dir_logo" />
</div>
</div>
</div>
</div>
<div class="contenido-dos">
<div class="div_cat">
<?php
$docCat = new DomDocument;
$docCat->preserveWhiteSpace = FALSE;
$docCat->load(DIR_CATEGORIAS);
$parCat = $docCat->getElementsByTagName('categoria'); // Find Sections
$contador=0;
foreach($parCat as $parametro){
?>
<div>
<input id="<?php echo $parCat->item($contador)->getAttribute('id'); ?>1" class="checkin" type="checkbox" name="label<?php echo $parCat->item($contador)->getAttribute('id'); ?>" />
<label id="label<?php echo $parCat->item($contador)->getAttribute('id'); ?>" class="label" for="a"><?php echo $parCat->item($contador)->getAttribute('nombre'); ?></label>
</div>
<?php
$contador++;
}
?>
</div>
<div class="form-buttons">
<img src="../src/Img/paneldecontrol-17.png" width="23" height="23" style="position:absolute; left: 2px; top: 1px;" />
<input type="reset" onclick="javascript:porDefecto();" style=" z-index:2; width:25px; margin-right:7px; height:23px; opacity:0; " value="Limpiar" />Limpiar campos
<input type="submit" value="Guardar" style="margin-left:30px; margin-right:7px; width:27px; height:23px; z-index:3; opacity:0; " />Guardar
<img src="../src/Img/paneldecontrol-16.png" width="23" height="23" style="position:absolute; left: 152px; top: 1px;" />
</div>
</div>
</div>
</div>
</form>
</body>
</html>
div form-buttons has the input that doesn't work
Your 'reset' has an 'onclick' event, which is wrong. I bet that prevents the reset..
Some of the input elements are disabled, and I doubt wether disabled elements are posted.
For the generated elements, I think it's best to load your page and check the output (the generated source). I will tell you more easily if there's any error in the PHP code, than staring at the PHP source.