Jump to content

Getting POST from a URL?


mightywayne

Recommended Posts

Hello there. I have a user system where I'd like players to be able to view each others' profiles. So basically what I'm hoping for is something like...

 

The URL, is viewprofile.php?id=xxxxxx

 

Where xxxxxx is, would be that player's ID number. But what I'm wondering is how exactly if I generated that, the script would figure out what the ID was referring to. This'd also make searching for the ID easier cuz I have a cool way of doing that.

Link to comment
https://forums.phpfreaks.com/topic/44986-getting-post-from-a-url/
Share on other sites

O.o; It was that easy? Jeez.

 

Uhm thanks for the help, but I didn't expect you to write any sort of script for me. I just needed the answer. I'd actually forgotten GET even existed, I learned so long ago.

 

In the future, you should probably not be like, racist to newbies and stuff.

O.o; It was that easy? Jeez.

 

Uhm thanks for the help, but I didn't expect you to write any sort of script for me. I just needed the answer. I'd actually forgotten GET even existed, I learned so long ago.

 

In the future, you should probably not be like, racist to newbies and stuff.

 

Newbies are indeed a strange breed. I hear they make funny noises when they mate.

lol, funny discussion going on here anyways

<form action='#' method='post'>
<input type='text' name='id' value='133'>
<input type='submit' value='view'>
</form>
<?
$id = $_POST['id'];
//id now contains the value 133
?>

the method post like secretly sends the information and is alot safer compared to get

<form action='#' method='GET'>
<input type='text' name='id' value='133'>
<input type='submit' value='view'>
</form>
<?
//when you submit the form the url will change to ?id=133#
$id = $_GET['id'];
//id now contains the value 133
?>

the get method shows the information in the url which some isp's allow you to edit i think and it's not considerd too safe well that's what I was told in these same forums

 

or you can simply enter the url in the browser url thing

http://domain.com/page.php?id=133
<?
$id = $_GET['id'];
//id now contains the value 133
?>

hope that helped you out a bit

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.