Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/05/2011, 16:15
yoshi001
 
Fecha de Ingreso: febrero-2011
Ubicación: cd chetumal
Mensajes: 14
Antigüedad: 13 años, 2 meses
Puntos: 0
Pregunta tablas dinamicas en php

Hola puesto que soy nuevo en php me han salido muchas dudas del como hacer las tablas dinamicas por la siguiente razon:

me piden recuperar datos de la BD osea registros pero a la vez poder agregar nuevos pero desde un atabla, tambien me piden poder eliminar o actualizar un registro, he intentado con java script pero nada mas no he podido tengo el siguiente codigo con esto nada mas he podido recuperar los registros que estan en la bd:

?php
include ("../add/connect.php");
session_start();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />-->

<title>Datos personales</title>
<link href="../formato.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="estiloEntrada.css"/>
<script type="text/javascript" src="agregar tabla.js"> </script>
<script type="text/javascript">
function borrar(objeto)
{
var nodo_del_row = objeto.parentNode.parentNode;
var index_del_row = nodo_del_row.rowIndex;
var nodo_de_tabla = nodo_del_row.parentNode;
x=objeto.parentNode.parentNode.parentNode;
x.deleteRow(index_del_row);
}
</script>
<div class="titulopaginas">Subsistema jovenes talentos </div>
<div class="tituloForma">3. Actividades en las que ha participado o participa &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Paso 3 de 4</div>

<!-- redondeado -->
<div class="roundcontform">
<div class="roundtopform"></div>
<samp class="instrucciones">

</samp>

<form method="post" id="formaregistro" action="retornatabla.php">

<div class="contenedorGeneral">

<div class="contenedorUnidadNombre1 contenedorUnidadDPersonal1">

<div class="contenedorDerecha">
<div><samp>Cuenta con beca acad&eacute;mica?</samp> </div>

<!-- BECA -->
<div id="becacontenido">

<label class="labelDPersonal">Beca acad&eacute;mica</label>
<select name="123" id="becademica">
<option value="-1">*** Selecciona ***</option>

<?php
$link=conectarse();
////////////////////////////////////////////////////////////////////
$result = mysql_query("SELECT * FROM tipoambitoparticipacion", $link);
if (mysql_num_rows($result)){
while ($row = @mysql_fetch_array($result)) {
echo '<option value="'.$row["tipoambpart_id"].'">'.$row["nombre"]."</option>";
}
}
else
echo "¡ No se ha encontrado ningún registro !";
////////////////////////////////////////////////////////////////////
?>
</select>

</div>
</div>
</div>
</div>


<div align="center">

<a href="muestra2.php"><img width="16px" height="16px" src="../images/back-icon.png"></a>
&nbsp; &nbsp; &nbsp;
<input class="botonguardardisabled" type="submit" name="button" id="siguiente_actividad" value="Agregar" />
&nbsp; &nbsp; &nbsp;
<a href="muestra4.php"><img width="16px" height="16px" src="../images/back-icon.png"></a>
&nbsp; &nbsp; &nbsp;
<a href="muestra3.php"><img width="18px" height="18px" src="../images/icon-view.png"></a>

</div>
</form>


<div align="center" class="divTabla">
</div>

<br/>
<table border="1" background="images/bg_subtleGrayGrad.gif" width="99%" id="tablaCarrera1" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">
<caption><font size="4" color="#333333"><strong>Tipos de becas Elegidas: </strong></font></caption>
<tr> <td align="center" width="11%"><strong>BECA</strong></td>
<td align="center" width="11%"> <strong>contenido</strong></td>
<td align="center" width="11%"><strong>Eliminar</strong></td>
<td align="center" width="11%"><strong>Actualizar</strong></td>

</tr>
<?php
if($_SESSION['beca1']!=0 ){?>
<tr>

<td align="center" width="11%"><strong>BECA 1</strong></td>
<td align="center" width="11%" ><strong><?php






$link=conectarse();
////////////////////////////////////////////////////////////////////

$result = mysql_query("SELECT * from tipoambitoparticipacion", $link);
if (mysql_num_rows($result)){
while ($row = @mysql_fetch_array($result)) {
if($_SESSION["beca1"]==$row["tipoambpart_id"]){
$_SESSION[resu1]= $row["nombre"];

}
}
}
else
echo "� No se ha encontrado ning�n registro !";

echo $_SESSION[resu1];
?></strong></td>
<td><input type="button" name="Submit32" value="x" onclick='borrar(this);'/></td>
<td align="center" width="11%"> <strong><?php echo $_SESSION["bk1"];?></strong></td><?php }?>
</tr>
<?php
if($_SESSION['beca2']!=-1){?>
<tr>
<td align="center" width="11%"><strong>BECA 2</strong></td>
<td align="center" width="11%" ><strong><?php
$link=conectarse();
////////////////////////////////////////////////////////////////////

$result = mysql_query("SELECT * from tipoambitoparticipacion", $link);
if (mysql_num_rows($result)){
while ($row = @mysql_fetch_array($result)) {
if($_SESSION["beca2"]==$row["tipoambpart_id"]){
$_SESSION[resu2]= $row["nombre"];

}
}
}
else
echo "� No se ha encontrado ning�n registro !";

echo $_SESSION[resu2];


?></strong></td>
<td><input type="button" name="Submit32" value="x" onclick='borrar(this);'/></td>
<td align="center" width="11%"> <strong></strong></td><?php }?>
</tr>
<?php
if($_SESSION['beca3']!=-1){?>
<tr>
<td align="center" width="11%"><strong>BECA 3</strong></td>
<td align="center" width="11%"><strong><?php
$link=conectarse();
////////////////////////////////////////////////////////////////////

$result = mysql_query("SELECT * from tipoambitoparticipacion", $link);
if (mysql_num_rows($result)){
while ($row = @mysql_fetch_array($result)) {
if($_SESSION["beca3"]==$row["tipoambpart_id"]){
$_SESSION[resu3]= $row["nombre"];

}
}
}
else
echo "� No se ha encontrado ning�n registro !";

echo $_SESSION[resu3];
?></strong></td>
<td><input type="button" name="Submit32" value="x" onclick='borrar(this);'/></td>
<td align="center" width="11%"> <strong></strong></td><?php }?>
</tr>


</table><br/>







<p></p>

<a href="#" id="toTop">^ Ir arriba</a>



<br/>
</body>
</html>