Goose87 Posted April 7, 2008 Share Posted April 7, 2008 Hey guys, I'm not sure if it's even possible in php, i think i need some kind of javascript, but i want the following to happen: someone clicks a link on my site, i want it to open a page in a new tab/window and then i adjust the database when they have (its a voting site).. I don't want people to feel like I'm asking for the answer and being lazy, as I'm not like that, so if you give me just advice, guidance, I will try and code around the problem Thanks in advance for your help, I appreciate it. Goose. Link to comment https://forums.phpfreaks.com/topic/100014-new-page-opened/ Share on other sites More sharing options...
cooldude832 Posted April 7, 2008 Share Posted April 7, 2008 adjust the database like shim up the computer case its in on a coaster? be more specific plz Link to comment https://forums.phpfreaks.com/topic/100014-new-page-opened/#findComment-511457 Share on other sites More sharing options...
Goose87 Posted April 7, 2008 Author Share Posted April 7, 2008 Oh sorry, i forgot to state that the "update the database" part isn't significant. The actual problem is: What do i type to make the query actually work. For example: if(isset($_POST['submit'])) { $query; } What do i type instead of isset for the new page/window being opened? EDIT: I suppose I could have the submit one (have buttons on a page) but then how do i make the code open a new window? Thats javascript isnt it? Link to comment https://forums.phpfreaks.com/topic/100014-new-page-opened/#findComment-511463 Share on other sites More sharing options...
cooldude832 Posted April 7, 2008 Share Posted April 7, 2008 you want a conditional way to execute a query if and only if it was accessed via a an anchor tag that was target="_blank" or a javascript derivation of _blank for you strict doc type ppl? write some pseudo code out to be helpful. Link to comment https://forums.phpfreaks.com/topic/100014-new-page-opened/#findComment-511466 Share on other sites More sharing options...
Goose87 Posted April 7, 2008 Author Share Posted April 7, 2008 errr..you'll have to excuse me because I've had a very long day and i've driven across half the country, because I didn't understand that last post. I'll try and explain the situation in it's literal sense: I have a website, I want people to go to another website and vote for my website. This involves loading a new page up. When a person clicks the button and loads the new page up, I want to do a quick query to the database. The query is a simple quantity=quantity+1 type query, so I don't need help with that. What I need help with is what I type to execute the query. i.e. How do I know the person has loaded the page up? Link to comment https://forums.phpfreaks.com/topic/100014-new-page-opened/#findComment-511483 Share on other sites More sharing options...
cooldude832 Posted April 7, 2008 Share Posted April 7, 2008 the links need to be rewritten in 1 of 2 ways 1) Javascript functions that onclick not only navigate the user forward but also run a query via AJAX 2) rewrite your links to go to a page on your server mysite.com?out=http://www.google.com add a count to google and the header reloacte or meta refresh to google.com Link to comment https://forums.phpfreaks.com/topic/100014-new-page-opened/#findComment-511509 Share on other sites More sharing options...
Goose87 Posted April 7, 2008 Author Share Posted April 7, 2008 I think I will try the second method. The use of javascript and ajax is already getting me confused So to sum it up, could i do it like the following: if(isset($_POST['submit'])) { $query; // Run the query to the database. echo "<meta http-equiv=\"refresh\" content=\"0;URL=www.google.com\">"; exit(); } ..Or is the above a total pile of rubbish? Please bare in mind I've had a long day, I just really want to make this code work before I go to sleep, or I'll prob be up thinking about it all night. Thanks for understanding. Link to comment https://forums.phpfreaks.com/topic/100014-new-page-opened/#findComment-511571 Share on other sites More sharing options...
cooldude832 Posted April 8, 2008 Share Posted April 8, 2008 no you need to have mysite.com/redirect.php?Page=http://www.google.com <?php $page = $_GET['Page']; if(#ISAPAGE){ #query to insert a + count #redirect } else{ #splash error invalid redirect } ?> Link to comment https://forums.phpfreaks.com/topic/100014-new-page-opened/#findComment-511681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.