Syntax

Syntax

am 14.02.2004 08:32:29 von PETCOL

Hi People,

PHP Newbie here again. trying to get HTML and PHP to work together really
stumps me at times, I'm trying to output a selection from a form as so:


if (isset($_POST["Country"])) {
echo " value="$_POST["Country"];"selected>\n"$_POST["Country"];"\n";
} else {
echo "\n";
}
?>



This line is whats causing me all the greif:
echo " value="$_POST["Country"];"selected>\n"$_POST["Country"];"\n";
Parse error: parse error, expecting `','' or `';''

Suggestions or tutorials please ;-)

Col

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Syntax

am 14.02.2004 08:54:38 von John Nichel

PETCOL wrote:

> This line is whats causing me all the greif:
> echo " > value="$_POST["Country"];"selected>\n"$_POST["Country"];"\n";
> Parse error: parse error, expecting `','' or `';''
>
> Suggestions or tutorials please ;-)
>
> Col
>

You're wrapping the whole string in double quotes ("), not escaping the
double quotes in your form element, and using double quotes around the
array keys. Don't know why you have the semi-colons in the middle of
the string, or the new line, but try this...

echo ( "\n" );

Read here about escaping characters, and about concatenating.

http://us2.php.net/manual/en/function.echo.php
http://us2.php.net/manual/en/language.operators.string.php

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re:[SOLVED] [PHP] Syntax

am 14.02.2004 12:34:15 von PETCOL

Thanks John,


"John Nichel" wrote in message
news:402DD43E.5070007@by-tor.com...
> PETCOL wrote:
>
> > This line is whats causing me all the greif:
> > echo " > > value="$_POST["Country"];"selected>\n"$_POST["Country"];"\n";
> > Parse error: parse error, expecting `','' or `';''
> >
> > Suggestions or tutorials please ;-)
> >
> > Col
> >
>
> You're wrapping the whole string in double quotes ("), not escaping the
> double quotes in your form element, and using double quotes around the
> array keys. Don't know why you have the semi-colons in the middle of
> the string, or the new line, but try this...
>
> echo ( "\n" );
>
> Read here about escaping characters, and about concatenating.
>
> http://us2.php.net/manual/en/function.echo.php
> http://us2.php.net/manual/en/language.operators.string.php
>
> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php