Jump to content

Code to populate ID within URL on form submit?


1shotoffers

Recommended Posts

I am looking to populate existing URLs on a page with an "affiliate id" which would be entered by user on a form

 

In other words.....the user would enter their ID name or number in a form and upon submit it would change all base URLs on the page to URL including their id

 

http://www.thesite.com/?e=  changes to.........    http://www.thesite.com/?e=users_input

 

Can someone help me out with code to accomplish this?

 

Without seeing your current code, I'm not sure how you've written it, but with the form, just use a single $_POST at the top, such as:

 

$id=$_POST['ID'];

 

and then for all links, simply add the ID to them:

 

i.e.  "... this.php?id=".$id."";

 

and it will work :)

 

You could even do it all on one page.

 

For example:

 

<?php
if (isset($_POST['submit']))
{
$id=$_POST['id'];

INSERT REST OF PAGE HERE (including all links)

}
ELSE IF (!$_POST['id'])
{
INSERT FORM HERE - method: post, action: same page (php self)
<input type="text" name="id" size="10">
<input type='submit" name="submit" value="Go!">
}

 

That way, it will only show them the links once they've entered their affiliate ID and you don't need multiple pages to do it all on ... It will just start with the form and then it will go to the links once they submit the form...

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.