hi all,

Im trying to add a "title" to a switch case statement below, but for some reason im unable to complete, what I thought was a simple task.
Hope someone can help and explaine the reasons why
cheers, Lloyd

switch($ad)
{
	case "add1.gif";
	header("Location: http://www.google.co.uk");	
	break;

	case "add2.gif";
	header("Location: http://www.youtube.com");	
	break;
Member Avatar
diafol

Jeez Luis - amd_k8 just told you to place a colon at the end of your case syntax as opposed to ending with a semi-colon.

Do you mean, its not possible ???

It's not possible for you to replace a semi-colon with a colon??? *sigh*

Doh.... I do say sorry for missing that, what a complete a$$......

I have tried adding a "title" tag in many ways but still missing the point,

I have tried the following

case "add1.gif" title='test':
	header("Location: http://www.google.co.uk");	
	break;

case "add1.gif":
	header("Location: http://www.google.co.uk" title='test');	
	break;

case "add1.gif":
                title="test";
	header("Location: http://www.google.co.uk" title='test');	
	break;

case "add1.gif":
                title="test":
	header("Location: http://www.google.co.uk");	
	break;
case "add1.gif":
	header("Location: http://www.google.co.uk");	
                title="test":	
                break;

Im not sure if theres anyother place to place the title, any pointers on this would be great

What exactly are you trying to accomplish with the "title" statement?

Member Avatar
diafol

The header() is usually a redirecting function, so title will not show up anywhere. Unless you have a 'delay' that shows some text before redirect.

header('Refresh: 5; url=http://www.mysite.com/');
echo $title . " You will be redirected in 5 seconds";

Note that url parameters in headers should be FULL urls including the 'http://' bit.

The header() is usually a redirecting function, so title will not show up anywhere. Unless you have a 'delay' that shows some text before redirect.

header('Refresh: 5; url=http://www.mysite.com/');
echo $title . " You will be redirected in 5 seconds";

Note that url parameters in headers should be FULL urls including the 'http://' bit.

Hi, thanks for posting, I have just learnt a new piece of code from you.

What I am trying to do, Is when someone hovers over the img that is displayed, Id like it to show a "title text tag" before the user clicks the image to go to the url ??

Thanks for your input,

Lloyd

That needs to be done in the html <img> tag, PHP's "header" function doesn't do that. Use the "title" attribute, example:

<img src="ad1.jpg" title="Ad description here" />

Edit: Additionally, unless there's a specific reason you need to use a header for the link you would be just as well off with using an image link like this:

<a href="http://www.google.co.uk"><img src="ad1.jpg" title="Ad description here" /></a>
Member Avatar
diafol

Yeah, รจ molto confuso. I can't understand why you'd need to use header. Just a normal html link should suffice - with or without image.

title for the image should be with <img src="" title="" /> ... "Swich" statement execute only from server side ( in this case you can use only after the user click on that image ) ... For displaying title at the hover time , you can go for specifying title with <img > or javascript or advanced AJAX scripts ...
Refer the following urls for switch case
http://php.net/manual/en/control-structures.switch.php
http://www.phpmysqlbrain.com/syntax/php-switch-case/
http://www.w3schools.com/PHP/php_switch.asp