Foros del Web » Programando para Internet » PHP »

Ayuda Urgente :) Porfavor!

Estas en el tema de Ayuda Urgente :) Porfavor! en el foro de PHP en Foros del Web. NOSE SI ES EL LUGAR INDICADO PARA PONER ESTE MENSAJE PERO COMO NO ALCANCE A VER SUBFOROS RELACIONADOS CON ESTE LO PUSE AQUI MISMO TENGO ...
  #1 (permalink)  
Antiguo 06/04/2008, 23:02
 
Fecha de Ingreso: agosto-2005
Mensajes: 12
Antigüedad: 18 años, 8 meses
Puntos: 0
Ayuda Urgente :) Porfavor!

NOSE SI ES EL LUGAR INDICADO PARA PONER ESTE MENSAJE PERO COMO NO ALCANCE A VER SUBFOROS RELACIONADOS CON ESTE LO PUSE AQUI MISMO

TENGO EL SIGUIENTE "PROBLEMA" QUE SEGUN TENGO ENTENDIDO ES FACIL DE HACER CON JAVASCRIPT PERO HASTA AHORA NOSE COMO HACERLO

TENGO UN FORMULARIO CON 2 TEXTFIELDS, UNO DE CURP Y OTRO DEL NOMBRE DEL ASIPIRANTE A ENTRAR A UN SISTEMA "X"

<?php require_once('Connections/cn3.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO aspiran (CURP, NOM_ASP) VALUES (%s, %s)",
GetSQLValueString($_POST['CURP'], "text"),
GetSQLValueString($_POST['NOM_ASP'], "text"));

mysql_select_db($database_cn3, $cn3);
$Result1 = mysql_query($insertSQL, $cn3) or die(mysql_error());
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">CURP:</td>
<td><input type="text" name="CURP" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">NOMBRE:</td>
<td><input type="text" name="NOM_ASP" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td><input type="submit" value="Insert record" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
</body>
</html>

EL PROBLEMA O AYUDA ES QUE NECESITO QUE EN VEZ DE SER UN SOLO TEXTFIELD EN EL NOMBRE DEL ASPIRANTE "NOM_ASP" SEAN 3 POR EJEMPLO: UNO PARA EL APELLIDO PATERNO, OTRO PARA EL MATERNO Y OTRO PARA EL NOMBRE Y AL MOMENTO DE ENVIARLO LOS JUNTE PARA QUE VAYAN EN UN SOLO CAMPO NOSE SI ME EXPLIQUE

ESPERO ME PUEDAN AYUDAR

Última edición por sammaeliv; 06/04/2008 a las 23:07
  #2 (permalink)  
Antiguo 06/04/2008, 23:22
 
Fecha de Ingreso: noviembre-2005
Mensajes: 222
Antigüedad: 18 años, 5 meses
Puntos: 2
Re: Ayuda Urgente :) Porfavor!

solo tienes que recoger los 3 campos de texto y luego concatenarlos.

$resultante = "$_POST[nombre].$_POST[apellido_1].$_POST[apellido_2]";

Última edición por jovendigital; 08/04/2008 a las 09:33 Razón: perdon, olvide poner los puntos
  #3 (permalink)  
Antiguo 07/04/2008, 19:36
 
Fecha de Ingreso: agosto-2005
Mensajes: 12
Antigüedad: 18 años, 8 meses
Puntos: 0
Re: Ayuda Urgente :) Porfavor!

Oye man me marca un error en esa linea la quedaria algo asi segun yo:

$resultante = "$_POST['NOM_ASP']$_POST['NOM_ASP2']$_POST['NOM_ASP3']"
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO aspiran (CURP, NOM_ASP) VALUES (%s, %s)",
GetSQLValueString($_POST['CURP'], "text"),
GetSQLValueString($resultante, "text"));

en que estoy mal? xD tengo el presentimiento que en todo xD
  #4 (permalink)  
Antiguo 07/04/2008, 19:54
 
Fecha de Ingreso: agosto-2005
Mensajes: 12
Antigüedad: 18 años, 8 meses
Puntos: 0
Re: Ayuda Urgente :) Porfavor!

Ya quedo man xD era nadamas de modificar esta linea GetSQLValueString($_POST['NOM_ASP'], "text"); por esta: GetSQLValueString($_POST['NOM_ASP'].$_POST['NOM_ASP2'].$_POST['NOM_ASP3'], "text"); no sabia como ponerla :) gracias man!!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:06.