Jump to content

Using PHP to send data from one site to another


phpjayx

Recommended Posts

I'm testing out a simple form.  I'm wanting to have this code be available to other websites to use to allow them to send a couple of variables over to my site.....  my test code isn't even working.  I'm sure its something simple I'm doing incorrectly.

 

Any help would be appreciated.  Thanks in advance.

 

 

------------------------------------------------------

 

        <form action="" method="post">

<div id="entry_fields">        
            <input class="textfield" id="email"  placeholder="Email"   autocorrect="off" type="text"    autocapitalize="off">
            <input class="textfield" id="name" type="password" placeholder="Name"   autocorrect="off"    autocapitalize="on">
</div>            
            
            <div>
     <input type="button" value="Link to site" onClick="window.location.href='http://www.tester.com/MainPage.php?email=<?php echo $email?>'">
            </div>
        </form>

$email is not defined until the submit button is clicked and then it is passed to the action as post data.  I can't quite tell what you are doing, but depending on the receiving page, use method post or get.  Also, you didn't give your inputs a name:

<form action="http://www.tester.co...Page.php" method="get">
    <div id="entry_fields">        
        <input type="text" name="email">
        <input type="password" name="password">
    </div>            
    <div>
        <input type="submit" name="submit" value="Link to site">
    </div>
</form>

Now on the receiving page ("http://www.tester.co...Page.php) you use:

echo $_GET['email'];

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.