PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
2Tall
Forum Newbie
Posts: 5 Joined: Wed Nov 22, 2006 8:21 pm
Post
by 2Tall » Wed Nov 22, 2006 8:25 pm
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
Burrito
Spockulator
Posts: 4715 Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah
Post
by Burrito » Wed Nov 22, 2006 8:30 pm
Code: Select all
echo "<EMBED SRC=\"www.mydomain.com/supercool.SWF?customdata=".$_GET['variable']."\" quality=\"high\"> ";
2Tall
Forum Newbie
Posts: 5 Joined: Wed Nov 22, 2006 8:21 pm
Post
by 2Tall » Wed Nov 22, 2006 8:36 pm
...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
Burrito
Spockulator
Posts: 4715 Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah
Post
by Burrito » Wed Nov 22, 2006 8:39 pm
Code: Select all
$variable = (isset($_GET['variable']) && $_GET['variable'] != "" ? $_GET['variable'] : "somedefaultvalue");
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Wed Nov 22, 2006 8:40 pm
Code: Select all
$variable = empty($_GET['variable']) ? 'default' : urlencode($_GET['variable']);
echo "<EMBED SRC=\"www.mydomain.com/supercool.SWF?customdata=".$variable."\" quality=\"high\"> ";
Last edited by
John Cartwright on Wed Nov 22, 2006 8:40 pm, edited 2 times in total.
2Tall
Forum Newbie
Posts: 5 Joined: Wed Nov 22, 2006 8:21 pm
Post
by 2Tall » Wed Nov 22, 2006 8:40 pm
i'll look for the bill in the mail
thx
2Tall
Forum Newbie
Posts: 5 Joined: Wed Nov 22, 2006 8:21 pm
Post
by 2Tall » Wed Nov 22, 2006 10:48 pm
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?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Wed Nov 22, 2006 10:56 pm
A previous thread that's directly related:
viewtopic.php?t=56869
2Tall
Forum Newbie
Posts: 5 Joined: Wed Nov 22, 2006 8:21 pm
Post
by 2Tall » Wed Nov 22, 2006 11:44 pm
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
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Nov 23, 2006 2:18 am
You are either missing or have misplaced quotes.
Burrito
Spockulator
Posts: 4715 Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah
Post
by Burrito » Thu Nov 23, 2006 10:33 am
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.