Page 1 of 1

PHP noob needing assistance

Posted: Wed Nov 22, 2006 8:25 pm
by 2Tall
Hey, I need to make a simple PHP page. I know my web server supports PHP and all, but I was just hoping to get this wrapped up with you guys right quick:

I basically want a page that is like so:

http://www.mydomain.com/index.php?variable=MyInfo

which would end up taking "MyInfo"

and sticking it into the page like so

<EMBED SRC="www.mydomain.com/supercool.SWF?customdata=<?php $variable> quality="high">

...I know that isn't how you do it. To make MyInfo the customdata passed into the Flash SWF...

so how do I do this?

thx :D

Posted: Wed Nov 22, 2006 8:30 pm
by Burrito

Code: Select all

echo "<EMBED SRC=\"www.mydomain.com/supercool.SWF?customdata=".$_GET['variable']."\" quality=\"high\"> ";

Posted: Wed Nov 22, 2006 8:36 pm
by 2Tall
...thanks! And should "variable" be empty, is there an easy way to make it something by default?

maybe PHP earlier in the code, would it be like...

<?php if $variable == "" { variable = "Default" }>

anything like that? :X

thanks again, much appreciated

Posted: Wed Nov 22, 2006 8:39 pm
by Burrito

Code: Select all

$variable = (isset($_GET['variable']) && $_GET['variable'] != "" ? $_GET['variable'] : "somedefaultvalue");

Posted: Wed Nov 22, 2006 8:40 pm
by John Cartwright

Code: Select all

$variable = empty($_GET['variable']) ? 'default' : urlencode($_GET['variable']);

echo "<EMBED SRC=\"www.mydomain.com/supercool.SWF?customdata=".$variable."\" quality=\"high\"> ";

Posted: Wed Nov 22, 2006 8:40 pm
by 2Tall
i'll look for the bill in the mail ;)

thx

Posted: Wed Nov 22, 2006 10:48 pm
by 2Tall
I'm fimiliar with IF, THEN, etc type statements...

but could you please explain to me "in english" what the

variable = (something) ? (stuff) : (stuff)

means?

Posted: Wed Nov 22, 2006 10:56 pm
by feyd
A previous thread that's directly related: viewtopic.php?t=56869
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.

Posted: Wed Nov 22, 2006 11:44 pm
by 2Tall
I've been screwing with this, but it always throws syntax error... any assistance appreciated then I have this project knocked :)

thanks :)

Help repair, please:

Code: Select all

echo ($fetchme = "") ? "<IMG SRC=\"www.mydomain.com/cool.jpg/"> : <EMBED SRC=\"http://www.mydomain.com/awesome.swf?playerName=".$_GET['fetchme']."\" quality=\"high\" height=\"145\" width=\"470\" border=\"0\"> ;
basically looking for, if $fetchme is empty, show the jpg, otherwise, show the flash with the fetchme supplied data

:) thanks

Posted: Thu Nov 23, 2006 2:18 am
by feyd
You are either missing or have misplaced quotes.

Posted: Thu Nov 23, 2006 10:33 am
by Burrito
also, you're not using the comparison operator for $fetchme (==)...that won't throw a syntax error, but it also won't give you the results you desire.