Reputation: 330
I have a page in wordpress which shows all registered users in a table. When clicked on a user you'll be redirected to their user page. Here is a sample:
echo '<tr onclick="location.href=\'/user/'.$slug.'/\'">
<td>'.$result->firstname.' '.$result->lastname.'</td>
</tr>';
Where $slug is retreived from the database. I have a page with permalink
my_wordpress_site.com/user
. So if I click on a user I get redirected to a link
my_wordpress_site.com/user/example_user_slug
Which doesn't show anything because it's obviously a non existent sub page. I've tried something like $_GET in the permalink but wordpress doesn't allow that. How do I fix this?
Upvotes: 0
Views: 248
Reputation: 5937
HTML
<form action="#" method="get">
User name: <input type="text" name="user"><br>
<input type="submit" value="Submit">
</form>
PHP
if($_GET['user'])
echo $_GET['user']
if you want to build links you can use add_query_arg() in WP or if you want to deal with the params in a array $query = explode('&', $_SERVER['QUERY_STRING']);
Upvotes: 0