0

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]']);
?>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by twiss
0

Use:

window.open('date_time_buy.php?site='+site+'&model='+model+'&url='+temp+'&ip='+ip, '_blank');
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.