Comunidad de diseño web y desarrollo en internet online

eliminar campo en forma de correo

Citar            
MensajeEscrito el 25 May 2009 09:38 pm
Hola! Llevo una semana tratando de arreglar esto y no he podido... alguien podría ayudarme?

Tengo un formulario con los siguientes datos:
Nombre:
Apellido:
Edad:
Email:
Email secundario:
Teléfono de oficina:
Hora de contacto:
Teléfono celular:
Hora de contacto:

Mi problema es que al momento de eliminar los campos de HORA DE CONTACTO, todo deja de funcionar.
Este es el script:


Código :

<?PHP 
session_start();
if(!isset($_SESSION['info_id']))
{
   ?>
    <script>window.location.href="itam1.php"</script>
    <?PHP
}
include_once('admin/DataLogic.php');
$dlogic=new DataLogic();
if(isset($_REQUEST['yes']) || $_REQUEST['yes']==1)
{

   @extract($_REQUEST);
   if($age == "15 a 18"|"18 a 22"|"22 a 25")
   {
      $result=$dlogic->delete_info($_SESSION['info_id']);
      unset($_SESSION['info_id']);
      session_destroy();
   ?>
    <script>window.location.href="thanks2OLD.php"</script>
    <?PHP
   }
   else
   {
      $a_o_i = explode(',',$area_of_intrest[1]);
      $result = $dlogic->update_information($name,$last_name,$age,$state,$email,$email2,$phone,$time_to_call,$phone2,$time_to_call2,$_SESSION['info_id'],$origin);
      
      if($result)
      {
         unset($_SESSION['info_id']);
         session_destroy();
      ?>
       <script>window.location.href="thanks1OLD.php"</script>
          <?PHP
      }
      
   }
   
}
$a_o_i=$dlogic->get_area_of_intrest();

?>
<html>
<head>
<title>ITAM</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
   background-color: #0d3d6e;
}
-->
</style>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function lengthRestriction(elem, min, max,msg,expression)
{
   var uInput = elem.value;
   if(uInput.length >= min && uInput.length <= max && uInput!="" && uInput.match(expression))
   {
      return true;
   }
   else
   {
      alert(msg);
      elem.focus();
      return false;
   }
}

function accents(elem, min, max,msg,expression)
{
   var uInput = elem.value;
   if(uInput.length >= min && uInput.length <= max && uInput!="" && !uInput.match(expression))
   {
      return true;
   }
   else
   {
      alert(msg);
      elem.focus();
      return false;
   }
}



function validateCombo(elem,msg)
{
   if(elem.value=="select")
   {
      alert(msg);
      elem.focus();
      return false;
   }
   else
   {
      return true;
      
   }

}


function validate()
{
   if(document.getElementById('name'))
   {
      var alphaExp = /^[0-9]+$/;
      if(accents(document.getElementById('name'), 3, 24,'Por favor, introduce tu nombre correctamente.',alphaExp))
      {
         if(document.getElementById('last_name'))
         {   
            var alphaExp = /^[0-9]+$/;
            //var alphaExp = /^[a-z A-Z]+$/;
            if(accents(document.getElementById('last_name'), 3, 29,'Por favor, introduce tu apellido correctamente.',alphaExp))
            {
               if(document.getElementById('age'))
               {   
                  if(validateCombo(document.getElementById('age'),'Seleccione Edad.'))
                  {
                  
                  //if(document.getElementById('state'))
                     //{   
                        //if(validateCombo(document.getElementById('state'),'Seleccione Estado donde reside.'))
                        //{
                           if(document.getElementById('email'))
                           {   
                              var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
                              if(lengthRestriction(document.getElementById('email'), 3, 39,'Por favor, introduce tu e-mail correctamente.',emailExp))
                              {
                     
                                 //if(document.getElementById('email2'))
                                 //{   
                                 //   var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
                                 //   if(lengthRestriction(document.getElementById('email2'), 3, 39,'Por favor, introduce tu e-mail correctamente.',emailExp))
                                 //   {
                                       if(document.getElementById('phone'))
                                       {   
                                          var numericExpression = /^[0-9]+$/;
                                          if(lengthRestriction(document.getElementById('phone'), 10, 10,'Por favor escribe tu número con lada y sin espacios',numericExpression))
                                          {   
                                             if(document.getElementById('time_to_call'))
                                             {   
                                             if(validateCombo(document.getElementById('time_to_call'),'Seleccione Mejor hora para llamar.'))
                                             {
                                                //if(document.getElementById('phone2'))
                                                //{   
                                                //   var numericExpression = /^[0-9]+$/;
                                                //   if(lengthRestriction(document.getElementById('phone2'), 10, 10,'Por favor escribe tu número con lada y sin espacios',numericExpression))
                                                //   {
                                                document.form1.submit();
                                                return true;
                                             //}
                                          //}
                                          //}
                                           //}
                                       }
                                     }
                                 }   
                              
                              }
                        
                           }
                        
                        }
                  
                     }
                  
                  } //email
            
               }
            
            }
            
         }
      
      
      
   }
   
}

</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="996" height="604" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top" background="images/bg.jpg" class="bg"><table width="996" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="196">&nbsp;</td>
      </tr>
      <tr>
        <td><table width="996" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="488" valign="top"><table width="98%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <th width="26%" height="43" scope="col">&nbsp;</th>
                <th width="68%" valign="top" scope="col"><div align="left" class="headings">  Excelencia Acad&eacute;mica </div></th>
                <th width="6%" scope="col">&nbsp;</th>
              </tr>
              <tr>
                <th height="245" scope="col">&nbsp;</th>
                <th valign="top" scope="col" class="text2" align="left"><p class="text2">En el ITAM siempre hemos reconocido la excelencia de nuestros profesores como nuestro principal valor; todos ellos cuentan con una amplia y reconocida trayectoria profesional, y con una formaci&oacute;n acad&eacute;mica del m&aacute;s alto nivel. </p>
                  <p>Adem&aacute;s, nuestros programas acad&eacute;micos est&aacute;n dise&ntilde;ados a partir de las necesidades reales del mercado laboral y social. Por eso, Extensi&oacute;n Universitaria del ITAM te ofrece una formaci&oacute;n continua para mantener el nivel profesional que necesitas.</p></th>
                <th scope="col">&nbsp;</th>
              </tr>
            </table></td>
            <td width="500"><form name="form1" method="post" action="" onSubmit="return verify();">
              <table width="98%" height="472"  border="0" align="right" cellpadding="0" cellspacing="0">
                <tr>
                  <th height="30" colspan="4" valign="top" class="text2" scope="col"><table width="66%"  border="0" align="left" cellpadding="0" cellspacing="0">
                    <tr>
                      <th height="60" valign="top" scope="col"><div align="center" class="heading2">Est&aacute;s a s&oacute;lo un paso del<br />
                        nivel ITAM</div></th>
                    </tr>
                    <tr>
                      <td height="21"><div align="center" class="text">Paso 2 de 2</div></td>
                    </tr>
                  </table></th>
                  </tr>
                
                <tr>
                  <th colspan="2" valign="top" class="text2" scope="col">&nbsp;</th>
                  <th valign="top" scope="col">&nbsp;</th>
                  <th height="19" valign="top" scope="col">&nbsp;</th>
                </tr>
                <tr>
                  <th width="19%" colspan="2" valign="top" class="text2" scope="col"><div align="right">Nombre:</div></th>
                  <th width="3%" valign="top" scope="col">&nbsp;</th>
                  <th width="78%" height="30" valign="top" scope="col"><div align="left">
                      <input name="name" type="text" class="drop-down-page2" id="name" size="20">
                  </div></th>
                </tr>
                <tr>
                  <td height="30" colspan="2" valign="top" class="text2"><div align="right">Apellido:</div></td>
                  <td valign="top">&nbsp;</td>
                  <td height="30" valign="top"><div align="left">
                      <input name="last_name" type="text" class="drop-down-page2" id="last_name" size="20">
                  </div></td>
                </tr>
                <tr>
                  <td height="30" colspan="2" valign="top" class="text2"><div align="right">Edad:</div></td>
                  <td height="30" valign="top">&nbsp;</td>
                  <td height="30" valign="top"><div align="left">
                      <label for="select"></label>
                      <select name="age" class="drop-down-page2" id="age">
                       <option value="select">Seleccione</option>
                        <option value="15 a 18" >15 a 18</option>
                        <option value="18 a 22">18 a 22</option>
                        <option value="22 a 25">22 a 25</option>
                        <option value="25 a 30">25 a 30</option>
                        <option value="30 a 40">30 a 40</option>
                        <option value="40 a 50">40 a 50</option>
                        <option value="50 a 60">50 a 60</option>
                        <option value="M&aacute;s de 60">M&aacute;s de 60</option>
                      </select>
                  </div></td>
                </tr>
                <tr>
                  <td colspan="2" valign="top" class="text2"><div align="right">Email:</div></td>
                  <td valign="top">&nbsp;</td>
                  <td height="30" valign="top"><input name="email" type="text" class="drop-down-page2" id="email"></td>
                </tr>
                <tr>
                  <td colspan="2" valign="top" class="text2"><div align="right">Email secundario:</div></td>
                  <td valign="top">&nbsp;</td>
                  <td height="30" valign="middle"><input name="email2" type="text" class="drop-down-page2" id="email2"></td>
                </tr>
                <tr>
                  <td colspan="2" valign="top" class="text2"><div align="right">Tel&eacute;fono de oficina:</div></td>
                  <td valign="top">&nbsp;</td>
                  <td height="30" valign="top"><input name="phone" type="text" class="drop-down-page2" id="phone" /></td>
                </tr>
                <tr>
                  <td colspan="2" valign="top" class="text2"><div align="right">Mejor hora para llamar:</div></td>
                  <td valign="top">&nbsp;</td>
                  <td height="30" valign="middle"><select name="time_to_call" class="drop-down-page2" id="time_to_call">
                    <option value="select">Seleccione</option>
                      <option value="7:00 AM">7:00 AM</option>
                      <option value="8:00 AM">8:00 AM</option>
                      <option value="9:00 AM">9:00 AM</option>
                      <option value="10:00 AM">10:00 AM</option>
                      <option value="11:00 AM">11:00 AM</option>
                      <option value="12:00 PM">12:00 PM</option>
                      <option value="1:00 PM">1:00 PM</option>
                      <option value="2:00 PM">2:00 PM</option>
                      <option value="3:00 PM">3:00 PM</option>
                      <option value="4:00 PM">4:00 PM</option>
                      <option value="5:00 PM">5:00 PM</option>
                      <option value="6:00 PM">6:00 PM</option>
                      <option value="7:00 PM">7:00 PM</option>
                      <option value="8:00 PM">8:00 PM</option>
                      <option value="9:00 PM">9:00 PM</option>
                      <option value="10:00 PM">10:00 PM</option>
                  </select></td>
                </tr>
                <tr>
                  <td colspan="2" valign="top" class="text2"><div align="right">Tel&eacute;fono celular:</div></td>
                  <td valign="top">&nbsp;</td>
                  <td height="30" valign="middle"><input name="phone2" type="text" class="drop-down-page2" id="phone2" /></td>
                </tr>
                <tr>
                  <td colspan="2" valign="top" class="text2"><div align="right">Mejor hora para llamar:</div></td>
                  <td valign="top">&nbsp;</td>
                  <td height="30" valign="middle"><select name="time_to_call2" class="drop-down-page2" id="time_to_call2">
                      <option value="">Seleccione</option>
                      <option value="7:00 AM">7:00 AM</option>
                      <option value="8:00 AM">8:00 AM</option>
                      <option value="9:00 AM">9:00 AM</option>
                      <option value="10:00 AM">10:00 AM</option>
                      <option value="11:00 AM">11:00 AM</option>
                      <option value="12:00 PM">12:00 PM</option>
                      <option value="1:00 PM">1:00 PM</option>
                      <option value="2:00 PM">2:00 PM</option>
                      <option value="3:00 PM">3:00 PM</option>
                      <option value="4:00 PM">4:00 PM</option>
                      <option value="5:00 PM">5:00 PM</option>
                      <option value="6:00 PM">6:00 PM</option>
                      <option value="7:00 PM">7:00 PM</option>
                      <option value="8:00 PM">8:00 PM</option>
                      <option value="9:00 PM">9:00 PM</option>
                      <option value="10:00 PM">10:00 PM</option>
                  </select></td>
                </tr>
                <tr valign="bottom">
                  <td class="text2"><div align="left"></div>
                      <div align="left"></div></td>
                  <td colspan="3" class="text2"><a href="#"><img src="images/button2.gif" width="298" height="33" border="0" onClick="return validate();" style="cursor:pointer"/></a></td>
                </tr>
              </table>
              <input type="hidden" name="yes" id="yes"  value="1"/> 
                     <input type="hidden" name="origin" id="origin" value="2"/>
            </form></td>
            <td width="10">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="996" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <th height="96" background="images/ITAM1_02.jpg" scope="col">&nbsp;</th>
  </tr>
</table>
<!-- ImageReady Slices (ITAM.psd) -->
<!-- End ImageReady Slices -->
</body>
</html>


Ahora.. tmb está el archivo: DataLogic.php y esto es lo que contiene:

Código :

<?php
include_once("DBaccess.php");
Class DataLogic extends DBaccess
{

function login($uname,$pwd)
{
   $this->connectToDB();
     $result=$this->CustomQuery("SELECT *  from users  where user_name='".$uname."' and user_password = '".$pwd."'");
   $this->DBDisconnect();
   return $result;
}

function get_area_of_intrest()
{
   $this->connectToDB();
   $result=$this->CustomQuery("SELECT *  from area_of_intrest where status=1");
   $this->DBDisconnect();
   return $result;
}

function get_program_of_intrest_by_area_id($area_of_intrest_id)
{
   $this->connectToDB();
   $result=$this->CustomQuery("select * from program_of_intrest where area_of_intrest_id='$area_of_intrest_id' and status=1");
   $this->DBDisconnect();
   return $result;
}

function insert_information($area_of_intrest,$program_of_intrest,$education_level,$work, $reason)
{
   $area_of_intrest=addslashes($area_of_intrest);
   $program_of_intrest=addslashes($program_of_intrest);
   $education_level=addslashes($education_level);
   $work=addslashes($work);
   $reason=addslashes($reason);
   $this->connectToDB();
    $table = "information";
   $insert = "`area_of_intrest`,`program_of_intrest`,`education_level`,`work`,`reason`";
   $values = "'$area_of_intrest','$program_of_intrest','$education_level','$work','$reason'";
   $result = $this->InsertRecord($table,$insert,$values);
   $this->DBDisconnect();
   return $result;
}

function get_all_requesters()
{
   $this->connectToDB();
  
   $result=$this->CustomQuery("SELECT *  from information order by id desc");
   $this->DBDisconnect();
   return $result;
}

function get_all_requesters_from_to($from,$to)
{
   $this->connectToDB();
  
   $result=$this->CustomQuery("SELECT *  from information  order by id desc limit $from, $to");
   $this->DBDisconnect();
   return $result;
}



function delete_info($id)
{
   $this->connectToDB();
    $table = "information";
   $insert = "`id`";
   $values = "'$id'";
   $result=$this->DeleteSetOfRecords($table,$insert,$values);
   $this->DBDisconnect();
   return $result;
}

function update_information($name,$last_name,$age,$state,$email,$email2,$phone,$time_to_call,$phone2,$time_to_call2,$id,$origin)
{
   $name=addslashes($name);
   $last_name=addslashes($last_name);
   $state=addslashes($state);
   
   $this->connectToDB();
   echo 
   $result=$this->CustomModify("update information set  name='$name', last_name='$last_name',age='$age', state='$state',email='$email',email2='$email2', phone='$phone', time_to_call='$time_to_call',phone2='$phone2',time_to_call2='$time_to_call2',origin='$origin',`datetime`='".date("y-m-d h:i:s")."' where id=$id");
   $this->DBDisconnect();
   return $result;
}


function request_information($name,$last_name,$city,$email,$phone,$origin,$pais)
{

   $name=addslashes($name);
   $last_name=addslashes($last_name);
    $this->connectToDB();
    $table = "info";
   $insert = "`name`,`last_name`,`city`,`email`,`phone`,`origin`,`pais`,`recieve_date`";
   $values = "'$name','$last_name','$city','$email','$phone','$origin','$pais','".date('Y-m-d h:i:s')."'";
   $result = $this->InsertRecord($table,$insert,$values);
   $this->DBDisconnect();
   return $result;
}



function get_selected_requesters($info_id)
{
   $this->connectToDB();
  
   $result=$this->CustomQuery("SELECT *  from info where info_id='$info_id'");
   $this->DBDisconnect();
   return $result;
}



function change_pass($user_name,$old_pass,$new_pass)
{   $this->connectToDB();
   $sql="select * from users where user_name='$user_name' and user_password='$old_pass'";
   $res=mysql_query($sql);
   if(mysql_num_rows($res)>0)
   {
      if(mysql_query("update users set user_password='$new_pass' where user_name='$user_name'"))
      {
         return true;
      }
      else
      {
         return false;
      }
   
   }
   else
   {
      echo "<table border=1 class=outer_tbl align=center width=50% style='border-collapse:collapse;'>";
      echo "<tr><td align=center>";
      echo "Contraseña no coincide<br><a href='javascript:history.back();'>Espalda</a>";   
      echo "</tr></td></table>";
      die();

   
   }
}


}//class end bracket
?>


qué debo hacer??? borrar los $time_to_call y $time_to_call2 ??? debo hacer cambios en la base de datos???
AYÚDENME POR FAVOR!

Por bizarrismo

9 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 25 May 2009 11:50 pm
Cuando borras campos de las tablas, te crea problemas en los querys donde mandes llamar esos campos probablemente tambien tengas que modificar los querys donde estes usando esos campos, ya sea para consulta o escritura y actualizacion de registros.

Espero te sirva de ayuda esta respuesta.
=)

Por estebanoc

3 de clabLevel



 

msie7
Citar            
MensajeEscrito el 26 May 2009 01:09 am
perdón.. qué es un query?



estebanoc escribió:

Cuando borras campos de las tablas, te crea problemas en los querys donde mandes llamar esos campos probablemente tambien tengas que modificar los querys donde estes usando esos campos, ya sea para consulta o escritura y actualizacion de registros.

Espero te sirva de ayuda esta respuesta.
=)

Por bizarrismo

9 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 26 May 2009 01:43 am

estebanoc escribió:

Cuando borras campos de las tablas, te crea problemas en los querys donde mandes llamar esos campos probablemente tambien tengas que modificar los querys donde estes usando esos campos, ya sea para consulta o escritura y actualizacion de registros.

Espero te sirva de ayuda esta respuesta.
=)


ya investigé, lo cambié, pero sigue sin andar

Por bizarrismo

9 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 26 May 2009 01:53 am
¿Que errores te estan marcando entonces ? igual y puede ser alguna variable o algo que estes omitiendo pero si me mandas el error seria mas facil ayudarte.

Por estebanoc

3 de clabLevel



 

msie
Citar            
MensajeEscrito el 26 May 2009 03:24 am

estebanoc escribió:

¿Que errores te estan marcando entonces ? igual y puede ser alguna variable o algo que estes omitiendo pero si me mandas el error seria mas facil ayudarte.


Te dejo aca los archivos:
[url=http://creaquake.com/files.zip][/url]

Por bizarrismo

9 de clabLevel



Genero:Masculino  

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.