473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Can I use php to open header in new window ?

290 100+
I am using my script to update my table with the click number and then redirect to the stored href link:

Expand|Select|Wrap|Line Numbers
  1.  // update database
  2. $sql = "UPDATE adverts SET click_cnt = $N_ctr WHERE advert_id = $N_ad_id";
  3. mysql_query($sql) or die("could not execute adverts update query". mysql_error());
  4.  
  5. header("Location: $N_ad_link");
  6. exit(); 

The only problem I have with this is that my web page gets replaced.

What I really want to do is open a new window and have the new web page in that. I can put a notice to say it will open a new window, its just that it will really annoy people if my page closes on them when they are half way through a tutorial !

What do I need to do to open the link in a new window ?

Thanks for helping
Feb 11 '09 #1
5 6110
Markus
6,050 Expert 4TB
You need Javascript
Feb 11 '09 #2
jeddiki
290 100+
Thanks,
any idea how I would take my php $link variable and get the javascript to open a new window with it ?
Feb 12 '09 #3
Markus
6,050 Expert 4TB
echo() your variable into your javascript where it is needed, then javascript has access to it.
Feb 12 '09 #4
jeddiki
290 100+
I think if I just put
target="_blank" when I call the script it will work.

I have tried it and it seems fine :)

Can you see any problems with that ?
Feb 12 '09 #5
Markus
6,050 Expert 4TB
@jeddiki
Nope that will work fine.
Feb 12 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Jayme Assuncao Casimiro | last post by:
Is there the possibility of not permiting the user of opening two windows of the same web site? Thanks +---------------------------------------------+ | Jayme Assuncao Casimiro ...
1
by: Ben Smeets | last post by:
Hi folks, Have been trying to figure out a solution for the following problem by reading lots of threads here, but doesn't work out. Hope someone can help me. I have a parent window which...
1
by: Ed Brandmark | last post by:
I want to be able to open a window in the background of my page - without that flicker you see if you just open the window and then blur it (or focus the main window). The reason I want to do this...
1
by: Nevyn Twyll | last post by:
I have a DataList; in the DataList's , I have a LinkButton and a few listboxes. When the LinkButton is pressed, I need to get the ID of the selected item in one of the Listbox controls. Then I...
3
by: ACaunter | last post by:
Hi all, I need to set a session variable and open a new window with a single click of an asp.net button. My problem is that it always takes two clicks.. one sets the session and the other opens...
6
by: slacker | last post by:
In my jsp I have: <Script langauge="Javascript"> window.location.replace("first url"); window.close(); window.open("second url"); </Script> The child window opens from the parent window...
1
by: sathyanrockie | last post by:
Plase tell me what is the difference between window.open and window.showmodelessdialog. Can we use window.showmodelessdialog in place of window.open?
19
by: Sonnich | last post by:
Hi! I have used JS, but I am still new to it. I have something like this: oNewWindow = new Object(); oNewWindow = open("sonnich.xls","Qopen","resizable=yes,scroll=yes, status=yes,...
0
by: hcuellar | last post by:
Hi. Please I need your help for this: After a database query, a table is created with a cell for each information retrieved, and for each record, two buttons, and second one have besides it...
4
by: Arivu PHP | last post by:
I have to open new window without clicking link or url.. i need to open autometically when entered the inside of my webpage. can any one help this task..
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.