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>

Link to comment
Share on other sites

$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'];
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.