Jump to content

User Specific Url


pranshu82202

Recommended Posts

i m using internet from my mobile phone which is not 3G

A real slow speed internet..

 

Ok just tell me

 

i made everyone.php

 

in which i created a from to insert some value and set action to everyoneinsert.php

 

now just tell me what shuld be the code of evryone.php and where shuld i put  $id = $_GET['id'];

 

And then how to get this id in my everyoneinsert.php

 

 

 

Right, I'll try my best to explain:

 

in your 'everyone.php' page, you want to put this:

$id = mysql_real_escape_string($_GET['id']);

 

What this does is grab the variable 'id' from the URL (example.com/everyone.php?id=#), and allows you to use it.

 

When you submit the form, make sure the form action is:

 

<form action="everyone.php?id=<?php echo $id; ?>" method="POST">

 

this way, when the form is submited, it will take you back to the same page as you were on.

 

Also make sure that you've give your "submit" input type a name:

<input type="submit" name="submit" value="Send" />

 

now you've done that, go into your PHP section (where you put the $id = mysql stuff) and hit return twice.

 

Now place this is and modify the query to how it suits your database:

 

<?php
if(isset($_POST['submit']))
{
   $getUsername = mysql_query("SELECT * FROM `users` WHERE `id`='$id'");
   $getUserInfo = mysql_fetch_assoc($getUsername);

   $user = $getUserInfo['username'];

   //insert the value from the form accordingly to the username where 'id' = 'id'

   $value = mysql_query("INSERT INTO `tbl_name` VALUES ('', '$user', '$_POST[value]')");

   echo 'You have successfully sent this to: '.$user;
}
?>

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.