Jump to content

Posting data without clicking


MemphiS

Recommended Posts

I can answer this one.

 

You can do this easily by using hidden fields.

 

Heres an example

echo "<input type='hidden' name='basketball' value='basketball'>";

 

Whatever that is posted to you will be able to gets its post variable ie in this case $_POST['basketball']

 

Just include that inside a form tag.

If you use hidden fields you still have to use a submit button within a form.

 

If you want to pass data from one script to another you can do this easily by using sessions.

 

Hidden fields are very handy and I often use them for contact forms and guestbooks where I have the actual submit form and a verification page in the same script.

Either of you havent answer what my question was really... Posting data from one website to another.. Sessions will not hold across to another webserver... I could simply copy the html from website two and place it on website one and have variables already set but i wish to auto "<form action="">"it...

Sorry, bit tired this morning, overslept and didn't read the "other sites" bit.

 

One option you can use is to append the data onto the end of URLs and read it using a series of $_GET statements.

 

Problem with this is that the data is very insecure and can be changed by the user. You can encrypt the URL but this is also insecure. All it takes is for someone to figure out your encryption routine.

 

The other option is mentioned above by using hidden fields in a form although it means you'll have to use a submit button to have the data sent.

<form action="http://www.website2.com/getdata.php" method="post">
<input type="hidden" name="secret" value="<?=$secret?>" />
<input type="submit" name="subsend" value="Please click to continue" />
</form>

 

That sort of thing should work. Just use as many hidden fields as you want but this is also insecure.

 

Someone needs only view the source to that page, make their own and like to the second web site so you'd have to check the referer of the link which yet again is also insecure as referers can be spoofed.

Thanks for your reply :)

 

i dont really wish to use $_GET or hidden input fields.. and there only insecure if you dont validate the data coming from them..

 

but anyway thanks for your suggestions i really just looking for a way to $_POST the data to another site  ;)

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.