Ver Mensaje Individual
  #15 (permalink)  
Antiguo 03/08/2009, 11:09
Avatar de tampon
tampon
 
Fecha de Ingreso: julio-2009
Mensajes: 420
Antigüedad: 14 años, 10 meses
Puntos: 0
Hola Ronin, pues si eso creo, si te referis a que el campo contenga un valor al momento de ser enviado el formulario, pues asi es.

o no se si te entendi bien, mira de todos modos pongo la sintaxis del php y del html tambien.

Código:
<form name="sumar1" method="POST">
		<p><h2>Informacion importante.</h2></p>
		<table style="margin:-30px 0 -25px 0;">
			<tr>
				<td width="33.3%">
					<p><h3>Informacion del plantel:</h3></p>
					<p><input type="text" value="" class="txt" id="TextBox1" disabled><br /><input type="text" value="" class="txt" id="TextBoxA" disabled></p>
				</td>
				<td width="33.3%">
					<p><h3>Datos del alumno:</h3></p>
					<p><input id="nombre" name="nombre" type="text" value="Nombre"  class="obligatorio" onFocus="if(this.value=='Nombre')this.value='';" onBlur="if(this.value=='')this.value='Nombre';" />
					<br /><input id="matricula" name="matricula" type="text" value="Matricula"  class="obligatorio"  class="obligatorio" onFocus="if(this.value=='Matricula')this.value='';" onBlur="if(this.value=='')this.value='Matricula';" /></p>
				</td>
				<td width="*%">
					<p><h3>Turno:</h3></p>
					<p><input name="group1" id="turno" value="matutino" type="radio"> Matutino<br /><input name="group1" id="turno" value="vespertino" checked="checked" type="radio"> Vespertino<br /><input name="group1" value="otro" checked="checked" type="radio"> Otro</p> 
				</td>
			</tr>
		</table>
		<p><h2>Numero del deposito bancario.</h2></p>
		<table>
			<tr>
				<td width="280px">
					<p>Numero de folio de deposito por concepto</p>
				</td>
				<td>
					<p><input type="text" value="" id="ingreso" class="ndeposito" style="margin-left:22px"></p>
				</td>
			</tr>
		</table>
		<div class="mensaje" id="error"></div>
		<p><h2>Tabulador de cuotas por concepto (Importe pagado).</h2></p>
		<p><input class="txt" type="text" id="concepto" value="Nuevo Ingreso" disabled></p>
		<div id="datIzq">
			<p>Cuota escolar nuevo ingreso carrera tecnologica.</p>
			<p>Seguro estudiantil anual.</p>
			<p>Expedicion de credencial.</p>
			<p><font color="#999999"><strong>Total.</strong></font></p>
		</div>
		<div id="datDer">
			<p><input type="checkbox" value="1102" name="Check1" onClick="Suma1(this.checked,this.value)" >$1,102.00 (mil ciento dos pesos)</p>
			<p><input type="checkbox" value="50" name="Check2" onClick="Suma1(this.checked,this.value)" >$50.00 (cincuenta pesos)</p>
			<p><input type="checkbox" value="52" name="Check3" onClick="Suma1(this.checked,this.value)" >$52.00 (cincuenta y dos pesos)</p>
			<p><b><font color="#999999">$</font></b> <input class="resultado" id="pago" type="text" name="total1" value="0" disabled></p>
			<div class="envia">
				<p><h3>Aseguro que lo datos introducidos son correctos <input type="checkbox" onClick="JavaScript:document.sumar1.ok1.disabled = !this.checked"></h3>
				<input onclick="comprobar1();nuevoEvento('ingreso')" id="botonIngreso" type="button" value="Guardar Registro" name='ok1' disabled></p>
			</div>
		</div>
	</form>
Código PHP:
<?php
include 'conexion.php';

function 
validaIngreso($valora)
{
    if(
eregi("^[a-zA-Z0-9.@ ]{10,15}$"$valora)) return TRUE;
    else return 
FALSE;
}

function 
verificaExistencia($bauche)
{
    
$consulta=mysql_query("SELECT id FROM tabla_registros WHERE folio='$bauche'") or die(mysql_error());
    
$registro=mysql_fetch_row($consulta);
    
    if(!empty(
$registro)) return TRUE;
    else return 
FALSE;
}

if(isset(
$_POST["ingreso"]))
{
    
$valora=trim($_POST["ingreso"]);
    if(
validaIngreso($valora))
    {
        
conectar();
        
        
$consulta=mysql_query("SELECT COUNT(*) FROM tabla_registros") or die(mysql_error());
        
$registro=mysql_fetch_row($consulta);

        if(
$registro[0]>=100000000) { echo "<img src='../img/alert.gif' border='0' /> Hay demasiados registros en la base de datos"; die(); }
        
        if(
verificaExistencia($valora)) echo "<font color='red'><img src='../img/denied.gif' border='0' /> El folio <b>$valora</b> ya existe en la base de datos</font>";
        else 
        {
            
mysql_query("INSERT INTO tabla_registros (folio,matricula,nombre,colegio,carrera,turno,concepto,valor,registrado) 
            VALUES ('$valora','$matricula','$nombre','$TextBox1','$TextBoxA','$turno','$concepto','$pago',NOW())"
) or die(mysql_error());
            echo 
"<font color='green'><img src='../img/ok.gif' border='0' /> Registro guardado con el folio: <b>$valora</b></font>";
        }
        
desconectar();
    }
}
?>
GRACIAS POR LAS RESPUESTAS, SALUDOS!

Ah se me olvido comentar que solo quite la columna "ususario" de la base de datos.

Última edición por GatorV; 04/08/2009 a las 21:12