-2

I send a request to check_update.php page which its code is :

<?php 
    require_once 'C:/wamp/www/phpT/core/init.php';
    $full_name=$_POST['full_name'];
    $email=$_POST['email'];
    $street=$_POST['street'];
    $street2=$_POST['street2'];
    $city=$_POST['city'];
    $state=$_POST['state'];
    $zip_code=$_POST['zip_code'];
    $country=$_POST['country'];

    $errors=array();
    $required=array(
    'full_name' =>'Full_name',
    'email'     =>'Email',
    'street'    =>'Street',
    'city'      =>'City',
    'state'     =>'State',
    'zip_code'  =>'Zip_code',
    'country'   =>'Country',
    );
    //check if  all required fields are filled out
    foreach($required as $f => $d){
        if(empty($_POST[$f]) || $_POST[$f]==''){
            $errors[]='حقل '.$f.' مطلوب';
        }
    }



    if(!empty($errors)){
      echo display_errors($errors);
    }else{
      echo true;
    } 



    ?>

and my ajax request code is :

jQuery.ajax({
             url:'../admin/parsers/check_address.php',
             method:'post',
             data :data,//data that is been requested   
             success:function(resp){
                     if(resp != 1){
                 jQuery('#payment-errors').html(resp);
               }
               if(resp == true){
                    alert('hello');
               }

             },//this data is which is coming back from response
             error:function(){alert('حدث خطأ ما');},

         });

why i get this message Notice: Use of undefined constant - assumed '' in C:\wamp\www\phpT\admin\parsers\check_address.php on line 48 even though it is end php tag which is ?>

Ivar
  • 6,138
  • 12
  • 49
  • 61
Ibrahim
  • 5
  • 3
  • 1
    You should provide your check_address.php file content, not check_update.php – Gynteniuxas Apr 08 '18 at 10:37
  • Possible duplicate of [Reference — What does this symbol mean in PHP?](https://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php) – Ivar Apr 08 '18 at 10:39
  • you are right .. i have made a syntax error...the code above is check_address.php file content..sorry for that – Ibrahim Apr 08 '18 at 19:58

1 Answers1

0

The most likely cause is you typed the variable name wrong. Instead of $whatever you typed whatever, leaving off the $. Or, you didn't quote the string in question ("whatever") and php assumed it is a variable that doesn't exist.

Steve
  • 1,903
  • 5
  • 22
  • 30
  • you are right ...but i have debugged my code and there is not any faults which you are talking about...and you can check my code above to verify the validity of my words – Ibrahim Apr 08 '18 at 10:50
  • The error message should give the variable name in question and the line number the error occurs at. You've posted that the error happens on line 48 but your PHP isn't that long. Is that a typo? – Steve Apr 08 '18 at 10:56
  • @Ibrahim _"and you can check my code above to verify the validity of my words"_ - no we can't, because you have shown us the code of a different file than the one the error message explicitly mentions ... – CBroe Apr 08 '18 at 11:04
  • the error is in check_update.php in the line 48 which is explicitly mention in the error message and this line contains ?> php tag – Ibrahim Apr 08 '18 at 11:43