Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/04/2010, 18:12
den_22
 
Fecha de Ingreso: enero-2010
Mensajes: 198
Antigüedad: 14 años, 3 meses
Puntos: 1
Respuesta: problema con formulario

Aqui lo pongo

Código PHP:
Ver original
  1. <?php
  2. error_reporting(E_ALL ^ E_NOTICE);
  3. session_name('pLogin');
  4.  
  5.  
  6. include("connect.php");
  7.  
  8. $usuario=$_SESSION['usuario'];
  9. $id=$_SESSION['id'];
  10.  
  11. function main()
  12. {
  13.  
  14. $subject="";
  15. $msg="";
  16. $label="Reply";
  17. $tid=0;
  18. if(isset($_REQUEST["tid"]))
  19. {
  20. $tid=$_REQUEST["tid"];
  21. }
  22. elseif(isset($_REQUEST["id"]))
  23. {
  24.     $label="Contact Member";
  25.     $id=$_REQUEST["id"];
  26.     $tid=$_REQUEST["id"];
  27.    
  28. }
  29.  
  30. if(isset($_REQUEST["type"])&&($_REQUEST["type"]=="contact"))
  31. {
  32. $label="Send IM";
  33. }
  34. if(isset($_REQUEST["mid"]))
  35. {
  36. $mid=$_REQUEST["mid"];
  37. $rst0=mysql_fetch_array(mysql_query("select * from dm_messages where usuario='$usuario'"));
  38. $subject="Re:".$rst0["dm_subject"];
  39. $msg="MESSAGE:: ".$rst0["dm_message"];
  40. }
  41.  
  42.  $row=mysql_fetch_array(mysql_query("select * from prueba where id=$tid"));
  43.           if(!$row)
  44.           {
  45.             echo "<p>&nbsp;</p><p>&nbsp;</p><br><br><br><div align='center'><font size=2 color='#333333' face='Arial, Helvetica, sans-serif'>Recipient Not Found. Click <a href='index.php' class='insidelink'>here</a> to continue</font></div><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>";
  46.             return;
  47.           }
  48.           else
  49.           {
  50.  
  51. ?>
  52. <script language="javascript" >
  53.  //<!--
  54.  function Validate(form)
  55.  {
  56.  if(form.subject.value== "")
  57.  {
  58.  alert ('Ingresa el Asunto!');
  59.  form.subject.focus();
  60.  return false;
  61.  }
  62.  if(form.subject.value.match(/[&<>]+/))
  63.  {
  64.  alert("Remueve los caracteres inválidos del Asunto (e.j. &  < >)");
  65.  form.subject.focus();
  66.  return(false);
  67.  }
  68.  
  69.  if(form.message.value== "")
  70.  {
  71.  alert ('Ingresa tu Mensaje!');
  72.  form.message.focus();
  73.  return false;
  74.  }
  75.  if(form.message.value.match(/[&<>]+/))
  76.  {
  77.  alert("Remueve los caracteres inválidos del Mensaje (e.j. &  < >)");
  78.  form.message.focus();
  79.  return(false);
  80.  }
  81.  
  82.  return true;
  83.  }
  84.  //-->
  85.  </script>
  86.  
  87. <table width="100%" border="0" cellpadding="0" cellspacing="0" >
  88.   <tr>
  89.     <td  valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  90.         <tr>
  91.           <td valign="middle" align="center"><font class="normal">
  92.  
  93.             <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
  94.                       <tr>
  95.                         <td height="25"  class="titlestyle">&nbsp;<?php echo $label;?></td>
  96.                       </tr>
  97.               <tr>
  98.                 <td>
  99.                     <table width="100%" border="0" align="center" cellpadding="2" cellspacing="5" ><form name="form1" method="post"  onSubmit="return Validate(this);" action="insert_message.php">
  100.                       <tr>
  101.                         <td width="40%" height="25" valign="top"  class="innertablestyle">
  102.                           <div align="right"><strong>Para</strong></div></td>
  103.                         <td width="6" height="25" valign="top">&nbsp;</td>
  104.                         <td width="60%" height="25" valign="top"><font class='normal'>
  105.                           <input type="text" name="to"  readonly="" value=" <?php
  106.       echo $row["usuario"];?>">
  107.                           </font> </td>
  108.                       </tr>
  109.                       <tr>
  110.                         <td width="40%" height="25" valign="top"  class="innertablestyle">
  111.                           <div align="right"><strong><font size="2">Asunto:</font></strong></div></td>
  112.                         <td width="6" height="25" valign="top"><font size="2"><strong><font class='normal'><font class='red'>*</font>
  113.                           </font></strong></font></td>
  114.                         <td width="60%" height="25" valign="top"><font class='normal'>
  115.                           <input name="subject" type="text" size="60" <?php
  116.         echo "value='" .$subject. "'";
  117.         ?> >
  118.                           <input name="fid" type="hidden" value="<?php echo $_SESSION["id"]; ?>">
  119.                           <input name="id" type="hidden" value="<?php echo $tid; ?>">
  120.                           <input name="sb_type" type="hidden" id="sb_type" value="<?php
  121.                           if(isset($_REQUEST["sb_type"]))                        
  122.                           { echo $_REQUEST["sb_type"];}
  123.                           else
  124.                           {echo 0;} ?>">
  125.                           <input name="id" type="hidden" id="id" value="<?php
  126.                           if(isset($_REQUEST["id"]))                         
  127.                           { echo $_REQUEST["id"];}
  128.                           else
  129.                           {echo 0;} ?>">
  130.                           </font></td>
  131.                       </tr>
  132.                       <tr>
  133.                         <td width="40%" height="25" valign="top"  class="innertablestyle">
  134.                           <div align="right"><font size="2"><strong><?php echo $row['usuario'];?>Mensaje<font class='normal'></font> </strong></font></div></td>
  135.                         <td width="6" height="25" valign="top"><font size="2"><strong><font class='normal'><font class='red'>*</font>
  136.                           </font></strong></font></td>
  137.                         <td width="60%" height="25"  valign="top"> <div align="left"><font class='normal'>
  138.                             </font>
  139.                             <textarea name="message" cols="60" rows="10"><?php echo $msg;?></textarea>
  140.                           </div></td>
  141.                       </tr>
  142.                       <tr>
  143.                         <td width="40%" height="25" valign="top"  class="innertablestyle"></td>
  144.                         <td width="6" height="25" valign="top">&nbsp;</td>
  145.                         <td width="60%" height="25"  valign="top"> <input type="submit" name="Submit" value="Post Message"></td>
  146.                       </tr>
  147.                </form> </table>
  148.                   </td>
  149.               </tr>
  150.             </table>
  151.            </font></td>
  152.         </tr>
  153.       </table></td>
  154.   </tr>
  155.  
  156. </table>
  157.  
  158. <?php
  159. }
  160.  
  161. }
  162.  
  163. ?>