Simple question for PHP

Simple question for PHP

Page 1 of 1

3 Replies - 1184 Views - Last Post: 17 December 2008 - 06:03 AM Rate Topic: -----

#1 fran123  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-December 08

Simple question for PHP

Posted 17 December 2008 - 03:31 AM

Hi all,
I use a database to extract the title of a url. I want to take save this title in a variable and then check if it is url1 or url2.
If it is url1 call url1 javascript function else if url2 call url2 function.

My code is :
Code: $query = "SELECT url FROM info";
$row = mysql_fetch_array($result);

if ($row['url']=='http://....')
{
echo '<A HREF="';
echo '<script LANGUAGE="javascript">';
//http://www.infysolutions.com
echo 'popUp("url1.php")';
echo "</SCRIPT>";
echo '">';
}

if($row['url']=='http://...')
{
echo '<A HREF="';
echo '<script LANGUAGE="javascript">';
echo 'popUp("url2.php")';
echo "</SCRIPT>";
echo '">';
}
What is the error??

Thanking you in advance
----------------------------------------------
Outsourcing software development

Is This A Good Question/Topic? 0
  • +

Replies To: Simple question for PHP

#2 danny_kay1710  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 28
  • View blog
  • Posts: 358
  • Joined: 27-April 08

Re: Simple question for PHP

Posted 17 December 2008 - 03:43 AM

Ok,

I don't think that the javascript code is correct. I am assuming that you have a function defined by the name of popUp?

Your html code is incorrect which is why it isn't popping up

Try making the code output something like this
<a href='' onclick="java script:popUp('http://www.google.co.uk')">Test Link</a>



See if that works
Danny
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6075
  • View blog
  • Posts: 23,543
  • Joined: 23-August 08

Re: Simple question for PHP

Posted 17 December 2008 - 05:56 AM

This is a great ad for your Outsourcing Company!
Was This Post Helpful? 0
  • +
  • -

#4 danny_kay1710  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 28
  • View blog
  • Posts: 358
  • Joined: 27-April 08

Re: Simple question for PHP

Posted 17 December 2008 - 06:03 AM

View PostJackOfAllTrades, on 17 Dec, 2008 - 04:56 AM, said:

This is a great ad for your Outsourcing Company!


It may well be a good ad, but what exactly is it advertising.....

This post has been edited by danny_kay1710: 17 December 2008 - 06:04 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1