It did change, you're just not displaying the change. You're displaying $_COMIC["name"], which is put together before you call the function comic(). Besides which, the scope of your variable $comic_title inside that function makes it a different variable than the $comic_title outside the function, so anything you do to $comic_title inside the function won't have any effect on the variable $comic_title outside the function. You can use "global $comic_title;" at the beginning of the function to solve that, or better yet return $comic_title.

And finally,

if ($comic_id = "1")

Is not checking to see if $comic_id is equal to "1"; it is assigning "1" to $comic_id, which returns "true" every time, which means that "if" statement will always evaluate to "true". You need to do use double equal signs, if ($comic_id == "1"), to see if $comic_id is equal to "1".

megajosh2

08-23-2006, 02:56 AM

Oh, thank you so much! I'm sooo happy!!

megajosh2

08-23-2006, 09:17 PM

It still doesn't work. I then edited it for I dunno how long so I just tried to change it a little.

Still not changing. Anything I tell to change in the "if" thingy won't change. It it becasue there's no function? When I do that, I move all of the variables into it. Then nothing show up. I put function(); at the end of the script too.

and then 'image' ( 'comics/comic1.png') gets echo'd as the source of your img tag.

right, as I was typing I think I worked out your problem. You're thinking that the reference to title used when setting name will get updated when you change title. It won't. Concatenation of strings results in a new string, it is a literal value, and change to variables that were used in its composition will have no effect. (emphasis added to appropriate bits)

megajosh2

08-23-2006, 09:39 PM

So I assemble $_COMIC["name"] before the "if" function or should I change it to $comic_name? Will the variables used to assemble the title change if it isn't magic?

Ahh. Okay. I'll tell back how that works. (I learned an important lesson :))

Edit: IT worked!! Your awesome!!

megajosh2

08-24-2006, 02:13 AM

2 questions.

1. Can onClick be used for a php function?
2. Can you send a form to "get" if the variable is a magic variable?

megajosh2

08-24-2006, 04:34 AM

It looks like typing ?comic_id=# doesn't change $comic_id to # when # is a number.

marek_mar

08-24-2006, 04:47 AM

1. No
2. Your $_COMIC variable isn't magical.

GJay

08-24-2006, 08:06 AM

2. Your $_COMIC variable isn't magical.

not sure why, but I laughed at that :)

megajosh2

08-24-2006, 08:46 PM

Can someone help me here? adding ?comic_id=# to the url doesn't change $comic_id. Does anyone know why? Do I need a $_GET? What I mean is http://mmgenerations.awardspace.com/comics.php?comic_id=# won't change $comic_id to #.