Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Sending value from one php page to another using Ajax

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
anp24
New one
New one


Joined: 24 Jun 2008
Posts: 1

PostPosted: Tue Jun 24, 2008 5:15 am    Post subject: Sending value from one php page to another using Ajax Reply with quote

hello,
I am trying to send values from one php page to another. I am getting the value in "ResponseText" , but when the next page is displayed , the value of the parameter specifically "fm" is not displayed on that php page.

Following is the code in "start.php" that I have written

Code:
<script language="javascript">

var httpObject=null;

function getXmlHttpObject(url,parameters)
{

       try
       {
       // Firefox, Opera 8.0+, Safari
       httpObject=new XMLHttpRequest();
       }
      catch (e)
       {
           //Internet Explorer
       try
        {

           httpObject=new ActiveXObject("Msxml2.XMLHTTP.4.0");
        }
          catch (e)
          {

           httpObject=new ActiveXObject("Microsoft.XMLHTTP");
          }
        }

    if (httpObject != null)
    {
     httpObject.open("POST", url , true);

     httpObject.onreadystatechange=function setOutput()
     {
     alert(httpObject.readyState);
     if(httpObject.readyState == 4)
    {
    if (httpObject.status==200)
    {
     alert(httpObject.responseText);
     }
    }

     }

     httpObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

     httpObject.setRequestHeader("Content-length", parameters.length);

     httpObject.setRequestHeader("Connection", "close");

      alert(parameters);

     httpObject.send(parameters);

    }
    else
    {
    alert('Giving up  Cannot create an XMLHTTP instance');
 return false;

   }


}

function ajax_check(obj)
{

var poststr="fm="+encodeURIComponent(document.getElementById("frommail").value)+"&cardto="+encodeURIComponent(document.getElementById("cardto").value)+"&greet="+encodeURIComponent(document.getElementById("greet").value)+"&mesg="+encodeURIComponent(document.getElementById("mesg").value)+"&send="+encodeURIComponent(document.getElementById("send").value)+"&Daycurrent="+encodeURIComponent(document.getElementById("Daycurrent").value)+"&Monthcurrent="+encodeURIComponent(document.getElementById("Monthcurrent").value)+"&Yearcurrent="+encodeURIComponent(document.getElementById("Yearcurrent").value)+"&previewbutt="+encodeURIComponent(document.getElementById("previewbutt").value)+"&tomail="+encodeURIComponent(document.getElementById("tomail").value)+"&Day="+encodeURIComponent(document.getElementById("Day").value)+"&Month="+encodeURIComponent(document.getElementById("Month").value)+"&Year="+encodeURIComponent(document.getElementById("Year").value);

 getXmlHttpObject("privew.php",poststr);

</script>


<script language="javascript">
function chk_empty(form1)
{
var flag=0;
var cnt=0;


if(document.form1.send[1].checked=='true')
    {
if((document.form1.Day.selectedIndex==0)||(document.form1.Month.selectedIndex==0)||(document.form1.Year.selectedIndex==0))
   {
     alert ("You have not selected the date.");
     return false;
   }
    }

}

</script>





following is the coding of the form




<form name="form1" method="post" action="privew.php" onSubmit="return chk_empty(form1)"  >


  <input type=submit name=previewbutt value=Preview onClick="ajax_check(this.parentNode)" class="buttons">

</form>



what should I do so that I can get the value of parameter sent through AJAX on next page

Thank you
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert