Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/12/2008, 12:54
Avatar de syntex
syntex
 
Fecha de Ingreso: noviembre-2002
Ubicación: Cataluña
Mensajes: 978
Antigüedad: 21 años, 5 meses
Puntos: 4
Respuesta: problemas php con signo '

Como ariais para poder gravar en la BD con una variable $c10 para no tener problemas con el signo '.

Código PHP:
<?
if (trim($_POST['c1']) =="" or trim($_POST['c2']) =="" or trim($_POST['c3']) =="" or trim($_POST['c4']) =="" or trim($_POST['c5']) =="" or trim($_POST['c7']) =="" or trim($_POST['c8']) =="" or trim($_POST['c9']) =="" or trim($c10) =="" or trim($_POST['c11']) == or $c12 ==""){
// **************************************************** 1 *********************************************
include("./Anuncios/Anuncio1.php");
}
?>
<?
//******************************* ANUNCIO 2
if (trim($_POST['c1']) !="" and trim($_POST['c2']) !="" and trim($_POST['c3']) !="" and trim($_POST['c4']) !="" and trim($_POST['c5']) !="" and trim($_POST['c7']) !="" and trim($_POST['c8']) !="" and trim($_POST['c9']) !="" and trim($c10) !="" and trim($_POST['c11']) != and $c12 !="" and $SUB != "Pasar al paso 3 .>" and $SUB != "Pasar al paso 4 .>" and $LUPIT == ""){
// **************************************************** 2 *********************************************
include("./Anuncios/Anuncio2.php");
}
?>
<?
//******************************* ANUNCIO 3
if (trim($_GET[c1]) !="" and trim($_POST['c2']) !="" and trim($_POST['c3']) !="" and trim($_POST['c4']) !="" and trim($_POST['c5']) !="" and trim($_POST['c7']) !="" and trim($_POST['c8']) !="" and trim($_POST['c9']) !="" and trim($c10) !="" and trim($_POST['c11']) !="" and trim($c12) !="" and $SUB == "Pasar al paso 4 .>" and $SUB1 !="" and trim($_POST['p1']) !="" and trim($_POST['p1']) == trim($_POST['p2'])  and $SEGURO ==  strtolower($_POST[COD]) and $_GET[ZZ] == ""){
include(
"./Anuncios/Enviar_correo.php");
}
?>
Anuncio 1 (con el primer formulario donde esta el textarea con la variable $c10
Código PHP:
echo"</form><form action='' method='post' id='Form1'>";
echo
"<input type=hidden name='a' value='$a'>";
echo
"<input type=hidden name='c' value='$c'>";
echo
"<input type=hidden name='len' value='$len'>";
echo
"<input type=hidden name='c1' value='".$_GET[c1]."'>";
echo
"<input type=hidden name='cc1' value='".$_GET[cc1]."'>";
echo
"<input type=hidden name='AnDe' value='".$_GET[AnDe]."'>";
echo
"<input type=hidden name='MODOS' value='$MODOS'>";
echo
"<td valign=top><div align=right><FONT SIZE=2 COLOR=#DB5E0D><b>Descripción.: <td valign=top><textarea name=\"c10\" cols=\"60\" rows=\"10\" $CAMPO>".htmlspecialchars(stripslashes($c10))."</textarea><tr>";
echo
"<td style=\"border:solid 1px #cccccc;\" colspan=10 bgcolor=#f1f1f1><div align=left>
    <input type='submit' value='Siguiente .>' name='SI' $CAMPO onclick=\"submitForm();\">
    <input type='reset' value='Resetear .>' name='' $CAMPO>
    <tr>"
;
echo
"</form>"
Anuncio 2 (con el segundo formulario
Código PHP:
echo "</form>";
echo
"<form action='' method='post' enctype='multipart/form-data'>";
echo
"<input type=hidden name='a' value='$a'>";
echo
"<input type=hidden name='len' value='$len'>";
echo
"<input type=hidden name='c' value='$c'>";
echo
"<input type=hidden name='cc1' value='$cc1'>";
echo
"<input type=hidden name='c1' value='$c1'>";
echo
"<input type=hidden name='c2' value='".htmlspecialchars(stripslashes($c2))."'>";
echo
"<input type=hidden name='c3' value='".htmlspecialchars(stripslashes($c3))."'>";
echo
"<input type=hidden name='c4' value='$c4'>";
echo
"<input type=hidden name='c5' value='$c5'>";
echo
"<input type=hidden name='cc5' value='".htmlspecialchars(stripslashes($cc5))."'>";
echo
"<input type=hidden name='c6' value='$c6'>";
echo
"<input type=hidden name='c7' value='$c7'>";
echo
"<input type=hidden name='c8' value='$c8'>";
echo
"<input type=hidden name='c9' value='".htmlspecialchars(stripslashes($c9))."'>";
echo
"<input type=hidden name='c10' value='".htmlspecialchars(stripslashes($c10))."'>";
echo
"<input type='submit' value='Pasar al paso 3 .>' name='SUB' $CAMPO> 
    <input type='submit' value='<. Atrás' name='SUB' $CAMPO>"
;
echo
"</form>"
Anuncio 3 y gravar en la base de datos
Código PHP:
if(mysql_query("UPDATE venta SET Categoria='$cc1',Subcategoria='$c1',Provincia='$c4',Anuncio='$c8',Nombre='".htmlspecialchars(stripslashes($c2))."',Apellidos='".htmlspecialchars(stripslashes($c3))."',Correo='".strtolower(trim($c7))."',Telefono='".trim($c5)."',Titulo='".htmlspecialchars(stripslashes($c9))."',Descripcion='".$c10."',Precio='".trim($c11)."',Usuario='".strtolower(trim($c7))."',Password='-',Finalizado='Si',Poblacion='".htmlspecialchars(stripslashes($cc5))."',Oculto='$c6',UsuarioEncriptado='".md5(trim(strtolower($c7)))."',PassEncriptado='".md5(trim(strtolower($p1)))."',Avanzado='".$_GET[MODOSSUSI]."',Part_Emp='$AnDe',Nombre_Comercial='".htmlspecialchars(stripslashes($empresa))."',Ref_Producto='$ref',Dto='$dto' WHERE (Id='$IDpx')",$conexion))
    {} 
Me podeis mejorar la variable $c10 para el tipo de carácter '?

Gracias
__________________
------------------------------------------------
La paciencia es el rey de la ciencia
------------------------------------------------