populate a php query into a html table with <a href>
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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:
function get_profile($uname) { $query = "SELECT whatever FROM profile WHERE profile_name='$uname';"; ... return $profile; }
if isset($_GET['profile_name']) { echo get_profile($_GET['profile_name']); }
if you *must* do it with post vars, then I would say use javascript to populate then send a form. That's a little more complex of an example. I can post it here, but won't unless you ask for it.
the main problems that I have are:
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>
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>
Just to clarify what both rubadub and I are saying, POST is not the best way to accomplish what you're after. GET is a better choice & the way both of our examples work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.