Jump to content

Help with Post redirect


bethaliz

Recommended Posts

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)?

Link to comment
https://forums.phpfreaks.com/topic/145664-help-with-post-redirect/
Share on other sites

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');
}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.