elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5 6 7
21  Programación / PHP / Añadir y eliminar contactos problema en: 30 Abril 2010, 21:17 pm
Hola que tal, veran estoy haciendo un eliminar y mostrar contactos de cada usuario; el problema que me surge es que me muestra todas los usuarios que hay; y el $cnt me dice por ejemplo tienes 3 usuarios, todo bien, pero en la lista salen todos los que hay y no esos 3.
Tampoco se eliminan los usuarios que uno quiere eliminar.
Dejo el codigo por las dudas.

Código
  1. <?php
  2. error_reporting(E_ALL ^ E_NOTICE);
  3. session_name('pLogin');
  4. include("connect.php");
  5.  
  6. $usuario=$_SESSION['usuario'];
  7. $tid=$_GET["id"];
  8. $id=$_SESSION["id"];
  9.  
  10. $msg1="";
  11. $to_delete="";
  12. $items_removed=0;
  13. if ( count($_POST)<>0 )
  14. {
  15. /////////////////////////// A REQUEST TO DELETE SOME CONTACTS ///////////////
  16.  
  17. for($i=1;$i<=$_REQUEST["cnt"];$i++)
  18. {
  19.  
  20. if ( isset($_REQUEST["checkbox" . $i]) )  //Is the checkbox ticked
  21. {
  22. if ($to_delete!="") { $to_delete.="," ; }  //To insert comma??
  23. $to_delete.= $_REQUEST["checkbox" . $i];  //Add another item to delete
  24. $items_removed++;
  25. }
  26.  
  27. } //End For
  28. if ($to_delete=="")
  29. {
  30. $msg1=" No se puede eliminar ningun usuario de la lista de contactos ";
  31. }
  32. else
  33. {
  34. $del_str="  Delete from dm_contacts where dm_contact_id IN (" . $to_delete .")";
  35. mysql_query($del_str);
  36. $msg1= ($items_removed > 1)?$items_removed . " Usuarios que han sido removidos de tu lista de contactos":$items_removed . " El usuario ha sido removido de tu lista";
  37. }
  38. header("Location:"." msg_confirm_mem.php?errmsg=".urlencode($msg1));
  39. die();
  40. /////////////////////////////CONTACTS HAVE BEEN REMOVED /////////////////////
  41. }
  42.  
  43.  
  44.  
  45. $rs0_query=mysql_query("Select count(*) from dm_contacts  where  dm_uid =" .$tid );
  46. $rs0=mysql_fetch_array($rs0_query);
  47. $contact_count=$rs0[0];
  48.  
  49. $rs0_query=mysql_query("SELECT * FROM dm_contacts, members WHERE dm_contacts.dm_contact_id=members.id" );
  50. ?>
  51. <script language="javascript">
  52. function validate(form)
  53. {
  54. if((form.username.value==""))
  55. {
  56. alert('Por favor especifica un nombre de usuario');
  57. form.username.focus();
  58. return false;
  59. }
  60. return true;
  61. }
  62. </script>
  63. <table width="100%" border="0" cellpadding="0" cellspacing="0" >
  64.  <tr>
  65.    <td colspan="3" valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  66.        <tr>
  67.          <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  68.              <tr>
  69.                <td class="titlestyle">&nbsp;Añadir a mi lista de contactos</td>
  70.              </tr>
  71.            </table></td>
  72.        </tr>
  73.        <tr>
  74.          <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="5" class="onepxtable">
  75.              <form name="form1" method="post" action="addcontact.php" onSubmit="return validate(this);">
  76.                <tr valign="top">
  77.                  <td width="40%" align="right" class="innertablestyle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  78.                      <tr align="right">
  79.                        <td width="60%"><font class="normal"><strong><font class='normal'>
  80.                          </font></strong></font></td>
  81.                        <td><font class="normal"><strong><font class='normal'>Username</font></strong></font></td>
  82.                      </tr>
  83.                    </table></td>
  84.                  <td width="6">&nbsp;</td>
  85.                  <td width="60%"><font face="Arial, Helvetica, sans-serif" size="2">
  86.                    <input type="text" name="username">
  87.                    </font></td>
  88.                </tr>
  89.                <tr valign="top">
  90.                  <td align="right" class="innertablestyle">&nbsp;</td>
  91.                  <td>&nbsp;</td>
  92.                  <td><input type="submit" name="Submit2" value="Add User"></td>
  93.                </tr>
  94.              </form>
  95.            </table></td>
  96.        </tr>
  97.      </table>
  98.  
  99.    </td>
  100.  </tr>
  101.  <tr>
  102.    <td height="25" colspan="3" valign="middle"> <div align="center"><font class='red'>
  103.        </font></div></td>
  104.  </tr>
  105.  <tr>
  106.    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  107.        <tr>
  108.          <td valign="top"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
  109.              <tr >
  110.                <td valign="top"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="innertablestyle">
  111.                    <tr>
  112.                      <td height="25" class="titlestyle">&nbsp;Mis contactos</td>
  113.                    </tr>
  114.                    <tr>
  115.                      <td height="25" valign="middle"><font class='normal'>Tu lista de contactos tiene <strong><font class='red'><?php echo $contact_count; ?></font></strong><?php
  116. if( $contact_count>1)
  117. {
  118. echo " usuarios";
  119. }
  120. else
  121. {
  122. echo " usuario";
  123. }
  124. ?></font><font class='red'><br>
  125.                        </font></td>
  126.                    </tr>
  127.                    <tr>
  128.                      <td height="25" valign="middle"><font class='normal'>To
  129.                        remove a user from my contacts list just check the check
  130.                        box and click the remove button below.</font></td>
  131.                    </tr>
  132.                    <tr>
  133.                      <td valign="top">
  134.  <script language="javascript">
  135. //<!--
  136. function select_all()
  137. {
  138.  for (var i=0;i<document.form2.elements.length;i++)
  139.  {
  140. var e =document. form2.elements[i];
  141. if ((e.name != 'check_all') && (e.type=='checkbox'))
  142. {
  143.   e.checked = document.form2.check_all.checked;
  144. }
  145.  }
  146. }
  147. function validate_rem(form)
  148. {
  149. var checked='no';
  150.  for (var i=0;i<form.elements.length;i++)
  151.  {
  152. var e =form.elements[i];
  153. if (e.checked==true)
  154. {
  155.   checked='yes';
  156. }
  157.  }
  158. if(checked=='no')
  159. {
  160. alert('Por favor elige al menos un contacto a eliminar');
  161. return false;
  162. }
  163. return true;
  164. }
  165. //-->
  166. </script>
  167. <form name="form2" method="post" action="mostrarcontactos.php" onSubmit="return validate_rem(this);">
  168.                          <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
  169.                            <tr class="subtitle">
  170.                              <td width="10" align="right"> <input name="check_all" type="checkbox" id="check_all" onClick="select_all();" value="yes"></td>
  171.                              <td height="25"><b><font class='normal'>Usuario</font></b></td>
  172.                              <!--td><b><font class='normal'>Company Name </font></b></td>
  173.                              <td><b><font class='normal'>Phone</font></b></td>
  174.                              <td><b><font class='normal'>Fax</font></b></td-->
  175.                            </tr>
  176.                            <?php
  177. $cnt=0;
  178. while ($rs0=mysql_fetch_array($rs0_query))
  179. {
  180.  $cnt++;
  181.  
  182.  
  183.  
  184. ?>
  185.                            <tr>
  186.                              <td width="10" align="right" ><font class='normal'>
  187.                                <input type="checkbox" name="checkbox<?php echo $cnt;?>" value="<?php
  188.   echo $rs0["dm_uid"];?>">
  189.                                </font></td>
  190.                              <td ><font class='normal'><a href="replyuser.php?type=contact&tid=<?php echo $rs0["dm_contact_id"];?>" ><?php echo $rs0["usuario"];?></a>
  191.                                </font></td>
  192.  
  193.                            </tr>
  194.                            <?php
  195. }
  196. ?>
  197.                            <tr >
  198.                              <td colspan="2" align="left"> <input type="hidden" name="cnt" value="<?php echo $cnt; ?>">
  199.                                <input type="submit" name="Submit3" value="Remove">
  200.                              </td>
  201.                              <!--td>&nbsp;</td>
  202.                              <td>&nbsp;</td>
  203.                              <td>&nbsp;</td-->
  204.                            </tr>
  205.                          </table>
  206.                        </form></td>
  207.                    </tr>
  208.                  </table></td>
  209.              </tr>
  210.            </table></td>
  211.        </tr>
  212.        <tr>
  213.          <td>&nbsp;</td>
  214.        </tr>
  215.      </table></td>
  216.  </tr>
  217. </table>

el dm_uid-> es la id del usuario de la sesion
el dm_contacts_id-> es la id del contacto añadido.


Gracias de antemano
22  Programación / PHP / Re: Usar libreria gd, para redimensionar imagenes. en: 22 Abril 2010, 18:43 pm
Hola, me olvidaba, en el perfil tengo este codigo que redimensiona las imagenes, pero de acuerdo al ancho y alto que tengan.
Yo lo que busco es algo que pueda quedarse fijo como por ejemplo 200 x 200.

Código
  1. if ($picture != "") {
  2.  
  3.    $width1 = 400;
  4.    $height1 = 400;
  5.    $inf = @GetImageSize("images/" . $picture);
  6.    $width2 = $inf[0];
  7.    $height2 = $inf[1];
  8.    $width = $width2;
  9.    $height = $height2;
  10.    if ($width > $width1) {
  11.        $factor = round(($width1 / $width), 2);
  12.        $width = $width1;
  13.        $height = $height * $factor;
  14.        $changed = 1;
  15.    }
  16.    if ($height > $height1) {
  17.        $factor1 = round(($height1 / $height), 2);
  18.        $height = $height1;
  19.        $width = $width * $factor1;
  20.        $changed = 1;
  21.    }
23  Programación / PHP / Usar libreria gd, para redimensionar imagenes. en: 22 Abril 2010, 16:03 pm
Hola que tal, les comento tengo este codigo para subir imagenes, todo bien se hace la insercion a la bd, pero que pasa... me gustaria poder redimensionar esas imagenes para que se muestren por ejemplo en el perfil. Cómo se podria usar la libreria en este codigo?, o se usa aparte. Alguien podria guiarme?

Gracias de antemano, den_22

Dejo el codigo:

Código
  1. <?php
  2. error_reporting(E_ALL ^ E_NOTICE);
  3. session_name('pLogin');
  4.  
  5. include("connect.php");
  6.  
  7.  
  8. $id=$_SESSION['id'];
  9.  
  10.  
  11. define ("MAX_SIZE","500");
  12.  
  13.  
  14. function getExtension($str) {
  15.         $i = strrpos($str,".");
  16.         if (!$i) { return ""; }
  17.         $l = strlen($str) - $i;
  18.         $ext = substr($str,$i+1,$l);
  19.         return $ext;
  20. }
  21.  
  22.  
  23.  
  24. $errors=0;
  25.  
  26. if(isset($_POST['Submit']))
  27. {
  28.  
  29. $image=$_FILES['image']['name'];
  30.  
  31. if ($image)
  32. {
  33.  
  34. $filename = stripslashes($_FILES['image']['name']);
  35.  
  36.   $extension = getExtension($filename);
  37. $extension = strtolower($extension);
  38.  
  39. if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif"))
  40. {
  41. //print error message
  42. echo '<h1>No es una imagen!</h1>';
  43. $errors=1;
  44. }
  45. else
  46. {
  47.  
  48.  
  49.  
  50. $size=filesize($_FILES['image']['tmp_name']);
  51.  
  52. //comparamos el tamaño definido con este
  53. if ($size > MAX_SIZE*1024)
  54. {
  55. echo '<h1>Has excedido el limite permitido!</h1>';
  56. $errors=1;
  57. }
  58.  
  59.  
  60. $image_name=time().'.'.$extension;
  61.  
  62. $newname="images/".$image_name;
  63. //verificamos si se subió la imagen, e imprimimos el error en todo caso
  64. $copied = copy($_FILES['image']['tmp_name'], $newname);
  65. if (!$copied)
  66. {
  67. echo '<h1>No se ha podido subir la imagen!</h1>';
  68. $errors=1;
  69. }}}}
  70.  
  71. //Si no hay errores imprimir el mensaje
  72. if(isset($_POST['Submit']) && !$errors)
  73. {
  74. echo "<h1>El archivo subió correctamente</h1>";
  75. UPDATE prueba
  76. SET picture='$image_name'
  77. WHERE id='$_SESSION[id]'  ");
  78. }
  79.  
  80.  
  81.  
  82.  
24  Programación / PHP / Re: Haciendo un buscador en: 13 Abril 2010, 04:44 am
Hola, bueno posteo lo que tengo hasta ahora, no pido que hagan el codigo, solamente que me guien un poquito  :-( , gracias.


Código
  1. <?php
  2.  
  3.  
  4.  
  5.  
  6.  
  7. error_reporting(E_ALL ^ E_NOTICE);
  8. session_name('pLogin');
  9. include_once ("connect.php");
  10.  
  11.  
  12. $usuario=$_SESSION['usuario'];
  13.  
  14.  
  15. if(!isset($usuario)){
  16.  
  17. echo 'No se ha seleccionado ningun usuario.';
  18.  
  19. }else{
  20.  
  21.  
  22. $query=mysql_query("SELECT * FROM prueba WHERE usuario='$_SESSION[usuario]' ");
  23.  
  24. if(mysql_num_rows($query)>0){
  25. $user_ok=mysql_fetch_array($query);
  26.  
  27.  
  28.  
  29.  
  30.  
  31. //todo comprobado, ahora solo falta mostrar los datos
  32. echo 'Bienvenid@ <b>'.$user_ok['usuario'].'</b><br>';
  33.  
  34. }else{
  35.  
  36. echo 'La id de usuario seleccionada no existe';
  37. }
  38. }
  39.  
  40. function getsqlrow($query) {
  41. $result = mysql_query($query) or die(mysql_error());
  42. $row = mysql_fetch_array($result);
  43. return $row;
  44. }
  45.  
  46. function getsqlnumber($sqlQuery) {
  47. $query=mysql_query($sqlQuery);
  48. $result=mysql_num_rows($query);
  49. return $result;
  50. }
  51.  
  52.  
  53. if(!isset($_GET['page'])){
  54. $page = 1;
  55. } else {
  56. $page = $_GET['page'];
  57. }
  58. $max_results = 10;
  59. $from = (($page * $max_results) - $max_results);
  60.  
  61. $query = mysql_query("SELECT * FROM prueba WHERE sexo='".$_POST['gender']."' AND pais='".$_POST['pais']."' AND estadocivil='".$_POST['estadocivil']."' LIMIT $from, $max_results");
  62.  
  63. if (mysql_num_rows($query)==0){
  64. } else {
  65.  
  66. while ($user_ok = mysql_fetch_array($query)){
  67.  
  68. $get_result_row = getsqlrow("SELECT * FROM prueba WHERE usuario='".$user_ok['usuario']."'");
  69.  
  70.  
  71.  
  72. $result_ocupacion = getsqlnumber("SELECT * FROM prueba WHERE ocupacion='".$user_ok['ocupacion']."'");
  73.  
  74. $result_hijos = getsqlnumber("SELECT * FROM prueba WHERE hijos='".$user_ok['hijos']."'");
  75.  
  76. }
  77. }
  78.  
  79. $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM prueba WHERE sexo='".$_POST['gender']."' AND pais='".$_POST['pais']."' AND estadocivil='".$_POST['estadocivil']."'"),0);
  80. $total_pages = ceil($result / $max_results);
  81.  
  82. if($page > 1){
  83. $prev = ($page - 1);
  84. echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev&&firstname=".$_POST['firstname']."&&sexo=".$_POST['gender']."&&pais=".$_POST['pais']."&&estadocivil=".$_POST['estadocivil']."\" class=\"title_text\">Previous</a>";
  85. }
  86.  
  87. for($i = 1; $i <= $total_pages; $i++){
  88. if(($page) == $i){
  89. echo "$i ";
  90. } else {
  91. echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i&&firstname=".$_POST['firstname']."&&sexo=".$_POST['gender']."&&pais=".$_POST['pais']."&&estadocivil=".$_POST['estadocivil']."\" class=\"title_text\">$i</a> ";
  92. }
  93. }
  94.  
  95. if($page < $total_pages){
  96. $next = ($page + 1);
  97. echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next&&firstname=".$_POST['firstname']."&&sexo=".$_POST['gender']."&&pais=".$_POST['pais']."&&estadocivil=".$_POST['estadocivil']."\" class=\"title_text\">Next</a>";
  98. }
  99. echo "</center>";
  100.  
  101.  
  102.  
  103.  
  104.  
  105. ?>
25  Programación / PHP / Re: Haciendo un buscador en: 12 Abril 2010, 00:06 am
Hola nuevamente, al final pude hacer un buscador, que puede buscar por palabras, o sea nombre de usuario. El tema es que no me sale el del select.
Dejo los codigos, a ver cual es la cuestion de que no busque con el select.

el search.php tiene este codigo:

Código
  1. <?php
  2. include_once ("connect.php");
  3. include_once ("srh.php");  
  4.  
  5. ?>

el del srh.php:

Código
  1. <?php
  2.  
  3. //Buscador nombre
  4. if (isset($_POST['search_firstname'])){
  5. $query = mysql_query("SELECT firstname FROM prueba WHERE firstname='".$_POST['firstname']."'");
  6.  
  7. if (empty($_POST['firstname'])){
  8. $search_username_message = "<tr><td align=\"center\" bgcolor=\"#FFFFFF\" class=\"main\"><B>[ Debes ingresar un nombre de usuario ]</B></td></tr>";
  9. }
  10. else if (mysql_num_rows($query)==0){
  11. $search_username_message = "<tr><td align=\"center\" bgcolor=\"#FFFFFF\" class=\"main\"><B>[ El usuario no existe ]</B></td></tr>";
  12. }
  13. else {
  14. $search_username_message = "<script>document.location.href='".$_POST['firstname']."'</script>";
  15. }
  16. }
  17.  
  18. //Buscador  del select
  19. if (isset($_POST['search'])){
  20. $search_message = "<script>document.location.href='search_results.php?sexo=".$_POST['gender']."&&pais=".$_POST['pais']."&&estadocivil=".$_POST['estadocivil']."'</script>";
  21. }
  22. ?>


el form del search.php tiene un action asi  members_search_index.php?search=firstname  y en el html pongo algo asi <?php echo $user_ok['firstname'];?>  para que aparezcan los datos.


Ahora, lo que no me sale es el buscador del select

aca está el codigo del search_results.php:

Código
  1. ?php
  2.  
  3.  
  4. include_once ("connect.php");
  5. include_once("srh.php");
  6.  
  7. if(!isset($_POST['page'])){
  8. $page = 1;
  9. } else {
  10. $page = $_POST['page'];
  11. }
  12. $max_results = 3;
  13. $from = (($page * $max_results) - $max_results);
  14.  
  15. $query = mysql_query("SELECT * FROM prueba WHERE sexo='".$_POST['gender']."'  AND pais='".$_POST['pais']."' AND estadocivil='".$_POST['estadocivil']."' LIMIT $from, $max_results");
  16. if (mysql_num_rows($query)==0){
  17. echo "<span class=\"pages\"><center><B>No hay resultados[ <a href=\"search.php\" class=\"pages\">Atras</a> ]</B></center></span>";
  18. } else {
  19. $col = 0;
  20. echo '<tr>';
  21. while ($user_ok = mysql_fetch_array($query)){
  22.  
  23. if ($user_ok['gender']=='4'){
  24. echo 'Femenino';
  25. } else {
  26. echo 'Masculino';
  27. }
  28.  
  29. $col++;
  30. if ($col==3){
  31. echo "</tr><tr>";
  32. $col = 0;
  33. }
  34. }
  35. }
  36.  
  37.  
  38. $query = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM prueba WHERE sexo='".$_POST['gender']."'  AND pais='".$_POST['pais']."' AND estadocivil='".$_POST['estadocivil']."'"),0);
  39.  $total_pages = ceil($query / $max_results);
  40.  
  41.  if($page > 1){
  42.  $prev = ($page - 1);
  43.  echo "<a href=\"search_results.php?sexo=".$_POST['gender']."&&pais=".$_POST['pais']."&&estadocivil=".$_POST['estadocivil']."&&page=$prev\"><font color=\"black\"><B>Anterior</B></font></a> ";
  44.  }
  45.  for($i = 1; $i <= $total_pages; $i++){
  46.  if(($page) == $i){
  47.  echo "$i ";
  48.  } else {
  49.  echo "<a href=\"search_results.php?sexo=".$_POST['gender']."&&pais=".$_POST['pais']."&&estadocivil=".$_POST['estadocivil']."&&page=$i\"><font color=\"black\"><B>$i</B></font></a> ";
  50. }
  51. }
  52.  
  53. if($page < $total_pages){
  54. $next = ($page + 1);
  55. echo "<a href=\"search_results.php?sexo=".$_POST['gender']."&&pais=".$_POST['pais']."&&estadocivil=".$_POST['estadocivil']."&&page=$next\"><font color=\"black\"><B>Siguiente</B></font></a>";
  56. }
  57. echo "</center>";
  58. ?>



Gracias de antemano.

den_22
26  Programación / PHP / Re: Haciendo un buscador en: 4 Abril 2010, 21:51 pm
Bueno gracias, por haber contestado, Castg!, trataré de buscar algun tutorial, la otra vez, seguí tu consejo y lo pude resolver, al problema que tenia.

fede_cp, bueno buscaré alguno made in google, jaja, veremos...

Gracias.


den_22
27  Programación / PHP / Re: Haciendo un buscador en: 3 Abril 2010, 05:39 am
Bueno eso fue lo que hice, pero nada... Tal vez estoy haciendo algo mal en el show_results.php y por eso no se muestran los datos de otros usuarios.
28  Programación / PHP / Re: Haciendo un buscador en: 3 Abril 2010, 05:26 am
Algo asi?

if(!isset($usuario)){
 
echo 'No se ha seleccionado ningun usuario.';
 
}else{

Por que razon no se llegan a mostrar los resultados de los usuarios de la bd, cuando hago el select * from existe algo mal?, porque los datos los paso por post.

29  Programación / PHP / Re: Haciendo un buscador en: 3 Abril 2010, 05:10 am
Si, me olvidé de declarar la variable, pero igual no funciona. Gracias por responder
30  Programación / PHP / Haciendo un buscador en: 3 Abril 2010, 04:59 am
Hola que tal, estoy tratando de hacer un buscador tengo este archivo search.php, que la parte del php es algo asi:

Código
  1.  
  2. <?
  3. error_reporting(E_ALL ^ E_NOTICE);
  4. session_name('pLogin');
  5.  
  6. include("function.php");
  7. include("connect.php");
  8. include("getdata.php");
  9.  
  10. $query = mysql_query("select * from prueba where usuario='$usuario'");
  11.   $getname = mysql_fetch_array($query);
  12.   $firstname = $getname["firstname"];
  13.   $lastname =$getname["lastname"];
  14.   $gender= $getname["sexo"];
  15.   $estadocivil=$getname["estadocivil"];
  16.   $pais=$getname["pais"];
  17. ?>
  18.  

y la parte del html asi


Código
  1. <table width="470" height="254" border="1">
  2. <form action="search_results.php" method="post">
  3.  <tr>
  4.    <td width="189">Nombre:</td>
  5.    <td width="265"><?php echo $firstname;?><input type="text" name="firstname" class="main_text_normal" style="width: 100%;"></td>
  6.  </tr>
  7.  <tr>
  8.    <td>Apellido:</td>
  9.    <td><?php echo $lastname;?><input type="text" name="lastname" class="main_text_normal" style="width: 100%;"></td>
  10.  </tr>
  11.  <tr>
  12.    <td>Pais:</td>
  13.    <td><select size=1 NAME='pais'>
  14.  
  15.          <option <?php if ($user_ok[pais]=="Argentina") echo "selected"; ?>>Argentina</option>
  16.          <option <?php if ($user_ok[pais]=="Bolivia") echo "selected"; ?>>Bolivia</option>
  17.          <option <?php if ($user_ok[pais]=="Chile") echo "selected"; ?>>Chile</option>
  18.  <option <?php if ($user_ok[pais]=="Costa Rica") echo "selected"; ?>>Costa Rica</option>
  19.  <option <?php if ($user_ok[pais]=="Cuba") echo "selected"; ?>>Cuba</option>
  20.  <option <?php if ($user_ok[pais]=="Ecuador") echo "selected"; ?>>Ecuador</option>
  21.  <option <?php if ($user_ok[pais]=="El Salvador") echo "selected"; ?>>El Salvador</option>
  22.  <option <?php if ($user_ok[pais]=="Espana") echo "selected"; ?>>Espana</option>
  23.  <option <?php if ($user_ok[pais]=="Guatemala") echo "selected"; ?>>Guatemala</option>
  24.  <option <?php if ($user_ok[pais]=="Guinea Ecuatorial") echo "selected"; ?>>Guinea Ecuatorial</option>
  25.  <option <?php if ($user_ok[pais]=="Honduras") echo "selected"; ?>>Honduras</option>
  26.  <option <?php if ($user_ok[pais]=="México") echo "selected"; ?>>México</option>
  27.  <option <?php if ($user_ok[pais]=="Nicaragua") echo "selected"; ?>>Nicaragua</option>
  28.  <option <?php if ($user_ok[pais]=="Panamá") echo "selected"; ?>>Panamá</option>
  29.  <option <?php if ($user_ok[pais]=="Paraguay") echo "selected"; ?>>Paraguay</option>
  30.  <option <?php if ($user_ok[pais]=="Perú") echo "selected"; ?>>Perú</option>
  31.  <option <?php if ($user_ok[pais]=="Puerto Rico") echo "selected"; ?>>Puerto Rico</option>
  32.  <option <?php if ($user_ok[pais]=="República Dominicana") echo "selected"; ?>>República Dominicana</option>
  33.  <option <?php if ($user_ok[pais]=="Uruguay") echo "selected"; ?>>Uruguay</option>
  34.  <option <?php if ($user_ok[pais]=="Venezuela") echo "selected"; ?>>Venezuela</option>
  35.        </select> </td>
  36.  </tr>
  37.  <tr>
  38.    <td>Estado Civil: </td>
  39.    <td><select size=1 NAME='estadocivil'>
  40.          <option></option>
  41.          <option <?php if ($user_ok[estadocivil]=="Soltero/a") echo "selected"; ?>>Soltero/a</option>
  42.          <option <?php if ($user_ok[estadocivil]=="Divorciado/a") echo "selected"; ?>>Divorciado/a</option>
  43.  </select></td>
  44.  </tr>
  45.  <tr>
  46.    <td>Genero:</td>
  47.    <td><select size=1 NAME='sexo'>
  48.          <option></option>
  49.          <option <?php if ($user_ok[sexo]=="Masculino") echo "selected"; ?>>Masculino</option>
  50.          <option <?php if ($user_ok[sexo]=="Femenino") echo "selected"; ?>>Femenino</option>
  51.  
  52.        </select></td>
  53.  </tr>
  54.  </form>

ahora bien, al hacer click en buscar, llama al archivo search_results.php que es el siguiente:


Código
  1. <?
  2.  
  3. error_reporting(E_ALL ^ E_NOTICE);
  4.  
  5. session_name('pLogin');
  6. include('connect.php');
  7. $usuario = $_SESSION['usuario'];
  8.  
  9. $firstname=$_POST['firstname'];
  10. $lastname=$_POST['lastname'];
  11. $estadocivil=$_POST['estadocivil'];
  12. $gender=$_POST['sexo'];
  13. $pais=$_POST['pais'];
  14.  
  15.  
  16.  
  17. $query= mysql_query("select * from prueba where firstname='".$firstname."' AND lastname='".$lastname."'AND sexo='".$gender."' AND estadocivil='".$estadocivil."' AND pais='".$pais."'");
  18.  
  19.  
  20.  
  21. ?>
  22.  
  23.  

en el html de este archivo hago un <?php echo $firstname;?>, por ejemplo.

Mi pregunta es, en qué estoy fallando porque no me busca ningun usuario. Está bien como lo estoy haciendo?

De antemano gracias, solo busco algo de orientacion.
Páginas: 1 2 [3] 4 5 6 7
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines