Hi,
I am working on this code.I am trying to redirect the URL coming from database.
i am using target="_blank" but its opening in reverse order.
i.e. main.php is opening in new page & uRl page is opening on the same page
but i want URl coming from database should open in new tab.
need help
Main.php

<a href="#" onclick="date_time_buy('adexmart','<?php echo $row["model"]?>', '<?php echo $row["url"]; ?>','<?php echo $ip; ?>')" >Buy</a>

date_time_buy code
JS function

function date_time_buy(site, model,[B] url[/B], ip)
	{
//		alert(url);
//		var str=url;
		var temp=url.replace("&", "%26");
		var temp=temp.replace("&", "%26");
		var temp=temp.replace("&", "%26");
		window.location='date_time_buy.php?site='+site+'&model='+model+'&url='+temp+'&ip='+ip;
	}
</script>

date_time_buy.php code

<?php
// echo $_REQUEST['site'].", ".$_REQUEST['model'];
 include("connect_mysql.php");
 $date=date("Y-m-s H:i:s");
 mysql_query("insert into buy_db (from_site, date_time_buy, model,ip) values ('".$_REQUEST['site']."', '$date','".$_REQUEST['model']."','".$_REQUEST['ip']."')");
 header('Location:'.$_REQUEST['[B]url[/B]']);
?>

Use:

window.open('date_time_buy.php?site='+site+'&model='+model+'&url='+temp+'&ip='+ip, '_blank');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.