I want to echo my String but i have encountered some Problems.
The error I get is:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
Code:
for($i = 1; $i <= 31; $i++){
$Text="";
echo $Text;}
Answer
You have PHP tags mixed in with your attempt at string concatenation. Take you if statement out and put it onto its own statement. Then add that variable to your string:
$Text=""
becomes:
$selected = (@$_POST['geb_tag'] == $i) ? ' selected' : '';
$Text="";
A couple of things:
Your string is messy. There are better way to add PHP variables to strings to make them more readable.
Don't use
@
. You should check to see if that variable is set instead.
.
$selected = (isset($_POST['geb_tag']) && $_POST['geb_tag'] == $i) ? ' selected' : '';
$Text= "";
No comments:
Post a Comment