Jump to content

Posting data without clicking


MemphiS

Recommended Posts

Can this be done? I have 2 sites and i wish to send data from one to another and i need a way of posting the info to my other site where it will save the data..It will happen everytime new data is submitted...

 

Thanks  8)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<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.

Link to comment
Share on other sites

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  ;)

Link to comment
Share on other sites

If there are some fields in the form like text fields,dropdown selection lists etc, you can use the JavaScript functions to do the action.When the value is entered in the textfield or some value is selected from the drop down list then there will be auto submission.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.