KansukeKojima
Nov 17 2007, 10:36 AM
| | I am having lots of trouble getting some different php codes to work on traps servers....
CODE <?php $default = "blah.html"; if($id == ""){$id = $default;}elseif(isset($id)){$id = $id;} ?> <?php include ("$id"); ?> <a href="?id=blah2.html">Link</a> For example, I tried this to creat a link, but it would not work... is there anything I can do that I may not be doing, or that I may be doing wrong, or don't know about? It seemse to happen for a few other things too... help me please. |
Reply
rvalkass
Nov 17 2007, 10:51 AM
To get a variable out of the URL, you need to refer to it as $_GET['variablename'] not just as $variablename. For example, the first line of your code should read: CODE <?php
$default = "blah.html";
if ($_GET['id'] == "") { $id = $default; }
elseif (isset($_GET['id'])) { $id = $_GET['id']; }
?> That should fix it.
Reply
KansukeKojima
Nov 17 2007, 12:04 PM
Ok thank you so much! But what about with this: http://www.trap17.com/forums/apparantly-is...ing-t53226.htmlwith this problem I just need to use the GET funtion like sonesay said in his reply right?
Reply
rvalkass
Nov 17 2007, 03:20 PM
Yes. $_GET['variablename'] is used for pulling information out of URLs and passing them to variables. So, if in the URL you have index.php?name=rob&os=linux then two variables are automatically created: - $_GET['name'] which has the value "rob"
- $_GET['os'] which has the value "linux"
Most people reassign those variables to others with more logical names and without the GET part, like this: CODE $name = $_GET['name']; $operatingSystem = $_GET['os'];
Reply
KansukeKojima
Nov 17 2007, 09:41 PM
Thank you Oh so much!!! I finally got it up and running....Yay!!! I can't thank you enough. Below is the finished result as far as coding. And it actually works!!! CODE <?php
$time = date("g:ia");
$main = <<< html Welcome to Kansuke's Blog, powered by 2K ART. There won't really be anything on here for a while, at least not until I get everything set up. Please be patient! html;
$writing = <<< html This page will eventually have some poems, songs, etc. on it. But none for now! Come back later please! html;
$misc = <<< html <b>Total Posts:</b> 0<br> <b>Current Host:</b> Trap17<br> <b>Blogs on Network:</b> 1/10<br> <b>Current Time:</b> $time (Central)<br> html;
$art = <<< html This page will eventually have artwork on it. But none for now! Come back later please! html;
$comp = <<< html This page will eventually have some computer specifications on it. But none for now! Come back later please! html;
$about = <<< html This page will eventually have some information on it about the user. But none for now! Come back later Please! html;
$default = "$main";
if ($_GET['id'] == "") { $id = $default; }
elseif (isset($_GET['id'])) { $id = $_GET['id']; }
$template = <<< html <html> <head> <title>2K Blogs\\ Kansuke's Blog</title> </head> <body marginwidth="0" topmargin="5" rightmargin="5" leftmargin="5" bottommargin="5" bgcolor="#505050"> <link rel="stylesheet" href="css.css" type="text/css"> <table border="0" width="780" cellpadding="2" cellspacing="4" align="center"> <tr valign="top"> <td valign="top" width="780" class="head"> <img src="banner.jpg"></td></tr> <tr valign="top"> <td valign="top" width="780" class="table_class" bgcolor="#727272"> [ <a href="index.php?id=$about">About Me</a> <b>·</b> <a href="index.php?id=$comp">Computer Specs</a> <b>·</b> <a href="http://2kart.trap17.com" target="_blank">2K ART</a> <b>·</b> <a href="index.php?id=$misc">Misc. Specs</a> <b>·</b> <a href="index.php?id=$art">Artwork</a> <b>·</b> <a href="index.php?id=$writing">Writing</a> ][ <a href="index.php">Index</a> ]</td></tr> <tr valign="top"> <td valign="top" width="780" class="table_class" bgcolor="#727272"> $id </td></tr> <tr valign="top"> <td valign="top" width="780" class="table_class" bgcolor="#727272"> Copyright © 2007. All Rights Reserved.</td></tr> </table> </body> </html> html;
echo $template;
?> thanks again!!!
Reply
BuffaloHELP
Nov 19 2007, 06:02 AM
rvalkass, you da man!!  Thank you for supporting one of our members' programming question. Topic is resolved. Please PM any moderator to continue this discussion. Until then, this topic is closed.
Reply
Similar Topics
Keywords : tonnes, trouble,
- Need Help With Javascript Drag And Drop Script
Having trouble with javascript drag and drop script. (2)
Having Trouble Accessing Google
(1) I opened my computer this morning very excited about checking my email but to no avail because till
now I am having a hard time connecting to gmail and google. I already tried a few things like 1.
reset my modem 2. virus and malware scan my computers but as I found out it's not only a
problem in my pc. It's a problem in all of the pcs here at home as well. We're all connected
to the internet via a wireless hub (linksys). Well recently I found out that the firmware of our
hub is corrupted (meaning people could connect to our network and use our interne....
I'm Having Trouble Registering [resolved]
(my application is accepted, but not going through) (6) I joined the forums here a week or two ago. I worked my credits up to about 39 and applied for an
account (I became completely approved). However, when I tried registering my account, my browser
was stuck on the "Xisto" page for about 48 hours. It just kept telling me to wait (it could take a
"long time"). Eventually, I had to close my browser because it was using exorbitant levels of RAM.
I lost all my credits anyway. I'm wondering how to fix that. Does my application require human
input after being approved? I thought it was completely automatic, so I appli....
Browser Compatibility Problem With Firefox - Javascript + Css
Having trouble making a script work right - any suggestions? (3) Hi, Im working on a website, and im trying to make a right-click menu, which opens on right click,
wherever the cursor is, and closes on mouse out. I wrote the code below, and when i ran it in IE it
ran fine, just how i wanted it to work. However in firefox, the menu just opened in the top left. im
presuming this is because it doesnt like my style changing in the javascript. Any ideas, and
suggestions? If i cant make this work, i will just make it so it works slightly differently when
viewev in firefox so that it can just open in one place. All ideas appreciated. ....
The Olympics-more Trouble Than It's Worth?
(6) I love watching the Olympics like many other people. It is pretty cool to see athletes from all over
the world compete in sporting events. However, it seems to me that the Olympics may be causing more
trouble than what it's worth. The debate over drug involvement, underage gymnasts, tie scores,
dropping s medal on the ground, and falling on the vault are all examples of things that have been
debated. It seems to me that all of these things are ruining the Olympics. What's the point in
winning a gold medal when everyone questions it? It seems to me that the Olympi....
Cms?
Trouble!!! (2) I installed a CMS which is called Slaed. This is the mistake I am getting on the main page: QUOTE
Warning: unlink(config/counter/sess.txt) : Permission denied in
/home/alex1985/public_html/function/function.php on line 1607 How can I solve it? Your
suggestions?....
Mime Type Trouble
(3) I have been trying to validate my site with xhtml 1.1 and I am supposed to serve it as an
application vs. text/html... 1. It recommends changing to .xml or .xhtml extension but when I do
this in my home folder it doesn't recognize the extension and calls is text/generic. 2. Yes, i
have added the mime type in apache, but I don't know why it doesn't recognize it?? It
recognized a pearl script I made. 3. I also tried adding a perl script to the top of my pages to
declare mime type but it doesn't seem to be working. How can I get cpanel to recognize these ....
Cpanel Help, Trouble Logging In.
Cannot login as it states "Login Attempt Failed!" (4) Before I was able to login within my Cpanel without problem but now I try to login and it states
"Login Attempt Failed!" which makes no sense. I made sure nothing was written incorrectly within
the fields but yet I get this error. ;-; I hope I wasn't hacked or anything.... anyone has any
idea of what this could mean?....
Runescape Through A Proxy
I'm having trouble running Runescape through a proxy server (2) I use GhostGo when I surf the web most of the time because it helps protect my privacy. One
problem I've encountered, is playing Runescape on it. A picture of my screen is attached. I use
Safari to play Runescape. I'd rather not, but I will use Firefox if I need to.....
Nasal Irrigation For Sinus Trouble
(4) Has anyone ever tried nasal irrigation? I have, it works wonders!....
Trouble Creating Hosting Account
i would have posted in the HOSTED MEMBERS section but.... (20) I need urgent help! When i recieved my email for comfirmation of my hosting account - i went to
trap17.com/manage/index.php. Logged in and created a hosted account. At the top of it it said "There
were problems creating your account! Please Contact Administrator. " But i went to my website
flashy.trap17.com and it was created. But now the only thing is my hosted credits were not set
back to 0.00 and my group is still Members - not hosted. HELP ME PLEASE!! i dont want to
get banned....
School Giving You Too Much Trouble?
Better Here This Audio Clip (1) Too Funny! Turn up your Speakers for this one...
http://mosh.nokia.com/content/32EAC8BB8289...040050AEE041F49 ....
Wordpress Login Trouble [resolved]
It says something about cookies. (8) Whenever I try to login to my newly installed Wordpress account, it gives me this message at the
top: Warning: Cannot modify header information - headers already sent by (output started at
/home/a0123b56/public_html/wp-config.php:29) in /home/a0123b56/public_html/wp-login.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at
/home/a0123b56/public_html/wp-config.php:29) in /home/a0123b56/public_html/wp-login.php on line 24
And then when I ignore that and try to login, it says that either cookies are blocked or your brow....
[php/mysql]id Trouble [resolved]
(3) session_start(); include "database.php"; if (!$_SESSION || $_SESSION { // User
not logged in, redirect to login page Header("Location: main.php"); } $result =
mysql_query("select * from users order by id asc"); while($r=mysql_fetch_array($result))
{ $username=$r ; $info=$r ; $msn=$r ; $email=$r ;
$id=$r ; $password=$r ; $userlevel=$r ; echo "
user ID User Level U....
Login Trouble [resolved]
(3) I'm having trouble logging into Trap17. When I login with the top bar, it sends me to the login
page, and when I login page, it sends me to
http://www.trap17.com/forums/index.php?htt...ums/forums.html And I'm still not logged in.
I've tried on FF and IE. I'm at school and it's the only place where it will actually
log me into Trap. I've got a feeling this will damage my credits. /unsure.gif"
style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" />....
Logo Trouble
(4) I'm making a website that will contain jokes and hopefully maintain a successful community. I
thought of the name "The Comedy Club" but I am having trouble on which font to choose for the logo.
In order there is: * Laffayette Comic Pro tintin Cheri Badaboom BB Kill Switch Mom`s
Typewriter If you can please vote for your favourite(s), it would be greatly appreciated. I will
be changing the colour scheme to match the finished website but I chose red as it is simple and easy
to see. Cheers, Ryan....
Cpanel Login Trouble!
(4) Plz help me out with my cpanel mess!! with correct username and psswrd i cannot log in...was
working fine sme days bck when i purchased it!! i`m losing business as i cannot reply to
emails as they woudn`t open either!!! whats this mess?? I tried to log in with my
default psswrd which was mailed to me!! lemme outta dis people!!!!
/unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> link to
my website is https://sun.host.ac:2083/frontend/x3/index.html ....
Php An Js Window.open Pages Trouble.
I need a way to set hidden input values to the new window. (3) I have 2 main pages Page A(events_locked.php) and Page B(add_attendance.php). Both are php files.
Page A takes a post var from another page(not Page B ) and then used to query for displaying records
in a mysql datase. This variable has set as a session variable because there is 1 <script
LANGUAGE="JavaScript"> window.name="main_index"; function openFormWindow() {
OpenWindow=window.open("add_attendance.php", "newwin", "height=250,
width=400,toolbar=no,scrollbars=no,menubar=no,location=no,resizable=no"); var x =
getElementByName("form1"); x.target="newwin"; x.s....
Trouble Logging Into Cpanel
(0) When i go to the cpanel page for my account, internet explorer tells me the that it doesn't have
certain certificates to prove authentication. So i think "fine, no big deal lets carry on anyway",
so i continue and a login in window pops up i enter my details.. nothing, again... nothing, again
Third time lucky? oh wait... it takes me to the cpanel login page, hmm... so i enter my details into
that... nothing, again... nothing no matter what i try and i dont get the password wrong becuase i
use the password for another service somewhere else. i was wondering if some li....
Window Media Player License.
having trouble with it. (1) Hey friends i m having trouble with some window media audio formats. when i try to play them it says
download media player security license. i tried to download but it says url not found. Plz can
some body help me? and i don't think that microsoft has designed this for some purpose! It
is useless.. i'll must say that it is just a way to tease you. what do u think that microsoft
should remove this feature?....
Trouble With Phpbb Email
(1) Hi guys, I want to know if there is anything you can do for sending confirmation email to your
users automatically when they have just regeistered, when the host server does not support SMTP
(Simple Mail Transfer Protocol). ? Thanks alot.....
New Arisen Site Problem
Nettek Login Trouble (2) Okay, so I installed Nettek and got everything set up. But every time I try and login, it says
it's incorrect. I've gone into the Database and gotten the password and since it was
simple, put them in and had tried but with no success. I tried changing the password but I still
couldn't get in. I tried adding another login and it still didn't work. I have no idea
what's wrong and I need some help.....
Important ! I Am Having A Lot Of Trouble Setting Up My...
(0) hi guys/girls, i am having a lot of trouble setting up my email account with go daddy their
customer service sucks ! (sorry for the language) but as of now i waited 2 days posted the same
question as how to setup my Email at Godaddy but they send me irrelavent answers totally bull crap
its frustrating to know that such a good company cant provide good help. can anyone help me i have
already created my Email id example@eample.com then it says Pending : MX updating. since 2 days what
must i do ??? i am really stuck when i click help it says change your MX 0 stmp....se....
Having Trouble Installing Smf
(3) am i allowed to upload a forum? one that is all coded in php, not a service, a completely scratch
forum. the company who made the templates is simplemachines and its an smf. it just documents, i
just need to know if i can use it. also, it doesnt let me access files i have uploaded.......
Frontpage Extensions Trouble
It won't work! (1) Okay, so yesterday I checked the FrontPage extensions and noticed that they were installed. I began
my Web site and uploaded it to see how it would work. But when I went to a page that required
FrontPage Extensions, it didn't work. I checked to see if the Extensions were installed and it
said they weren't. I installed them and retried the page and it didn't work. I tried
reuploading the files that needed it using the FrontPage FTP and when it came to those files, it
said that FrontPage Extensions were not installed. I was wondering if someone could help....
Trouble With Rpgmaker Xp
(19) I newly installed RPG Maker XP and a message pops up saying. "Failed to obtain a trial activation
code from the nTitles server!" Now what do I do?....
Windows Update Trouble
Office XP Service Pack 3 (7) I tried downloading Office XP Service Pack 3 And when I try to download it I Get this box that pops
up QUOTE Title says: Microsoft Office XP Professional with FrontPage The feature you are
trying to use is on a network resource that is unavailable. Click ok to try again, or enter and
alternate path to a folder containing the installation package “PROFLUS.MSI” in the box below Use
source. C:\Documents and settings\Owner\Desktop (In a drop Down Menu) Then there is
3 options (OK, Cancel, Browse…) Kind of puzzled as to how I could install the win....
Having Trouble Installin Half Life 1 On Windows Xp
help me plz... (8) im havin trouble installing half life 1 on my computer it meets all the requirments and stuff but it
wont install and ive read because im using windows xp but ive also read ppl got it to work even
though there usin windows xp i tried steam but that didnt really help it installed but kept screwin
up so if anyone has any suggestions plz post them....
Trouble With Emailer.php
failed sending email error (6) Whenever someone registers at my forum, they get this error: Failed sending email :: PHP :: DEBUG
MODE Line : 234 File : emailer.php however, the account will be sucessfully registered. It is
weird because i did not change the original emailer.php at all. O__O||| anyone know whats up with
it?....
Neomail, Horde, Squirrelmail
What's the deal?? Having trouble here... (4) I'm using an email address under my domain and had been using Neomail to check it for most of
the time that I've been hosted (less than 2 months now). Not long ago I tried Horde and
switched to it because it looked nicer. At first, my emails weren't visible in Horde, but later
they appeared and I couldn't see them in Neomail anymore (I don't know how this happened or
what I did.) But since using it, Horde was giving me trouble so I decided to switch back to Neomail.
So I logged into Neomail, but my messages haven't gone back to it. Next, I al....
Looking for tonnes, trouble,
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for tonnes, trouble,
*MORE FROM TRAP17.COM*
|
advertisement
|
|