PHP - CASILLA DE VERIFICACION

 
Vista:

CASILLA DE VERIFICACION

Publicado por ROMAN (6 intervenciones) el 06/09/2008 01:49:11
BENO ALGUIEN PODRIA AYUDARME A TERMINAR ESTE FORMULARIO PHP
LA IDEA ES CUANDO ACTIVE LA CASILLA DE VERIFICACION DEVUELVA UN MENSAJE SI ES DEPORTISTA DE LO CONTRARIO UN MENSAJE O ALGUNCONSEJO
ESTO DEBE VER EN EN AREA TEXTO
<?
$n=$_POST["txt1"];
$s=$_POST["cboso"];
$c=$_POST["chkdep"];
$r=$_POST["rdbsexo"];
$t=$_POST["txtarea"];

if ($c=1)

echo "felicitaciones es ud. un buen deportista";
else
echo "lo sentimos debe practicar un deporte";

echo $n."<br>"," ";
echo $s."<br>"," " ;
echo $c."<br>"," " ;
echo $r."<br>"," ";
echo $t."<br>"," ";


?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:CASILLA DE VERIFICACION

Publicado por Diego Romero (1450 intervenciones) el 06/09/2008 05:20:02
Te faltó postear aquí el código del formulario HTML.

Y trata de usar nombres de variables más descriptivos del dato que debería contener.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:CASILLA DE VERIFICACION

Publicado por ROMAN SILVA TINEDO (6 intervenciones) el 06/09/2008 06:01:54
<!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=iso-8859-1" />
<title>Documento sin título</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="demodatos.php">
<table width="60%" height="236" border="0" align="center">
<tr>
<td colspan="2" bgcolor="#0099FF"><div align="center"><strong>Datos personales </strong></div></td>
</tr>
<tr>
<td width="38%">Nombres</td>
<td width="62%"><label>
<input name="txt1" type="text" id="txt1" />
</label></td>
</tr>
<tr>
<td>que sistema operativo usa </td>
<td><label>
<select name="cboso" id="cboso">
<option>windows xp</option>
<option>windows vista</option>
<option>windows 2003 server</option>
<option>linux</option>
</select>
</label></td>
</tr>
<tr>
<td>practica deportes</td>
<td><label>
<input name="chkdep" type="checkbox" id="chkdep" value="1" checked="checked" />
</label></td>
</tr>
<tr>
<td>genero</td>
<td><input name="rdbsexo" type="radio" value="masculino" />
masculino
<input name="rdbsexo" type="radio" value="femenino" />
Femenino</td>
</tr>
<tr>
<td valign="top">cuales son tus aficiones </td>
<td><textarea name="txtarea" cols="40" rows="4" id="txtarea"></textarea></td>
</tr>
<tr>
<td bgcolor="#0099FF"><p> </p> </td>
<td bgcolor="#0099FF"><label>
<input name="enviar" type="submit" id="enviar" value="Enviar" />
</label></td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:CASILLA DE VERIFICACION

Publicado por Diego Romero (1450 intervenciones) el 06/09/2008 19:23:33
Pues el código que has puesto es correcto. Salvo tal vez que deberías verificar si existe o no la variable $_POST["chkdep"] así:

if (isset($_POST["chkdep"];)) {
if ($_POST["chkdep"] == 1) { echo "Eligió un deporte"; }
else { echo "No eligió un deporte"; }
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar