Jump to content

Url that will fill out peice of a form?


ffxpwns

Recommended Posts

I want to have a URL that each person would have on their profile, to refer new users.  What I'm thinking is the URL would be www.website.com/register.php?id=(users ID) Lets pretend that it's www.website.com/register.php?id=23 and the user with the ID 23's name is just 'testuser'.  Then, when they open that page, it would be normal, but the 'referrer' field would have 'testuser' in it.  Any ideas?  I don't even know what to search because I don't know what to name that.

Link to comment
https://forums.phpfreaks.com/topic/262950-url-that-will-fill-out-peice-of-a-form/
Share on other sites

Ok...do that.  On the PHP page that prints the registration form, if $_GET['id'] is set, pre-fill the referral information.

 

Seriously?  So I don't need to do anything special with the URL or the page?  just where the referral field is, I put somehting like $_GET['id'] and then I'd associate the ID with the username, and it'd fill out the feild?

No, it's not magic.  I'm assuming you have a PHP page which draws the registration form in some way.

 

On that page, if $_GET['id'] is set, perform the necessary database queries to fetch the referral information.

 

When you print the referral bits of the form, check to see if you have data to put into those fields.

 

If you do, pre-fill the form fields with the data you fetched from the database.

 

 

No, it's not magic.  I'm assuming you have a PHP page which draws the registration form in some way.

 

On that page, if $_GET['id'] is set, perform the necessary database queries to fetch the referral information.

 

When you print the referral bits of the form, check to see if you have data to put into those fields.

 

If you do, pre-fill the form fields with the data you fetched from the database.

 

I meant that i didn't have to do anything radical with the page.  I just ended up putting

'V_REFER' => (isset($_POST["TPL_refer"])) ? $_POST["TPL_refer"] : $_GET ['referrer'],

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.