For my project I have a "add" button, upon clicking it, it will take the user to next page where there will be a text box and list of data displayed below it which is fetched from mysql database. I have written the code for this which is working fine. But I have a problem, i.e. when user enters the code in text box and clicks "go" button a group of data will be fetched from the database and should be displayed below the text box, where previously the mysql group of data was displayed i.e. the new group of data fetched from mysql database should replace the old group of data. I hope you got my point.
For eg, when the user clicks add link in pageone.php page he will send the nameid=2, and mysql data for this nameid will be fetched from mysql and displayed below the textbox in pageload.php page. But in pageload.php page the user will be having option to enter his own nameid and search results for that. So when he clicks the go button, mysql data for this nameid should be fetched and displayed in the place of previous data. There should not be 2 set of data displayed. How can I do this
How will I do this, please give me some idea
Here is the code I have written
pgaeone.php
Expand|Select|Wrap|Line Numbers
- <html>
- <body>
- <a href="pageload.php?nameid=2">ADD</a>
- </body>
- </html>
pageload.php
Expand|Select|Wrap|Line Numbers
- <html>
- <body>
- <form name="load" action="" method="POST">
- please enter code
- <input type="text" name="sel">
- <input type="submit" value="go" name="sub">
- </form>
- <?php
- $id = $_GET['nameid'];
- $sql = "SELECT name FROM TEBLE1 WHERE nameid='$id'";
- $result = mysql_query($sql);
- while ($values = mysql_fetch_array($result))
- {
- echo $values['0'];
- echo "<br>";
- }
- ?>
- </body>
- </html>
With regards