CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, (http://www.codingforums.com/showthread.php?t=283341)

nani_nisha06 12-01-2012 07:25 AM

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

abduraooft 12-01-2012 09:45 AM

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.

nani_nisha06 12-01-2012 10:16 AM

Quote:

Originally Posted by abduraooft (Post 1296413)
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....

nani_nisha06 12-01-2012 10:18 AM

Quote:

Originally Posted by abduraooft (Post 1296413)
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...

Junsee 12-01-2012 12:27 PM

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>'


nani_nisha06 12-01-2012 12:55 PM

Quote:

Originally Posted by Junsee (Post 1296433)
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

Junsee 12-02-2012 01:11 AM

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.

nani_nisha06 12-02-2012 06:49 AM

Quote:

Originally Posted by Junsee (Post 1296605)
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.....


All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.