Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/02/2015, 11:20
Mental
 
Fecha de Ingreso: noviembre-2005
Mensajes: 146
Antigüedad: 18 años, 6 meses
Puntos: 1
Establecer anchura de tabla html creada con php

Buenos días:
He recurrido a un código que he encontrado en internet
link: https://www.youtube.com/watch?v=FucYLYJ1D4M
Lo he adaptado a mi base de datos Mysql y funciona.
El problema es que no puedo dimensionar la anchura de la tabla.
El código es:
Código PHP:

Código PHP:
Ver original
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta   charset="utf-8">
  5.     <title>Solicitudes</title>
  6. </head>
  7. <body>
  8. <?php
  9. include("conexion.php");
  10.  
  11. echo "<table border=1>
  12. <tr>
  13.    <th>IdServ</th>
  14.    <th>Ref_Pres</th>
  15.    <th>Ref_Serv</th>
  16.    <th>Tiempo</th>
  17.    <th>Usuarios</th>
  18.    <th>HoraI</th>
  19.    <th>HoraII</th>
  20.    <th>Reserva</th>
  21.    <th>Precio</th>
  22.    <th>Coste</th>
  23.    <th>Sumprecio</th>
  24.    <th>Sumcoste</th>
  25.    <th>Acron</th>
  26. </tr>";
  27. while($record = mysqli_fetch_array($myData)){
  28. echo "<form action=form_solicitudes.php method=post>";
  29. echo "<tr>";
  30. echo "<td>" . "<input type=text class= 'min' name=txtIdpres_Serv    value=" . $record['Idpres_Serv'] . " </td>";
  31. echo "<td>" . "<input type=text class= 'min' name=txtRef_Pres       value=" . $record['Ref_Pres'] . " </td>";
  32. echo "<td>" . "<input type=text class= 'min' name=txtRef_Serv       value=" . $record['Ref_Serv'] . " </td>";
  33. echo "<td>" . "<input type=text class= 'min' name=txtTiempo         value=" . $record['Tiempo'] . " </td>";
  34. echo "<td>" . "<input type=text class= 'min' name=txtUsuarios       value=" . $record['Usuarios'] . " </td>";
  35. echo "<td>" . "<input type=text class= 'min' name=txtHoraI          value=" . $record['HoraI'] . " </td>";
  36. echo "<td>" . "<input type=text class= 'min' name=txtHoraII         value=" . $record['HoraII'] . " </td>";
  37. echo "<td>" . "<input type=text class= 'min' name=txtReserva        value=" . $record['Reserva'] . " </td>";
  38. echo "<td>" . "<input type=text class= 'min' name=txtPrecio         value=" . $record['Precio'] . " </td>";
  39. echo "<td>" . "<input type=text class= 'min' name=txtCoste          value=" . $record['Coste'] . " </td>";
  40. echo "<td>" . "<input type=text class= 'min' name=txtSumprecio      value=" . $record['Sumprecio'] . " </td>";
  41. echo "<td>" . "<input type=text class= 'min' name=txtSumcoste       value=" . $record['Sumcoste'] . " </td>";
  42. echo "<td>" . "<input type=text class= 'min' name=txtAcron          value=" . $record['Acron'] . " </td>";
  43.  
  44.  
  45.  
  46. echo "<td>" . "<input type=hidden name=hidden value=" . $record['Idpres_Serv'] . " </td>";
  47. echo "<td>" . "<input type=submit name=update value=update" . " </td>";
  48. echo "<td>" . "<input type=submit name=delete value=delete" . " </td>";
  49. echo "</tr>";
  50. echo "</form>";
  51. }
  52. echo "<form action=solicitudes.php method=post>";
  53. echo "<tr>";
  54. echo "<td><input type=text class= 'min' name=txtIdpres_Serv></td>";
  55. echo "<td><input type=text class= 'min' name=txtRef_Pres></td>";
  56. echo "<td><input type=text class= 'min' name=txtRef_Serv></td>";
  57. echo "<td><input type=text class= 'min' name=txtTiempo></td>";
  58. echo "<td><input type=text class= 'min' name=txtUsuarios></td>";
  59. echo "<td><input type=text class= 'min' name=txtHoraI></td>";
  60. echo "<td><input type=text class= 'min' name=txtHoraII></td>";
  61. echo "<td><input type=text class= 'min' name=txtReserva></td>";
  62. echo "<td><input type=text class= 'min' name=txtPrecio></td>";
  63. echo "<td><input type=text class= 'min' name=txtCoste></td>";
  64. echo "<td><input type=text class= 'min' name=txtSumprecio></td>";
  65. echo "<td><input type=text class= 'min' name=txtSumcoste></td>";
  66. echo "<td><input type=text class= 'min' name=txtAcron></td>";
  67.  
  68.  
  69. echo "<td>" . "<input type=submit name=add value=add" . " </td>";
  70. echo "</form>";
  71. echo "</table>";
  72.  
  73. ?>
  74.  
  75. </body>
  76. </html>


La linea 11 inicia la tabla.
He usado:
Código PHP:
Código PHP:
Ver original
  1. echo <table border=1 width=50%>
Código PHP:
Ver original
  1. echo <table border=1 width=500>
Código PHP:
Ver original
  1. echo <table border=1 width=500px>
Código PHP:
Ver original
  1. echo <table border=1 width='500px'>
Código PHP:
Ver original
  1. echo <table border=1 width="500px">

y así sucesivamente.

Espero que alguien sepa como puedo hacerlo y la explicación de qué hago mal.
Gracias