Tema: problema php
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/02/2011, 08:29
Avatar de juan_14nob
juan_14nob
 
Fecha de Ingreso: abril-2010
Mensajes: 552
Antigüedad: 14 años, 10 meses
Puntos: 6
problema php

hola estoy haciendo el modelo de lo que quiero visualizar en la pagina..
por eso pongo en una tabla los registros y desp con botones 'radio' selecciono los que quiero que se vean (on) y los que no (off) pero no se como hacer la parte del checkeado
aqui les dejo los codigos. Saludos y gracias

Archivo1.php
Código PHP:
<html>
<head>

</head>
<body>
<?php $conexion mysql_connect("localhost""root""") or die("Problemas en la conexion");
mysql_select_db("roberto"$conexion) or die ("Problema al seleccionar bd");



$strselect="select * from home order by id asc LIMIT 6";
$resultado=mysql_query($strselect,$conexion);
$registro mysql_fetch_array($resultado);
?><form action='archiprinmodi.php' method='POST'>
<table cellspacing='0' cellpading='0' border='1' width='500'> 

<tr>
<td>
Titulo
</td>
<td>
Parrafos
</td></tr>
<?php

while($registro=mysql_fetch_array($resultado)){
echo 
"<tr>";
    
echo 
"<td>";

echo 
$registro['titulos'];
echo 
"</td>";
echo 
"<td>";
echo 
$registro['parrafos'];
echo 
"<td><input type='radio' name=".$registro['id'].">on</td><td><input type='radio' name=".$registro['id'].">off</td>";

}
echo 
"<br/><input type='submit' value='Aceptar'>";

?>


</td></tr></table> 


</form>
</body>
</html>
y este es el que recibe las ordenes y "muestra"..

Código PHP:
<html>
<head>

</head>
<body>
<?php
 $conexion 
mysql_connect("localhost""root""") or die("Problemas en la conexion");
mysql_select_db("roberto"$conexion) or die ("Problema al seleccionar bd");
$vartit $_POST['titulo'];
$varparra $_POST['parrafo'];
$vari2[] = $_POST[$registro['id']];
$varichec[3] = $vari2;
echo 
$varichec;
if(
$vartit == ""){
    if(
$varparra == ""){

}else{
    
$queEmp_usuario=mysql_query("INSERT into home(titulos,parrafos)
VALUES

(
'$vartit','$varparra'
)"
,$conexion) or die("Problemas en el select" mysql_error());

echo 
"Se han guardados correctamente";
//echo "<META HTTP-EQUIV='refresh' CONTENT='5; url=archimodel.php'>";


}}





if (
$varichec =! "")
{
echo 
"Se ha ckequeado el"
echo 
$varichec;


}
?>
</body>
</html>