За последние 24 часа нас посетили 18412 программистов и 1704 робота. Сейчас ищут 934 программиста ...

echo не работает

Тема в разделе "PHP для новичков", создана пользователем Samir, 14 фев 2018.

  1. Samir

    Samir Новичок

    С нами с:
    12 янв 2018
    Сообщения:
    48
    Симпатии:
    1
    Ребят, выручайте кто знает. Вот часть кода:
    PHP:
    1. <?php
    2.    require_once 'main_mywebsite.php';
    3. echo <<<_END //beginning of the output
    4.    <script>
    5.    function checkUser(user)
    6.    {
    7.        if(user.value == '')
    8.        {
    9.            O('info').innerHTML = ''
    10.            return
    11.        }
    12.        //ajax-request HTML
    13.        params = "user=" + user.value //params will be sent to the server
    14.        request = new ajaxRequest() //the object of the ajax-request
    15.        request.open("POST", "checkuser.php", true) //set to the asynchronous mode
    16.        request.setrequestHeader("Content-type", "application/x-www-form-urlencoded")
    17.        request.setRequestHeader("Content-length", params.length) //configure the titles required for the server to be aware of the receipt
    18.        request.setRequestHeader("Connection", "close")
    19.      
    20.        request.onreadystatechange = function()
    21.        {
    22.            if(this.readystate == 4)//returns control of the action until 4 is returned
    23.                if(this.status == 200)//the call went well
    24.                    if(this.responseText!=null)
    25.                        O('info').innerHTML = this.responseText//In this line, using the method getElementByID is a link to ele-
    26.                                                               //the ment info, and then its innerHTML property is set to the value returned
    27.                                                               //An AJAX call.
    28.        }
    29.     request.send(params)      
    30.    }
    31.    function ajaxRequest()
    32.    {
    33.        try {var request = new XMLHttpRequest()}
    34.        catch(e1) {
    35.            try {request = new ActiveXObject("Msxml2.XMLHTTP")}
    36.            catch(e2){
    37.                try {request = newActiveXObject("Microsoft.XMLHTTP")}
    38.                catch(e3){
    39.                    request = false
    40.        }}}
    41.        return request
    42.    }
    43.    </script>
    44.    <div class='main'><h3>Please enter your details to sign up</h3>
    45. _END;
    46. ?>
    выдает ошибку

    ( ! )Parse error: syntax error, unexpected '<<' (T_SL) in C:\wamp64\www\signup_mywebsite.php on line3


    не пойму в чем проблема??
     
  2. Dron-Boy

    Dron-Boy Старожил

    С нами с:
    20 ноя 2014
    Сообщения:
    1.041
    Симпатии:
    126
    А не легче сделать следующее
    PHP:
    1. <?php
    2.    require_once 'main_mywebsite.php';
    3. ?>
    Код (Javascript):
    1.    <script>
    2.    function checkUser(user)
    3.    {
    4.        if(user.value == '')
    5.        {
    6.            O('info').innerHTML = ''
    7.            return
    8.        }
    9.        //ajax-request HTML
    10.        params = "user=" + user.value //params will be sent to the server
    11.        request = new ajaxRequest() //the object of the ajax-request
    12.        request.open("POST", "checkuser.php", true) //set to the asynchronous mode
    13.        request.setrequestHeader("Content-type", "application/x-www-form-urlencoded")
    14.        request.setRequestHeader("Content-length", params.length) //configure the titles required for the server to be aware of the receipt
    15.        request.setRequestHeader("Connection", "close")
    16.  
    17.        request.onreadystatechange = function()
    18.        {
    19.            if(this.readystate == 4)//returns control of the action until 4 is returned
    20.                if(this.status == 200)//the call went well
    21.                    if(this.responseText!=null)
    22.                        O('info').innerHTML = this.responseText//In this line, using the method getElementByID is a link to ele-
    23.                                                               //the ment info, and then its innerHTML property is set to the value returned
    24.                                                               //An AJAX call.
    25.        }
    26.     request.send(params)  
    27.    }
    28.    function ajaxRequest()
    29.    {
    30.        try {var request = new XMLHttpRequest()}
    31.        catch(e1) {
    32.            try {request = new ActiveXObject("Msxml2.XMLHTTP")}
    33.            catch(e2){
    34.                try {request = newActiveXObject("Microsoft.XMLHTTP")}
    35.                catch(e3){
    36.                    request = false
    37.        }}}
    38.        return request
    39.    }
    40.    </script>
    41.    <div class='main'><h3>Please enter your details to sign up</h3>