Sistema Complexo
Olá Galera da IMASTERS,
Hoje venho tirar uma dúvida que estou a meses a trabalhar nisso e não consigo, sou novo na area de php porém gostaria que me ajudassem com esse sistema primeiramente deixa eu explicar para que servirá o sistema.
O sistema
O objetivo do sistema é fazer com que os usuarios cadastrados através do pedido nº de série e etc possam estar verificando a senha do aparelho através da pagina de busca bastando apenas digitar o "Número de série", após isso mostrará os resultados para o cliente se o campo parcela estiver marcado como sim(pelo adiministrador) a senha é visualizada caso contrario não mostrará a senha do aparelho.
Porém na hora do formulário de cadastro estou encontrando uma grande dificuldade de fazer com que o campo "N. de série" ao ser replicado por um botão de "+" agregue o valor que o usuario digitou acrescido de +1 exemplo;
se no campo Número de série o internauta digitar 0001 logo após ele clicar em + o campo deverá aparecer da seguinte maneira "0002" e assim sucessivamente junto com o value do campo acrescido de "+1".
Irei colocar o formulário aqui para que possam me ajudar se possivel galera. Aguardo por vocês;
----------------------------------------[b]Form[/b]---------------------------------------------
<?php require_once('../../Connections/gerador.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""){
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO geradorkey (nserie, parcela1, parcela2, parcela3, parcela4, parcela5, parcela6, equipamento, pedido, nota, cliente, senha1, senha2, senha3, senha4, senha5, senha6, data_emissao) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nserie'], "text"),
GetSQLValueString($_POST['parcela1'], "text"),
GetSQLValueString($_POST['parcela2'], "text"),
GetSQLValueString($_POST['parcela3'], "text"),
GetSQLValueString($_POST['parcela4'], "text"),
GetSQLValueString($_POST['parcela5'], "text"),
GetSQLValueString($_POST['parcela6'], "text"),
GetSQLValueString($_POST['equipamento'], "text"),
GetSQLValueString($_POST['pedido'], "text"),
GetSQLValueString($_POST['nota'], "text"),
GetSQLValueString($_POST['cliente'], "text"),
GetSQLValueString($_POST['senha1'], "text"),
GetSQLValueString($_POST['senha2'], "text"),
GetSQLValueString($_POST['senha3'], "text"),
GetSQLValueString($_POST['senha4'], "text"),
GetSQLValueString($_POST['senha5'], "text"),
GetSQLValueString($_POST['senha6'], "text"),
GetSQLValueString($_POST['data_emissao'], "text"));
mysql_select_db($database_gerador, $gerador);
$Result1 = mysql_query($insertSQL, $gerador) or die(mysql_error());
$insertGoTo = "cadastrado.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><!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><!-- inseri mais campos de número de série-->
<script type="text/javascript">
function inserircampo() {
var obj = document.createElement("input");
obj.setAttribute("type","text");
obj.setAttribute("id","novo_campo");
obj.setAttribute("maxLenght","100");
obj.setAttribute("value","Isso é um campo");
var td = document.getElementById("meu_campo");
td.insertBefore(obj);
}
</script>
<!-- fim do script de inserir novos campos ao numero de série -->
<link rel=”stylesheet” type=”text/css” href=”calendario.css” />
<script src="calendario.js" > </script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gerador de senhas</title>
<style type="text/css"><!--
.style3 {font-size: 11px; font-family: Geneva, Arial, Helvetica, sans-serif; }
.style5 {
font-size: 10px;
font-family: Geneva, Arial, Helvetica, sans-serif;
color: #FF0000;
}-->
</style>
<link href="calendario.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
<table width="355" border="0" align="center">
<tr>
<td width="100" class="style3"><span class="style3">Equipamento:</span></td>
<td width="245"><select name="equipamento" id="equipamento">
<option value="TSW200E1">TSW200E1</option>
<option value="TSW800TP">TSW800TP</option>
<option value="TSW900ETH">TSW900ETH</option>
<option value="TSW300TIM">TSW300TIM</option>
<option value="TSW400DSL">TSW400DSL</option>
<option value="TSW110OPM">TSW110OPM</option>
</select> </td>
</tr>
<tr>
<td class="style3">N. de série:</td>
<td id="meu_campo"><input name="nserie" type="text" id="nserie" maxlength="9" />
<input type="button" name="button2" id="button2" value="+" onclick="javascript:inserircampo();" /></td>
</tr>
<tr>
<td class="style3">Cliente:</td>
<td><input name="cliente" type="text" id="cliente" maxlength="9" /></td>
</tr>
<tr>
<td class="style3">Pedido:</td>
<td><input name="pedido" type="text" id="textfield15" maxlength="9" /></td>
</tr>
<tr>
<td class="style3">Nota:</td>
<td><input name="nota" type="text" id="textfield14" maxlength="9" /></td>
</tr>
<tr>
<td class="style3">Data de emissão:</td>
<td><span id="pop2" style="position:absolute"></span><input name="data_emissao" type="text" id="textfield4" size="15" maxlength="9" />
<input TYPE="button" NAME="btnData2" VALUE="..." Onclick="javascript:popdate('document.form1.data_emissao','pop2','150',document.form1.data_emissao.value)"> </td>
</tr>
<tr>
<td class="style3">Parcela1:</td>
<td><select name="parcela1" id="parcela1">
<option value="não">não</option>
<option value="sim">sim</option>
<option value="não possui">não possui</option>
</select>
<span class="style5">*Pago?</span></td>
</tr>
<tr>
<td class="style3">Parcela2:</td>
<td><select name="parcela2" id="parcela2">
<option value="não">não</option>
<option value="sim">sim</option>
<option value="não possui">não possui</option>
</select>
<span class="style5">*Pago?</span></td>
</tr>
<tr>
<td class="style3">Parcela3:</td>
<td><select name="parcela3" id="parcela3">
<option value="não">não</option>
<option value="sim">sim</option>
<option value="não possui">não possui</option>
</select>
<span class="style5">*Pago?</span></td>
</tr>
<tr>
<td class="style3">Parcela4:</td>
<td><select name="parcela4" id="parcela4">
<option value="não">não</option>
<option value="sim">sim</option>
<option value="não possui">não possui</option>
</select>
<span class="style5">*Pago?</span></td>
</tr>
<tr>
<td class="style3">Parcela5:</td>
<td><select name="parcela5" id="parcela5">
<option value="não">não</option>
<option value="sim">sim</option>
<option value="não possui">não possui</option>
</select>
<span class="style5">*Pago?</span></td>
</tr>
<tr>
<td class="style3">Parcela6:</td>
<td><select name="parcela6" id="parcela6">
<option value="não">não</option>
<option value="sim">sim</option>
<option value="não possui">não possui</option>
</select>
<span class="style5">*Pago?</span></td>
</tr>
<tr>
<td class="style3"> </td>
<td> </td>
</tr>
<tr>
<td class="style3">Senha1:</td>
<td><input name="senha1" type="text" id="textfield8" maxlength="6" /></td>
</tr>
<tr>
<td class="style3">Senha2:</td>
<td><input name="senha2" type="text" id="textfield9" maxlength="6" /></td>
</tr>
<tr>
<td class="style3">Senha3:</td>
<td><input name="senha3" type="text" id="textfield10" maxlength="6" /></td>
</tr>
<tr>
<td class="style3">Senha4:</td>
<td><input name="senha4" type="text" id="textfield11" maxlength="6" /></td>
</tr>
<tr>
<td class="style3">Senha5:</td>
<td><input name="senha5" type="text" id="textfield12" maxlength="6" /></td>
</tr>
<tr>
<td class="style3">Senha6:</td>
<td><input name="senha6" type="text" id="textfield13" maxlength="6" /></td>
</tr>
</table>
<p> </p>
<table width="361" border="0" align="center">
<tr>
<td align="center"><input type="submit" name="button" id="button" value="Cadastrar Liberação no aparelho" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>Discussão (6)
Carregando comentários...