Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two PHP pages. the first page (records.php) has the 1000 values in a table. Each value has an Edit Button. I want to pass the concerned value to the other page (edit.php) when some user click on the Edit button.

How can I perform this action?

Note:( I need to pass the value through POST method), How can I do that?
Posted
Updated 6-Feb-12 3:44am
v2
Comments
Herman<T>.Instance 6-Feb-12 8:42am    
use session or something like that
Syed Salman Raza Zaidi 6-Feb-12 9:33am    
using Query string

Store concerned value in a variable, Make anchor like this

PHP
<a href="edit.php?id=".$variable>Edit;



and on edit.php you can get this value by this

PHP
$_GET["id"])) 


In case of Post method you'll have to make form like
PHP
<form method="post" action="?php echo $_SERVER["PHP_SELF"];"> and on same file in  you can get values like $_Post['nameoftextbox"]; :
 
Share this answer
 
v2
Comments
rashidfarooq 6-Feb-12 9:43am    
Sorry, I forgot to tell that, I need to pass the value through POST method not GET.
(I have updated my question also)
Syed Salman Raza Zaidi 6-Feb-12 9:53am    
then you'll have to make form like <form method="post" action="?php echo $_SERVER["PHP_SELF"];"> and on same file in <!--?php ??--> you can get values like $_Post['nameoftextbox"]; :)
Sergey Alexandrovich Kryukov 6-Feb-12 10:12am    
Right, but will you move this code to the answer using "Improve solution"? 5 in advance.
--SA
rashidfarooq 6-Feb-12 10:22am    
But, the page has 1000 textboxes, and the names of these text boxes will be generated dynamically. How can I give a static textbox name on the receiving page.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900