macwiz 07-15-2008, 06:54 PM I. I have a set of pages named:
order.php@level=10
order.php@level=20
order.php@level=30
ect...
However, my pages link to:
order.php?level=10
order.php?level=20
order.php?level=30
ect...
Thus, the pages are not found.
If I try and rename the pages to:
order.php?level=10
order.php?level=20
order.php?level=30
ect...
I get an error saying that "?" is not a valid filename character.
If I change the links to:
order.php@level=10
order.php@level=20
order.php@level=30
ect...
The source code is displayed, and the page isn't rendered.
Please help.
Thank you very much!
Iszak 07-15-2008, 07:19 PM You create one page named order.php and then get the level via $_GET['level'] ... you don't create pages with the parameters..
rafiki 07-15-2008, 07:20 PM Thats because the filenames are order.php the ? indicates that there is a variable attached to the url. You must have PHP installed on the server or it will show the source code or ask you to download the file.
I suggest you read some tutorials.
Just beaten to it
macwiz 07-15-2008, 08:01 PM You create one page named order.php and then get the level via $_GET['level'] ... you don't create pages with the parameters..
Where do the parameters do than?
Thanks again.
Iszak 07-15-2008, 08:07 PM Well you'll create the file say.
order.php
<?php
echo $_GET['level'];
?>
then to add parameters you'll make links to the page like order.php?parameter=value in your case order.php?level=10 and if you use the echo sample I showed it'll output the value 10.. or atleast its should..
macwiz 07-15-2008, 08:20 PM So:
<?php
echo $_GET['level'];
?>
OK, but how do I set each level? This just says that I am using level as a parameter. Different levels should show different options on the page.
Iszak 07-15-2008, 08:26 PM Well in that case it'll be like
<?php
if ($_GET['level'] == 10)
{
// Do something for level 10
}
elseif ($_GET['level'] == 20)
{
// Do something for level 20
}
// etc
else
{
// Level not valid
}
?>
macwiz 07-15-2008, 09:46 PM Well in that case it'll be like
<?php
if ($_GET['level'] == 10)
{
// Do something for level 10
}
elseif ($_GET['level'] == 20)
{
// Do something for level 20
}
// etc
else
{
// Level not valid
}
?>
OK. So, each page shows different content, and when you press Order, it brings you to a page to purchase what was displayed on the page.
Where do I say what contect each level shows?
Example (hosting)
order.php?level=10
Space: 10GB
Bandwidth: 100GB/monthly
Price: $10/month
order.php?level=20
Space: 20GB
Bandwidth: 200GB/monthly
Price: $20/month
order.php?level=30
Space: 30GB
Bandwidth: 300GB/monthly
Price: $30/month
Where each of those options shows on their respective parameter.
Iszak 07-15-2008, 10:19 PM Well if you're using a button you can use the form e.g.
<form action="order.php" method="GET">
<input type="hidden" name="level" value="10" />
<input type="submit" value="Order" />
</form>
and then it'll pass the value level to the order page.. or you could use post..
alternatively you could use
<form action="order.php?level=10">
<input type="submit" value="Order" />
</form>
this is implying you'll have 1 for each order button..
Full example
Space: 10GB
Bandwidth: 100GB/monthly
Price: $10/month
<form action="order.php?level=10">
<input type="submit" value="Order" />
</form>
<br />
<br />
Space: 20GB
Bandwidth: 200GB/monthly
Price: $20/month
<form action="order.php?level=20">
<input type="submit" value="Order" />
</form>
<br />
<br />
Space: 30GB
Bandwidth: 300GB/monthly
Price: $30/month
<form action="order.php?level=30">
<input type="submit" value="Order" />
</form>
macwiz 07-15-2008, 10:45 PM I got the idea from here:
http://parentchild411.com/advertise.php
That is exactly what I need. You will see when you click on Order Now what I mean.
ramm19 07-15-2008, 10:55 PM macwiz, they are simply using a link... like:
<a href="order.php?level=10"><img src="imagehere.jpg" /></a> <----(they are not doing it exactly like that, but you get the point)
Then you would retrieve the variable like Iszak said, with the GET method.
macwiz 07-15-2008, 11:36 PM macwiz, they are simply using a link... like:
<a href="order.php?level=10"><img src="imagehere.jpg" /></a> <----(they are not doing it exactly like that, but you get the point)
Then you would retrieve the variable like Iszak said, with the GET method.
But that is where I get stuck again. How could I do it like they did?
Take a look at the source of:
http://www.parentchild411.com/advertise.php
not once does it have anything like <?php or echo
rafiki 07-15-2008, 11:41 PM Because the echo ""; statement is processed before the html and add's to the markup, after all it is a Server Side Language (http://www.codingforums.com/forumdisplay.php?f=4).
macwiz 07-15-2008, 11:54 PM Because the echo ""; statement is processed before the html and add's to the markup, after all it is a Server Side Language (http://www.codingforums.com/forumdisplay.php?f=4).
Is there a way to view the PHP file plain, as in before the server processes it?
rafiki 07-15-2008, 11:57 PM Not unless you have access to the server it will be processed on for security.
|