r2ks Posted June 7, 2009 Share Posted June 7, 2009 Ok i have a Div on a Form and a Menu i would like to open the PHP when i click on the Menu ><a href="pl_user.php"target="test"> At this it only open a new window Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 7, 2009 Share Posted June 7, 2009 Huh? I don't get what you're asking. Also test is not a valid target attribute. Quote Link to comment Share on other sites More sharing options...
fantomel Posted June 7, 2009 Share Posted June 7, 2009 <div id="example"> <a href="pl_user.php" target="_self">click here</a> </div> i think before you start using CSS you should revise your HTML knowledge because.. target="test" doesn`t exist target can be _blank, _parent, _self, _top and if i do remember quite well(it`s been a long time since i`ve read the manual i think you will find there a reference about framesets. If you don`t have a manual you should use this one HTML Manual P.S this topic should be in HTML Help Area. Quote Link to comment Share on other sites More sharing options...
r2ks Posted June 7, 2009 Author Share Posted June 7, 2009 i think before you start using CSS you should revise your HTML knowledge because.. target="test" doesn`t exist target can be _blank, _parent, _self, _top and if i do remember quite well(it`s been a long time since i`ve read the manual i think you will find there a reference about framesets. If you don`t have a manual you should use this one HTML Manual First let me start by saying Thank you and yes i know test is not a Valid Target ?? it is not a Html Question i dont think ?? Ok I have a Menu on a PHP form in the Menu i have a Place called Users you can Click. i would Like that to excute pl_user.php in a div under the Menu instead it Open i new Window. (The test in the Target was the Div Called Test) P.S i did try this <div id="example"> <a href="pl_user.php" target="_self">click here</a> </div> and it Opened up i new page outside not in the example div Quote Link to comment Share on other sites More sharing options...
gevans Posted June 7, 2009 Share Posted June 7, 2009 It sound like you want to call your php script asynchronously (i dont know how to spell that) You need to look into ajax Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 7, 2009 Share Posted June 7, 2009 gevans, you spelt it correctly. Quote Link to comment Share on other sites More sharing options...
gevans Posted June 7, 2009 Share Posted June 7, 2009 Really?? That was a complete guess, my spelling is really bad as well. p.s. I just read my post 3 times before posting as I was scared of looking like a douche! (I googled douche) Quote Link to comment Share on other sites More sharing options...
r2ks Posted June 7, 2009 Author Share Posted June 7, 2009 Thank you every one for you posts to help me (asynchronously ) is not what i want to do.. Let me explain this way <div id="example"> <?php include "pl_user.php" ?> </div> this works it Loads the PHP pl_user.php but on load of the Page. if i have ( Click on ME ) how would i load the pl_user.php in the example div from a link ?? Thank everyone Quote Link to comment Share on other sites More sharing options...
dawsba Posted June 7, 2009 Share Posted June 7, 2009 Hi, gevans is right, the only way to reload a div is through ajax: Javascript for simple ajax function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); var returnDiv function sndReq(divRet,file) { var date = new Date(); var timestamp = date.getTime(); returnDiv = divRet; http.open('get', file+'&time='+timestamp); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; document.getElementById(returnDiv).innerHTML = response; } } to call this use <a href="javascript:sndReq('example',p1_user.php&<?= rand(10000,99999); ?>">Click Here</a> The only other way I know is with iframe redirection. Quote Link to comment Share on other sites More sharing options...
r2ks Posted June 8, 2009 Author Share Posted June 8, 2009 so the only way to open a pHp script inside a Div on a Page is ajax: I just find that kind of strange to I can launch a php script from a link but we can not get that script to Load inside a div with out Ajax.. Thank you :'( Quote Link to comment Share on other sites More sharing options...
gevans Posted June 8, 2009 Share Posted June 8, 2009 You cannot load it inside a div on a page asynchronously without ajax. If you just wanted it there from the start that's fine. Or if you were willing for a page refresh that's fine. But php is a server side script and requires communication with the server, this cannot happen with a page refresh, or an asynchronous call, via ajax. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 8, 2009 Share Posted June 8, 2009 Or use iFrame/frames, which I do not recommend because that is very tacky. Quote Link to comment Share on other sites More sharing options...
r2ks Posted June 8, 2009 Author Share Posted June 8, 2009 Thank you all for your help on this i just started to learn PHP and i see i am going to have to learn something new what would you all suggest Ajax ?? Java script ?? Quote Link to comment Share on other sites More sharing options...
gevans Posted June 8, 2009 Share Posted June 8, 2009 ajax isn't a scripting language, it stands for 'asynchronous JavaScript and XML' and incorporates languages (javascript being the primary) to complete asynchronous calls. Try researching it using a javascript framework like jQuery, very easy. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.