Page 1 of 1

PHP New Window Problem

Posted: Fri Oct 16, 2009 6:01 am
by expediant
Hi There, (first Time Poster)

I was hoping somebody could give me some advice on a line of code.

if($row['LinkText'] != '' && $row['LinkUrl'] != '') {$Url[]="<br><br><a href=\"$row[LinkUrl]\">$row[LinkText]</a><br><br>";}else{$Url[]='';}


Basically, I am trying to make the ['LinkUrl'] open in a new window rather than in the same window i have tried various HTML and JAVA techniques but it keeps causing errors in my database.

Not sure if anybody needs anymore of the code, so if you do then please let me know.

I know this is a tricky one, but hoping somebody can help.

Thanks
_______

Re: PHP New Window Problem

Posted: Fri Oct 16, 2009 6:16 am
by Mark Baker
So you've tried <A href="url" target="_blank">xyz</A>


But that shouldn't give database errors

Re: PHP New Window Problem

Posted: Fri Oct 16, 2009 6:21 am
by expediant
Thanks.

Where abouts in th code should i put it? and should i replace the xyz ??

Thanks Again

Re: PHP New Window Problem

Posted: Fri Oct 16, 2009 6:36 am
by Mark Baker
expediant wrote:Where abouts in th code should i put it? and should i replace the xyz ??
It's your line of code... you quoted it in your original post, so you really should be able to do this for yourself

Code: Select all

if($row['LinkText'] != '' && $row['LinkUrl'] != '') {$Url[]="<br><br><a href=\"$row[LinkUrl]\" target=\"_blank\">$row[LinkText]</a><br><br>";}else{$Url[]='';}

Re: PHP New Window Problem

Posted: Fri Oct 16, 2009 6:43 am
by expediant
Many Thanks for that.

I am actually very new to coding - Started on OSDate and now moving on from their hence my knowledge is moderate but not skilled.

MANY THANKS FOR THE HELP.

Re: PHP New Window Problem

Posted: Fri Oct 16, 2009 6:47 am
by Mark Baker
I'd seriously suggest learning the rudiments of html first before moving onto PHP coding.
w3schools is always a good place to start

Re: PHP New Window Problem

Posted: Fri Oct 16, 2009 6:56 am
by expediant
Thanks for the advice, but i have learnt everything by just throwing myself in the deep end, and i havn't done bad so far and rarely need to ask any questions.

This one was just getting to me a bit. I actually knew what code to use, but was putting it in the wrong place.

Hence why i joind the forum for help and guidance and to hopefully offer my knowledge to others when i can.

Thanks again.