posting from php

They have: 87 posts

Joined: Dec 2001

is it possible using a header or something to post information to another script as if it was being posted by a form?

They have: 447 posts

Joined: Oct 1999

easiest way would be to redirect to the form handler sending the data in the url. this won't work if the handler only looks for POST data though...

<?php
// assuming the form takes two fields, name and comments

$username = \"Fred Flintstone\";
$comments = \"Your site is teh win!!!\";

// make the parameters url safe
$username = urlencode($username);
$comments = urlencode($comments);

// redirect to the form handler
header(\"Location: http://www.mysite.com/formsubmit.php?username=
$username&comments=$comments\");
exit;
?>

They have: 87 posts

Joined: Dec 2001

shoot, it only looks for the POST data though... because im sending it to a cgi script... Sad

He has: 1,016 posts

Joined: May 2002

Can't you have the PHP script print out a HTML form (method set to POST) with a javascript that submits that form when the page has loaded? It shouldn't be that hard to do.

They have: 87 posts

Joined: Dec 2001

i could do that, but it wouldn't look good. i will just to take a different route to get my results. thanx for the responces.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.