Author |
Message |
brainfuelmedia
Junior WebHelper
Joined: 28 May 2002
Posts: 5
Location: Canada
|
Posted:
Tue May 28, 2002 4:21 pm (21 years, 11 months ago) |
|
Any idea why this won't work??
<?php
$id = "agr_lig_liq_+Calcium_6%";
//split the id into component parts
$idCut = explode("+", $id);
//get the $path in form - e.g. agr_lig_liq_
$path = $idCut[0];
//change $path to a valid path
$path = ereg_replace("_", "/", $path);
//get the text path
$txtPath = "prod_txt/" . $path;
//get the pdf path
$pdfPath = "pdfs/" . $path;
//get the product id
$prodId = $idCut[1];
//set the prod title for the page
$prodTitle = ereg_replace("_", " ", $prodId);
//get the main category icon and title for the page
$type = explode("_", $idCut[0]);
$type = type[0];
$catIcon = "logo_front_" . $type . ".gif";
$catTitle = "prod_title_" . $type . ".gif";
//so now we have $txtPath, $pdfPath, $prodTitle, $catIcon, and $catTitle
?>
Thanks to all,
Ryan
<mod edit>Subject edited</mod edit> |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Tue May 28, 2002 4:22 pm (21 years, 11 months ago) |
|
If you could be more precise, it would help. What do you mean by "it won't work"? |
________________________________
|
|
|
|
brainfuelmedia
Junior WebHelper
Joined: 28 May 2002
Posts: 5
Location: Canada
|
Posted:
Tue May 28, 2002 4:29 pm (21 years, 11 months ago) |
|
When I try to execute this code in a web page, in this case "product.php", the page will not execute. If I remove the code from the web page, the web page renders, but of course the variables listed in the html portion of the page are empty because the php code is no longer there.
It appears to me that I am either missing something in the php code (i.e. a syntax mistake, mis-used operator, etc.) or the cgi server this code is running on is restricting something in this php code.
I'm confused...
BTW, thanks for the quick reply.
Ryan |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Tue May 28, 2002 4:44 pm (21 years, 11 months ago) |
|
When you run product.php on its own, does an error appear? |
________________________________
|
|
|
|
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Tue May 28, 2002 4:59 pm (21 years, 11 months ago) |
|
I just ran it on it's own, and I got :
Parse error: parse error in /hsphere/local/home/justin/dev.ecddns.com/test.php on line 28 |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Tue May 28, 2002 5:01 pm (21 years, 11 months ago) |
|
Change: to |
________________________________
|
|
|
|
brainfuelmedia
Junior WebHelper
Joined: 28 May 2002
Posts: 5
Location: Canada
|
Posted:
Tue May 28, 2002 5:05 pm (21 years, 11 months ago) |
|
I just got another email pointing that out... told you I was a newbie
Thanks for the help!!
I have another question now though. Sorry...
I want a user to be able to click on a link from another page:
i.e. <a href="product.php?id=agr_lig_liq_+Calcium_6%">Calcium 6%</a>
and the product.php page to recieve the variable $id from this refering page.
Is the above method the correct way to do this?? Do I need to put this information in a form?? Do I need a submit button??
Thanks for you help again,
Ryan
PS if you need example pages I can include a link for you. |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Tue May 28, 2002 5:06 pm (21 years, 11 months ago) |
|
If you plan on including the ID in the URL, no form is needed. |
________________________________
|
|
|
|
brainfuelmedia
Junior WebHelper
Joined: 28 May 2002
Posts: 5
Location: Canada
|
Posted:
Thu May 30, 2002 6:34 pm (21 years, 10 months ago) |
|
|
|
|
|
Page generation time: 0.126303 seconds :: 18 queries executed :: All Times are GMT
Powered by
phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme