Hi,
i've the same problem with addslashes. I follow your inscructions posted on #4722 as:
I changed the Autogenerated code to read "'".addslashes($_POST['textarea_1'])."' ," and the form now works well.
but in my autogenerated code doesn't seems equal as your solution, i haven't any
$_POST['variable'] string in it, i've got
'".JRequest::getVar('variable','', 'post', 'string', '' )."' instead of it.
How can I put the addslashes php function in it? I tried to make the equivalent with javascript, but doesn't work as expected.
Here is the auto-generated code:
- Code: Select all
<?php
$database =& JFactory::getDBO();
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
$database->setQuery( "INSERT INTO #__chronoforms_2 VALUES (
'' , '".$inum."','". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' , '".JRequest::getVar('nom','', 'post', 'string', '' )."' , '".JRequest::getVar('cognoms','', 'post', 'string', '' )."' , '".JRequest::getVar('organitzacio','', 'post', 'string', '' )."' , '".JRequest::getVar('direccio','', 'post', 'string', '' )."' , '".JRequest::getVar('poblacio','', 'post', 'string', '' )."' , '".JRequest::getVar('provincia','', 'post', 'string', '' )."' , '".JRequest::getVar('codipostal','', 'post', 'string', '' )."' , '".JRequest::getVar('pais','', 'post', 'string', '' )."' , '".JRequest::getVar('correu_e','', 'post', 'string', '' )."' , '".JRequest::getVar('telefon','', 'post', 'string', '' )."' , '".JRequest::getVar('idioma','', 'post', 'string', '' )."' , '".JRequest::getVar('perfil','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_titol','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_categoria','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_corpus','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_any','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_pais','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_durada','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_subtitols','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_requeriments','', 'post', 'string', '' )."' , '".JRequest::getVar('obra_sinopsis','', 'post', 'string', '' )."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
Thanks and sorry by my poor english.