Current location: Hot Scripts Forums » Programming Languages » PHP » POST without submit button

POST without submit button

Reply
  #1 (permalink)  
Old
AbelaJohnB's Avatar
Newbie Coder
 
Join Date: Jun 2003
Location: Redwood Trees!
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
POST without submit button

Hey All.

How would I post data from one page to another withOUT using a forms submit button.

In essance, I want to pass information from one page to the next without forcing a user to click a forms button. Typically I use header() to redirect, but I need to redirect using a form POST so that the variables are not shown within the URL.

I'm sure this is one of those idiot questions, but I've never had to do this in 5+ years of programming, so got no idea.


Thanks.
Reply With Quote

Featured Marketplace Scripts (view more)

  #2 (permalink)  
Old
blaw's Avatar
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

I believe JavaScript's form object has a method to submit a form (thus submitting without a button-click), but if I understood your post correctly, you don't even want a form there - in that case, you can use cURL library. This allows you to set $_POST without going through an HTML form (and way more than that). Some familiarity with HTTP will definitely be a help in using cURL. I'm nopt an expert on this, so if you are interested, check these out:

cURL Official Site:
http://curl.haxx.se/

PHP.net cURL Functions
http://ca3.php.net/curl/

Good luck.
__________________
Blavv =|
Reply With Quote
  #3 (permalink)  
Old
Trevor's Avatar
Wannabe Coder
 
Join Date: Jun 2003
Location: Denver, Colorado
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
<script language="javascript">
<!--
function mySubmit() {
document.formName.submit();
}
// -->
</script>
<form name="formName" action="url" method="post">
<a href="javascript:mySubmit()>Submit Me</a>
</form>
__________________
The Universe Our God, Nature Our Temple, Love And Duty Our Religion, Knowledge Our Happiness And Consolation, Death The Dissolution Of The Ego, And The Return To Eternity.
Reply With Quote
  #4 (permalink)  
Old
Newbie Coder
 
Join Date: Dec 2003
Location: Delaware
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
In the page that you don't want to have the submit
button on, you would have to have all of the additional
normal html and form properties on the page with your
form post as follows:

<form name= "order" action="https://www.yoursite.com/your_order_page.php" method="post">


At the end of your html page, you'd include this javascript
so that it would submit the contents of this page after
it has finished loading.

<script type="text/javascript" language="JavaScript">
//submit form
document.order.submit();
</script>
</body>
<html>


----
This is handy for order conformation pages. The possibilities are unlimited.

Regards,
Chris
__________________
SeoMagnet Solutions
Express Submit, Optimize and Ranking
http://www.seomagnet.com
Reply With Quote
  #5 (permalink)  
Old
Newbie Coder
 
Join Date: Dec 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, I have to ask.

If all you are wanting to do is pass hidden data from one page to another why not use cookies or a session?

Regards,
michael
Reply With Quote
  #6 (permalink)  
Old
NeverMind's Avatar
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
Quote:
Originally Posted by michaeln
Ok, I have to ask.

If all you are wanting to do is pass hidden data from one page to another why not use cookies or a session?

Regards,
michael
seems you don't know who's John yet !
he is one of phpBB Co-Founders .. so if it was possible to do it by sessions or cookies he would've known ..
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Art Nexus seeking PHP programmers TheArtNexus Job Offers & Assistance 5 02-26-08 03:08 AM
image submit button problems Pepe PHP 10 12-22-03 08:15 PM
First time poster needs help with a mouseover submit form button mess. teh_fonx JavaScript 3 12-21-03 12:19 AM
process form without press submit button azwani JavaScript 1 11-03-03 01:10 AM
radio button selection TheLaughingBandit ASP 3 08-31-03 06:22 PM


All times are GMT -5. The time now is 10:37 AM.
vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.