is it possible to submit a page without using a form

Reply

Join Date: Aug 2007
Posts: 2
Reputation: php_azar is an unknown quantity at this point 
Solved Threads: 0
php_azar php_azar is offline Offline
Newbie Poster

is it possible to submit a page without using a form

 
0
  #1
Jul 8th, 2008
is it possible to submit a page without using a form
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,076
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: is it possible to submit a page without using a form

 
0
  #2
Jul 8th, 2008
I think so...

You make onSubmit() in your submit button...
or
You can use an onclick and use the form.submit() function though.

This is for checking submit button is working or not..


if(@$_POST['Submit'])
{


or
or
try using header("location:abc.php?username=xyz");

You have to make your header() calls before your script outputs anything.


Thanks
Shanti..
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 848
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 68
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: is it possible to submit a page without using a form

 
0
  #3
Jul 8th, 2008
There are two ways that I know of and that is ajax with javascript and Curl with PHP.
Ajax has recently gotten a lot of attention and here is some sample code:

Ajax objectdo not modify)
  1. //the ajax object for all ajax functions
  2. function ajaxObject()
  3. {
  4. var objectsuccess = true;
  5. var xmlHttp;
  6. try
  7. {
  8. // Firefox, Opera 8.0+, Safari
  9. xmlHttp=new XMLHttpRequest();
  10. }
  11. catch (e)
  12. {
  13. // Internet Explorer
  14. try
  15. {
  16. xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  17. }
  18. catch (e)
  19. {
  20. try
  21. {
  22. xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  23. }
  24. catch (e)
  25. {
  26. objectsuccess = false;
  27. }
  28. }
  29. }
  30.  
  31. if(objectsuccess == false)
  32. {
  33. alert("Your browser does not support AJAX!");
  34. return false;
  35. }
  36. else
  37. {
  38. return xmlHttp;
  39. }
  40. }

Ajax post functiondo not modify)
  1. /*postVars example
  2. variable1=value&variable2=value&variable3=value&variable4=value
  3. */
  4. function triggerPost(postVars, url)
  5. {
  6. var xmlHttp = ajaxObject();
  7. xmlHttp.onreadystatechange=function()
  8. {
  9. if(xmlHttp.readyState==4)
  10. {
  11. return xmlHttp.responseText;
  12. }
  13. }
  14.  
  15. xmlHttp.open("POST",url,true);
  16. xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
  17. xmlHttp.send(postVars);
  18. return xmlHttp;
  19. }

Your event functionmodify to fit your needs)
  1. function ajaxlogin()
  2. {
  3. //generate variables in query string format leaving out the innitial "?"
  4. var postVars = "";
  5.  
  6. //the script you want to post to ex. forms/submitform.php
  7. var url = "";
  8.  
  9. var xmlHttp = triggerPost(postVars, url);
  10.  
  11. xmlHttp.onreadystatechange=function()
  12. {
  13. if(xmlHttp.readyState==4)
  14. {
  15. var formOutPut = xmlHttp.responseText;
  16. //process the form response
  17. }
  18. }
  19. }
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1166 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC