javascript - External href does not open while fetching from data
Get the solution ↓↓↓In my header i want two adds and site logo in middle. i have place one marquee and one picture add. In marque i have to fetch data from my table. When i click image to go to its URL. It always find page in my domain folder. and do not go to complete URL. java script is used now picture add go to the complete URL but marquee find page in my domain folder. Here is my code:
<td width="140" height="140" valign="top" align="center" bgcolor="#FFFFFF" class="index-unwel" ><marquee direction="right" scrollamount="2" onmouseover="this.stop();" onmouseout="this.start();">
<div align="left" style="width:94%;">
<span style="text-transform:uppercase;">
<?
$qryAdv = mysql_query("SELECT * FROM ".TOPADD." WHERE 1");
if(mysql_num_rows($qryAdv) > 0)
{
while($adv = mysql_fetch_assoc($qryAdv))
{
?>
<a href= "#" onClick="window.open('<?=$adv['adv_url']?>', '_blank')"><img src="<?=TADD.$adv['adv']?>" width="20%" alt="ADDS"></a> <br /> <br />
<?
}
} else { echo 'NO ADDS FOUND!!!'; }
?>
</marquee></td>
<td width="50%" align="center"><a href="index.php"><img src="images/logo1.gif" width="315" height="140" alt="LOGO COMPANY" ></a></td>
<td width="25%" align="center"><a href="#" onClick="window.open('http://www.veinstitution.com/', '_blank')"><img src="images/veins.gif" width="140" height="140" alt="LOGO COMPANY" ></a></td>
</tr>
when i click on marquee image it goes to http://divya.veinstitution.com/http//www.veinstitution.com but it should go to http//www.veinstitution.com
Adding add to marquee code is:
<?php
include_once("../init.php");
validation_check($_SESSION['UID'], SITE_HOME_ADMIN);
$msg='';
if(isset($_POST['save']))
{
$upDir ='../'.TADD;
$insertSql="INSERT INTO ".TOPADD." SET
`adv_url` = '".realStrip($_POST['adv_url'])."'";
$query = mysql_query($insertSql);
$adv_id = mysql_insert_id();
$adv = '';
if($_FILES["adv"]['name']!= ''){
$fileData = pathinfo(basename($_FILES["adv"]["name"]));
$adv = $adv_id . '_adv.' . $fileData ['extension'];
move_uploaded_file($_FILES["adv"]["tmp_name"], $upDir . $adv);
}
$upSql="UPDATE ".TOPADD." SET `adv` = '".$adv."' WHERE id = '$adv_id'";
$query = mysql_query($upSql);
$msg = '<h3>Record Saved</h3>';
}
?>
See and advice me the changes.
Answer
Solution:
The problem is your URL is missing a colon:
http//www.veinstitution.com
must behttp://www.veinstitution.com
Hence the browser is appending the base URL because you're using the wrong protocol.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: you must enable the openssl extension in your php.ini to load information from https://repo.packagist.org
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.