MyBB Community Forums

Full Version: PHP Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
I'm very new to php, and i have many tutorial sites, and i know what I'm trying to find, but i don't know what it's called/named. If there are characters after
.php
on file, IE: newthread.php?fid=11, what is that called, and where are some good specific online tutorials that i could learn how to manipulate them(Just In Case I Don't Have Any)? This may be beginner knowledge, and thats what I am, so could someone please help?
That is called the query string. Wink

In regards to manipulating them..

?fid=1

Can be accessed through $_GET['fid']

If you have

?fid=1&test=2

You can access $_GET['fid'] and $_GET['test']

Here's a tutorial I found through Google for you: http://discomoose.org/2005/10/19/how-to-...ng-in-php/
EDIT: Okay, i tried that tutorial, and it worked fine, i copied the codes exactly, but every time i entered a username, it said: "You did not enter a username", yet, the query sting of the username i enter was there(?username=EZE). Anyways, it worked other than that. So, how could i say in php, if the query string is ?m=1, the title of the page is "Public Service Announcement". I would put the code between the <title> and </title> tag(s) right? Or does php automatically write the two tags? (Sorry to nag so much, I'm a total n00b at php.)
You'd have to use something like this:
<title><?php
if($_GET['m'] == "1") {
echo "Public Service Announcement";
} else {
echo "Default Title";
}
?></title>
So if you goto ?m=1 then the title of the page would be Public Service Announcement
Thanx! I'll try that. So, could i change the m to anything i want, and the value 1 to anything?
Yeah, you could have ?dale=hay if you wanted. Smile
Cool! Thank you!
your title sounds to be ..........................

well learn from php.net, there is no place better than the php.net manual with lot of users interaction.
EZE Wrote:Thanx! I'll try that. So, could i change the m to anything i want, and the value 1 to anything?

You just need to change the code

$_GET['m'] gets the value of the query string variable ?m=whatever
If you want to use ?dale=hay you would need to change $_GET['m'] into $_GET['dale']

Smile
Okay, so i put this code in
<?php
if($_GET['m'] == "1") {
echo "<embed src="movies/service_announcement.mov" width="320" height="256" controller="true" autoplay="true" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime"></embed>";
} elseif($_GET['m'] == "2") {
echo "<embed src="movies/photo_montage.mov" width="320" height="256" controller="true" autoplay="true" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime"></embed>";
}elseif($_GET['m'] == "3") {
echo "<embed src="movies/retro_yearbook.mov" width="320" height="256" controller="true" autoplay="true" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime"></embed>";
}elseif($_GET['m'] == "4") {
echo "<embed src="movies/service_announcement2.mov" width="320" height="256" controller="true" autoplay="true" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime"></embed>";
}elseif($_GET['m'] == "5") {
echo "<embed src="movies/mm_transfer.mov" width="320" height="256" controller="true" autoplay="true" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime"></embed>";
}else{
echo "<table border="1" bordercolor="#FFFFFF" width="320" height="256" cellpadding="0" cellspacing="0"><tr><td><center>No Movie Was Specified<center></td></tr></table>";
}
?>
and this came up:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/content/e/z/e/ezevolk/html/volkshowcase/quicktime/viewquicktime.php on line 72
on the page viewquicktime.php?m=1.(line 72 is the start of the first echo in the code above.) What's wrong? The file locations are correct, did i mis-type some php somewhere? Or is it because of the quotation mark after <embed src=", it thinks that it's ending the echo, and the other code is just messing it up? Whatever the reason, does anybody know how to fix it?
Pages: 1 2 3 4 5