Jump to content

[SOLVED] PHP url to field?


bobsmith20

Recommended Posts

Hi all,

 

I think this is a fairly simple question

 

I'm trying to make a referral based reward system for my PHP game.

 

The idea is that on the signup page there are fields for the coords of the player, for example 1:1:1

 

What I want to do is allow users to give people a referral URL (e.g /signup.php?refx=1&refy=1&refz=1)

 

This would fill in the fields with the values given in the URL.

 

I've got a feeling I've seen how to do it somewhere before, but now I need it I can't find it!

 

So any help would be appreciated

 

(All I need to know is how to put the values in the URL into the fields - I've sorted out the reward to the coords in the fields)

Link to comment
https://forums.phpfreaks.com/topic/163746-solved-php-url-to-field/
Share on other sites

You want to get the X Y and Z coordinates from the URL given for ref and put them into fields on the registration form?

 

Well if you mean by what I think you could try this

 

X Coords: <input type="text" name="x" value="<? $_GET['refx']; ?>" /> Y Coords: <input type="text" name="y" value="<? $_GET['refy']; ?>" /> Z Coords: <input type="text" name="z" value="<? $_GET['refz']; ?>" />

 

Idk if that'll fully work (little rusty) But it should do the job so long as they visit the signup url correctly.

Actually my bad it'll go like this (tested it out of curiosity)

 

X Coords: <input type="text" name="x" value="<? echo($_GET['refx']); ?>" /><br />

Y Coords: <input type="text" name="y" value="<? echo($_GET['refy']); ?>" /><br />

Z Coords: <input type="text" name="z" value="<? echo($_GET['refz']); ?>" />

 

If they visit the URL and it has refz, refy, refx filled in the URL it will print the values into the text fields :P

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.