PHP variable content disappears from one line to next

Please post all install related problems here. Visit this forum first for troubleshooting.
Post Reply
Microbe
Posts: 22
Joined: Tue 10. Jan 2006, 06:25

PHP variable content disappears from one line to next

Post by Microbe »

I have the following code in a contact form I am building (the phpwcms built in contact form breaks the application)

Code: Select all

[PHP]
if($_GET["to"]> ""){
	switch ($_GET["to"]) {
	    case "president":
		$email="email@domain";
		$recipient = "The president";
		break;
--SNIP--
	}

echo(" sw1 = " . $recipient);

}
[/PHP]

[PHP]
    echo(" sw2 = " . $recipient);
[/PHP]
can anyone explain why the output is

Code: Select all

val 1 = The president val 2 =
The variable content has been lost from one line to the next
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

SUBSTITUTE:

Code: Select all

<?php
FOR:

Code: Select all

[PHP]
and SUBSTITUTE:

Code: Select all

?>
FOR:

Code: Select all

[/PHP]
and think about it :wink:
Microbe
Posts: 22
Joined: Tue 10. Jan 2006, 06:25

Post by Microbe »

DeXXus wrote:SUBSTITUTE:

Code: Select all

<?php
FOR:

Code: Select all

[PHP]
and SUBSTITUTE:

Code: Select all

?>
FOR:

Code: Select all

[/PHP]
and think about it :wink:
I am working around it now.

But I can only assume that the variables end up local within functions. Am I close? :?:
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

Microbe wrote: But I can only assume that the variables end up local within functions. Am I close? :?:
:wink: http://www.phpwcms.de/forum/viewtopic.php?p=53632#53632
Microbe
Posts: 22
Joined: Tue 10. Jan 2006, 06:25

Post by Microbe »

DeXXus wrote:
Microbe wrote: But I can only assume that the variables end up local within functions. Am I close? :?:
:wink: http://www.phpwcms.de/forum/viewtopic.php?p=53632#53632
heh! Thanks so much for that.

I had just seen that article a short while ago while trying to figure out how to make the contact form produce

Code: Select all

    <option value="1">Option one</option>
    <option value="2">Option two</option>
    <option value="3">Option three</option> 
Still havn't done it.

I know the documentation is a work in progress, but it really needs some examples.
Post Reply