bethaliz Posted February 18, 2009 Share Posted February 18, 2009 I have a php page that needs to insert records into a database piece by piece. We have company contacts with many branches and each branch can have many contacts. When they add a new company they need to give us the company name and address, they then select "add Branch" When they select add branch the company record needs to be created in the data base, while in the SAME page an in page pop up gathers information for the branch, when they close this windo a table appears at the bottom of the page to display the branch records that go with this company. Unfortunately when I enter the company record, the page is redirected. How do I get it to stay on the same page with the pages new state (ie the branch pop up being displaed)? Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 18, 2009 Share Posted February 18, 2009 you will need ajax/dhtml/javascript to do this.... PHP is server side....you need a client side language to make these changes while staying on the same page. Quote Link to comment Share on other sites More sharing options...
Dtonlinegames Posted February 18, 2009 Share Posted February 18, 2009 use Ajax, something like this would do function getFile(){ var docLoad; try{docLoad = new ActiveXObject('Msxml2.XMLHTTP');//IE} catch (e){try {docLoad = new ActiveXObject('Microsoft.XMLHTTP');} catch (e2){try{docLoad = new XMLHttpRequest();//MZ} catch (e3){docLoad = false;}} } if(docLoad !== false){ docLoad.onreadystatechange =function(){ if(docLoad.readyState ==4){ if(docLoad.status ==200){ document.getElementById('confirmdiv').innerHTML =docLoad.responseText; } else{ document.getElementById('confirmdiv').innerHTML ='There was an error <strong>'+docLoad.status+'</strong>'; } } }; docLoad.open('GET','FILE URL!!',true); docLoad.send(null); } else{ alert('Please either enable JavaScript or update your browser before you use this page'); } } Quote Link to comment Share on other sites More sharing options...
priti Posted February 18, 2009 Share Posted February 18, 2009 As suggested you have to use AJAX. I suggest you use JQUERY for AJAX .It will easy the development of yours. Thanks 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.