Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-01-2012, 07:25 AM   PM User | #1
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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
nani_nisha06 is offline   Reply With Quote
Old 12-01-2012, 09:45 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
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.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Users who have thanked abduraooft for this post:
nani_nisha06 (12-01-2012)
Old 12-01-2012, 10:16 AM   PM User | #3
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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....
nani_nisha06 is offline   Reply With Quote
Old 12-01-2012, 10:18 AM   PM User | #4
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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...
nani_nisha06 is offline   Reply With Quote
Old 12-01-2012, 12:27 PM   PM User | #5
Junsee
New Coder

 
Join Date: Jun 2012
Posts: 42
Thanks: 4
Thanked 5 Times in 5 Posts
Junsee is an unknown quantity at this point
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 is offline   Reply With Quote
Old 12-01-2012, 12:55 PM   PM User | #6
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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
nani_nisha06 is offline   Reply With Quote
Old 12-02-2012, 01:11 AM   PM User | #7
Junsee
New Coder

 
Join Date: Jun 2012
Posts: 42
Thanks: 4
Thanked 5 Times in 5 Posts
Junsee is an unknown quantity at this point
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..
Junsee is offline   Reply With Quote
Old 12-02-2012, 06:49 AM   PM User | #8
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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.....
nani_nisha06 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:44 PM.


Advertisement
Log in to turn off these ads.