Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,

    Guys,

    I know i am doing some mistake in the below code, can any one help me !!!


    PHP Code:
    <?php
    $LIST
    "<td>Task:<select name='PROCESS_BAU[$id_type]'>
                    <option value='$value' echo $info['options'] == '--'?'selected':'';>--</option>
                    <option value='$value' echo $info['options'] == 'Yes'?'selected':'';>Yes</option>
                    <option value='$value' echo $info['options'] == 'No'?'selected':'';>No</option>
                    </select></td>"
    ;
    ?>
    error I am getting while executed is :

    PHP Code:
    Parse errorsyntax errorunexpected T_ENCAPSED_AND_WHITESPACEexpecting T_STRING or T_VARIABLE or T_NUM_STRING in C:xampphtdocsTESTSAMindex.php on line 84 
    Any help will be appreciated !!!

    Regards,
    Nani

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,851
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    What's PROCESS_BAU[$id_type]? Did you mean to use $PROCESS_BAU[$id_type] instead?

    btw, to embed php arrays within string, you need to either use a syntax like

    PHP Code:
    echo "some".$myartay['some_index']."string"
    or

    PHP Code:
    echo "some {$myartay['some_index']} string"
    . I'd prefer the second one.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    nani_nisha06 (12-01-2012)

  • #3
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by abduraooft View Post
    What's PROCESS_BAU[$id_type]? .
    No I want to POST method when the form is executed so that I would capture a Value and the process ID of the task ....Ofcourse I may be wrong because i am still a fresh mind in PHP....

  • #4
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by abduraooft View Post
    btw, to embed php arrays within string, you need to either use a syntax like

    PHP Code:
    echo "some".$myartay['some_index']."string"
    or

    PHP Code:
    echo "some {$myartay['some_index']} string"
    . I'd prefer the second one.
    Ofcourse this solved the error but I am not able to $_post[process_BAU] when a db script is processed using form action...

  • #5
    Junsee
    Guest
    To be honest the code you have written is really confusing for php, using better structure will help solve this issue. I assuming you going to echo out the result, which means the result has another echo in it, which HTML doesn't know what to do with that?

    like so

    PHP Code:
    $LIST

    $LIST .= '<td>Task:<select name="' .PROCESS_BAU[$id_type]. '">';

    $LIST .= '<option value="' .$value'" ';

    if (
    $info['options'] == '--'){
        
    $LIST .= 'selected ';
    }

    $LIST .= '>--</option>';

    # etc etc

    $LIST .= '</select></td>'

  • #6
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Junsee View Post
    To be honest the code you have written is really confusing for php, using better structure will help solve this issue. I assuming you going to echo out the result, which means the result has another echo in it, which HTML doesn't know what to do with that?

    like so

    PHP Code:
    $LIST

    $LIST .= '<td>Task:<select name="' .PROCESS_BAU[$id_type]. '">';

    $LIST .= '<option value="' .$value'" ';

    if (
    $info['options'] == '--'){
        
    $LIST .= 'selected ';
    }

    $LIST .= '>--</option>';

    # etc etc

    $LIST .= '</select></td>'
    Junsee,

    Appreciate your effort but I am not working to echo results I have db table which has 32 different task and each task is equalized with type & option.

    to be more clear,the script I am creating is for the check list whether who has done what task in a group of people for that I have created a db containing columns for task, type (list/text) & options (for list type which has --,y,n) .

    Now I want to create form which should be a unique per day & should satisfy condition: a) if one member done with one task and submit it should grey out(not editable) b) I should only have one submit button for whole list means while submitting result in to DB for 1 task other should stored as null so that rest of the people can work on them.

    On the above requirement I am working hard to close but I think I am going bad with my planing so my form is sucessfull but I am not able to $_post the value in to DB....i feel I am doing wrong while creating name so, need to check with the methods...

    Hope you understand my query & i wish you could share your valuable suggestion.

    Regards,
    Nani

  • #7
    Junsee
    Guest
    But you're echo-ing a if statement inside a variable, I am not sure if thats even possible?

    you need to change the "echo" to an "if"

    take it out of the variable, and give it better structure.

    I think you're just putting everything together and its not working, seperate the components first, make sure they are working.
    Last edited by Junsee; 12-02-2012 at 01:16 AM.

  • #8
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Junsee View Post
    But you're echo-ing a if statement inside a variable, I am not sure if thats even possible?

    you need to change the "echo" to an "if"

    take it out of the variable, and give it better structure.

    I think you're just putting everything together and its not working, seperate the components first, make sure they are working.
    Well yes i did the same way you posted it and keep working on restructuring.....


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •