pranshu82202 Posted July 10, 2011 Author Share Posted July 10, 2011 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 Quote Link to comment Share on other sites More sharing options...
Andy11548 Posted July 10, 2011 Share Posted July 10, 2011 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; } ?> Quote Link to comment Share on other sites More sharing options...
pranshu82202 Posted July 10, 2011 Author Share Posted July 10, 2011 Sir its all done ... And thats all because of you.... Thanx a lot Quote Link to comment Share on other sites More sharing options...
Andy11548 Posted July 10, 2011 Share Posted July 10, 2011 No problem dude. If you need any more help, feel free to contact me . Good luck in future coding, Andy. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.