populate a php query into a html table with <a href>
Hi, I have several hours dealing with the next problem:
I want to populate a query into a html table, but the problem is that I want to put in the "name" field a url, for example: <a href="viewprofile.php>, So, the user may clic in a specific record and then the user can view the entire profile but I don't know how to controle the value for each record in the table, I'm looking something like it can help me to controle each value, something like <td value>and then send this value via the POST event. So, may you help me with this? Thanks a lot |
Code:
print "<table width='100%'>"; |
It's a little hard to figure out what you're asking. It seems like you want to have a page full of links, each link will essentially send form data to the server so that it can pull info from a database, is that right?
Does it have to be a POST variable? It would be much easier with GET variables. With get, you simply make a link that looks something like: Code:
<a href="some_page.php?profile_name=some_user_name>some_user_name profile</a> PHP Code:
|
Something like this:
Code:
<TABLE border='2'> 1. this line <td><a href='viewprofile.php'" . $xrsa['nombres']. ">" , is the one that gives me a headache, because I don't know how to catach the value of some rows, because the name could be: Saquile, Larry, Patrick, Michael, etc. 2. how viewprofile.php will catch this value? because the value will not be passed trough the POST event, because is via the <a href> Thanks a lot |
Code:
echo "<tr><td><a href='viewprofile.php?name='" . $xrsa['nombres']. "'>" .$xrsa['nombres'] . "</a></td><td>" . $xrsa['apellidos'] . "</td><td>" . $xrsa['nivacad'] . "</td><td>" . $xrsa['nit'] . "</td><td>" . $xrsa['nup']. "</td></tr>"; Code:
$name = $_GET['name']; |
Quote:
FYI, GET variables are sent through the URL, i.e. http://some_site.com?variable1=value1&variable2=value2 POST values are sent via the html header & require the page to submit the data through, for example, a form. The nice thing about GET is that you can construct the URL however you'd like through a href, i.e. Code:
echo "<a href='http://some_side.com/page.php?variable1=$val1&variable2=$val2'>link</a><br />\n"; POST become more difficult because you actually have to submit form data - you can't just put it in the URL. |
All times are GMT -5. The time now is 11:08 AM. |