473,320 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP Hyperlink Problem

This is the backend switch:
[php]
<?php
switch ($_GET['seo'])
{
case "Global SEO Services";
$url = "http://www.globalseoservices.com";
ob_end_clean();
header("Location: " . $url);
break;
default:
echo "Invalid page";
break;
}
?>
[/php]
This is the frontend - and it is awful
[php]
<?php
$data = "seo";
?>
<p><a href="http:php.php?data ="htmlspecialchars . urlencode($data) "">Global SEO Services</a>
</p>
[/php]
I can't seem to get it pathed right, anyone know what to do.

Michael
Oct 16 '07 #1
10 2424
Lumpy
69
Try this...I don't know if it works for you, but it should work...

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3. switch($_GET['page'] {
  4.  case "seo":
  5.   $url = "http://www.globalseoservices.com";
  6.   ob_end_clean(); 
  7.   header("Location: " . $url); 
  8.  break;
  9.  default:
  10.   echo "Invalid page";
  11.  break;
  12. }
  13. ?>
  14.  
  15. ///Frontend
  16.  
  17. <?php
  18. $data = "seo";
  19.  
  20. echo "<p>";
  21. echo "<a href=\"php.php?page=" . $data .  "\">Global SEO Services</a>";
  22. echo "</p>";
  23.  
That should work. It will put the 'page' variable in the link with the data from the 'data' variable. Then the backend will get the data from the 'page' variable and make the proper choice.
Oct 16 '07 #2
ronverdonk
4,258 Expert 4TB
octavian79ad: next time enclose any code within the proper code tags. See the Posting Guidelines on how to do that.

moderator
Oct 16 '07 #3
I have loaded it, and I am getting a Tcase error message:

It says this in the window: Parse error: syntax error, unexpected T_CASE in C:\Inetpub\vhosts\globalseoservices.com\httpdocs\b onghit.php on line 5

It says this in the URL window: http://www.globalseoservices.com/bonghit.php?page=seo

Expand|Select|Wrap|Line Numbers
  1.  
  2. //backend - bonghit.php is file
  3.  
  4. <?php
  5.  
  6. switch($_GET['page'] {
  7.  
  8.  case "seo":
  9.   $url = "http://www.globalseoservices.com";
  10.   ob_end_clean(); 
  11.   header("Location: " . $url); 
  12.  break;
  13.  
  14.  default:
  15.   echo "Invalid page";
  16.  break;
  17. }
  18. ?>
  19.  
  20. //frontend
  21.  
  22. <?php
  23. $data = "seo";
  24.  
  25. echo "<p>";
  26. echo "<a href=\"bonghit.php?page=" . $data .  "\">Global SEO Services</a>";
  27. echo "</p>";                                                    
  28. ?>
You can View this link in the top left hand green hyperlink on the site *** link removed by moderator ****
Oct 16 '07 #4
octavian79ad: next time enclose any code within the proper code tags. See the Posting Guidelines on how to do that.

moderator
Sorry bout the code tags, I am new to this forum, but am reading the posted guidleines now

I think i screwed it up again, in my reply, ill try again next post
Oct 16 '07 #5
ronverdonk
4,258 Expert 4TB
The switch variable must be enclosed within parentheses.
Like
Expand|Select|Wrap|Line Numbers
  1. switch($_GET['page']) {
  2.  
Ronald
Oct 16 '07 #6
Lumpy
69
Thanks Ronald, I missed the closing ). That should work.
Oct 16 '07 #7
ronverdonk
4,258 Expert 4TB
Thanks Ronald, I missed the closing ). That should work.
You are welcome. It should work now for octavian.

Ronald
Oct 16 '07 #8
THanks , It now works beautifully, i am goin to integrate it where you currently see html hyperlinks on the site, thanks a ,million
Oct 17 '07 #9
DtM
1
I am grinding my teeth trying to implement this piece of code. After looking at examples on this site and others I am wondering if there's a setting in PHP 5 that's inhibiting this.

I have a url on one page that states the following when I copy it while hovering over it with my mouse: http://localhost/dev/SubCatNav.php?Category=Bar

On the page SubCatNav.php I have the code:
[PHP]
<?php

$Category = $_GET['$Category'];
echo "The Cat variable is: " . $Category ;

?>

[/PHP]

Upon running the script, I receive the error "Undefined index: $Category" and the line number which corresponds to the declaration of the variable [line 3 in the example].

Any ideas?
Jan 26 '08 #10
I am grinding my teeth trying to implement this piece of code. After looking at examples on this site and others I am wondering if there's a setting in PHP 5 that's inhibiting this.

I have a url on one page that states the following when I copy it while hovering over it with my mouse: http://localhost/dev/SubCatNav.php?Category=Bar

On the page SubCatNav.php I have the code:
[PHP]
<?php

$Category = $_GET['$Category'];
echo "The Cat variable is: " . $Category ;

?>

[/PHP]

Upon running the script, I receive the error "Undefined index: $Category" and the line number which corresponds to the declaration of the variable [line 3 in the example].

Any ideas?
Here the problem is in accessing the category. Look at the first line the, $_GET['$Category'];
Here is the problem. remove the dollar sign in side the GET method.
it should be like this
[PHP]$Category = $_GET['Category'];
echo "The Cat variable is :".$Category;[/PHP]
i think now it will work .. ok
Jan 27 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Tero Partanen | last post by:
Hello! I'm writing about a rather peculiar problem I'm having with Access2000. I have a table in which I have created one hyperlink-type field. I have given the field a default value which is...
4
by: Marco Krechting | last post by:
Hi All, Sorry but I have to create new message since it cannot find the old message to send a reply. Coming back to this hyperlink thing I will try to explain the real problem cause I think we...
1
by: Badboy36 | last post by:
Hello user from googlegroups, i made a microsoft access database with front and backend. i created the backend in microsoft access97. for the frontend i made two versions (one for microsoft...
9
by: Leigh Kendall | last post by:
I can't find any issue in the MS KB, but I'm experiencing the following problem which seems to be specific to IE5, and NOT any other version of IE 5.5+ or NN 6+. Issue: I'm using an asp.net...
5
by: JerryK | last post by:
Hi, I am trying to put a hyperlink to a .cer (certificate) file on a form. Normally (on a ,htm page) when the user clicks on the hyperlink, the file is not recognized and the user is given the...
10
by: hecsan07 | last post by:
I am a novice programmer. I want to have a hyperlink that looks like so: www.mycoolsite.com?a=21132. On click I want to extract the query string and use it to query a table within a DB (SQL...
3
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
20
by: tshad | last post by:
I had posted this problem earlier and just noticed that the Hyperlink is the problem. Apparently, it doesn't figure out the path correctly. It uses the path of the file it is in, even if it is...
5
LAD
by: LAD | last post by:
Using Access 2003 on Windows 2000. My Skill Level: Med Low (Some VBA, okay with Access) Form: Single View - based on Query of single Table to sort by field. Application: Dealers email 'contract...
1
NeoPa
by: NeoPa | last post by:
Error 7980: The HyperlinkAddress or HyperlinkSubAddress property is read-only for this hyperlink I'm struggling with some code to update Hyperlinks in my table. The field is defined as a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.