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

 

 

 

Link to comment
Share on other sites

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;
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.