Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/09/2008, 14:59
Avatar de destor77
destor77
 
Fecha de Ingreso: noviembre-2004
Ubicación: Gálvez, Santa Fe, Argentina
Mensajes: 2.654
Antigüedad: 19 años, 6 meses
Puntos: 43
popup y unterminated string literal

hola:
tengo que validar un formulario con javascript y si el mismo tiene algun error mostrar un popup.
Para validar uso este codigo php dentro de la funcion javascript chekform():
Código PHP:
function checkForm() {
          <?php
              
include ('form_functions.php');
            
$mensaje="";
            if(
trim($_REQUEST["first_name"]) == ""){
                
$mensaje.="Please specify your First Name ";
            }
            
            if(
trim($_REQUEST["last_name"]) == ""){
                
$mensaje.="Please specify your Last Name \n";
            }
            
            
$ss trim($_REQUEST["ss1"]).trim($_REQUEST["ss2"]).trim($_REQUEST["ss3"]);
            if (!empty(
$ss) && !(
                
preg_match("/[0-9]{3}/",$_REQUEST["ss1"]) &&
                
preg_match("/[0-9]{2}/",$_REQUEST["ss2"]) &&
                
preg_match("/[0-9]{4}/",$_REQUEST["ss3"])
                ) ) {
                
$mensaje.="Please specify your SS#<br/>";
            }
            
            
            if(
trim($_REQUEST["home_address"]) == ""){
                
$mensaje.="Please specify your Home Address \n";
            }
            if(
trim($_REQUEST["city"]) == ""){
                
$mensaje.="Please specify your City \n";
            }
            if(
trim($_REQUEST["state"]) == ""){
                
$mensaje.="Please specify your State \n";
            }
            if(
trim($_REQUEST["zip"]) == ""){
                
$mensaje.="Please specify your Zip \n";
            }
            if(
trim($_REQUEST["county"]) == ""){
                
$mensaje.="Please specify your County \n";
            }
            
            if (empty(
$_REQUEST["home_as_billing"])) {
            
                if(
trim($_REQUEST["billing_address"]) == ""){
                    
$mensaje.="Please specify your Business Address \n";
                }
                if(
trim($_REQUEST["billing_city"]) == ""){
                    
$mensaje.="Please specify your City (Business) \n";
                }
                if(
trim($_REQUEST["billing_state"]) == ""){
                    
$mensaje.="Please specify your State (Business) \n";
                }
                if(
trim($_REQUEST["billing_zip"]) == ""){
                    
$mensaje.="Please specify your Zip (Business) \n";
                }
                if(
trim($_REQUEST["billing_county"]) == ""){
                    
$mensaje.="Please specify your County (Business) \n";
                }
            
            }
            
            if (! (
                
preg_match("/[0-9]{3}/",$_REQUEST["day_phone1"]) &&
                
preg_match("/[0-9]{3}/",$_REQUEST["day_phone2"]) &&
                
preg_match("/[0-9]{4}/",$_REQUEST["day_phone3"]) 
            
                ) ) {
                
$mensaje.="Please specify your Telephone Number (day) \n";
            }
            
            if ( !empty(
$_REQUEST["eve_phone1"]) || !empty($_REQUEST["eve_phone2"]) || !empty($_REQUEST["eve_phone3"]) || !empty($_REQUEST["eve_phone4"]) ) {
                if (! (
                
preg_match("/[0-9]{3}/",$_REQUEST["eve_phone1"]) &&
                
preg_match("/[0-9]{3}/",$_REQUEST["eve_phone2"]) &&
                
preg_match("/[0-9]{4}/",$_REQUEST["eve_phone3"])

                ) ) {
                    
$mensaje.="Please specify your Telephone Number (eve) \n";
                }
            }

            if ( !empty(
$_REQUEST["fax1"]) || !empty($_REQUEST["fax2"]) || !empty($_REQUEST["fax3"]) || !empty($_REQUEST["fax4"]) ) {
                if (! (
                
preg_match("/[0-9]{3}/",$_REQUEST["fax1"]) &&
                
preg_match("/[0-9]{3}/",$_REQUEST["fax2"]) &&
                
preg_match("/[0-9]{4}/",$_REQUEST["fax3"])

                ) ) {
                    
$mensaje.="Please specify your Fax \n";
                }
            }
            
            
            if ( 
trim($_REQUEST["email"])=="" || (!ereg("^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$"$_REQUEST["email"] ) )) {
                
$mensaje.="Please specify your Email Address \n";
            }
            
            if ((!empty(
$_REQUEST["birth_month"]) || !empty($_REQUEST["birth_day"]) || !empty($_REQUEST["birth_year"])) && !checkLuckyDate($_REQUEST["birth_year"],$_REQUEST["birth_month"],$_REQUEST["birth_day"])) {
                
$mensaje.="Please specify correct Date of Birth \n";
            }
            
            if ((!empty(
$_REQUEST["month_started"]) || !empty($_REQUEST["day_started"]) || !empty($_REQUEST["year_started"])) && !checkAnyLuckyDate($_REQUEST["year_started"],$_REQUEST["month_started"],$_REQUEST["day_started"])) {
                
$mensaje.="Please specify correct Date Business Started \n";
            }
            
            if ((!empty(
$_REQUEST["month_coverage_from"]) || !empty($_REQUEST["day_coverage_from"]) || !empty($_REQUEST["year_coverage_from"])) && !checkAnyLuckyDate($_REQUEST["year_coverage_from"],$_REQUEST["month_coverage_from"],$_REQUEST["day_coverage_from"])) {
                
$mensaje.="Please specify correct Date of Coverage (from) \n";
            }
            if ((!empty(
$_REQUEST["month_coverage_to"]) || !empty($_REQUEST["day_coverage_to"]) || !empty($_REQUEST["year_coverage_to"])) && !checkAnyLuckyDate($_REQUEST["year_coverage_to"],$_REQUEST["month_coverage_to"],$_REQUEST["day_coverage_to"])) {
                
$mensaje.="Please specify correct Date of Coverage (to) \n";
            }
            
            if (empty(
$_REQUEST["type_of_coverage"])) {
                
$mensaje.="Please specify Type of Coverage \n";
            }
            
            if (
$_REQUEST["depends"]=='Yes') {
                for(
$i=0;$i<4;$i++) {
                    if ( !empty(
$_REQUEST["cd_name"][$i]) || !empty($_REQUEST["cd_dob"][$i]) || !empty($_REQUEST["cd_ss"][$i]) || !empty($_REQUEST["cd_phisician"][$i]) ) {
                        
$_DATA["depends_arr"][] = array(
                            
"cd_name"        => $_REQUEST["cd_name"][$i],
                            
"cd_dob"        => $_REQUEST["cd_dob"][$i],
                            
"cd_ss"            => $_REQUEST["cd_ss"][$i],
                            
"cd_phisician"    => $_REQUEST["cd_phisician"][$i]
                        );
                    }
                }
                if (empty(
$_DATA["depends_arr"])) {
                    
$mensaje.="Please specify your Dependants \n";
                }
            }
            
            if (empty(
$_REQUEST["i_agree"])) {
                
$mensaje.="Please specify that you have read the LEGAL NOTICE & DISCLAMER \n";
            
            }
            
            if(
$mensaje!=""){?>
                
                show_popup(this,'Error!','<?= $mensaje?>',310,270);
                
                <?
                
            
}
            
          
?>      
        }
el tema es que cuando se ejecuta me tira un error de unterminated string literal en el popup, como puedo solucionarlo?

desde ya muchas gracias