Did you tried the code that I've edit from your post? I think you can do that by getting first the value of $user then make a link Like what I've posted at http://coding-talk.com/f14/form-help-8617/index2.html#post65596
form help
Started on the old forum in December 2010 · view the original in the archive · old links redirect here
if i am right, you need a code to check for a space after the username or else display a users are private message. this should work if that is what you need. try putting in a username without the space after and also try with the username after. it places the space after the username in the url. if this is not it, please clarify.
<html>
<head>
<title>View Friends</title>
</head>
<body>
<?php
if (!isset($_POST['action'])){
echo <<<FORM
<form action="" method="post">
<label for="username">Username:</label><br />
<input type="text" id="username" name="user" maxlength="50" placeholder="Enter your username" /><br />
<label for="pg">Page:</label><br />
<input type="text" id="pg" name="page" maxlength="200" value="1" size="2" /><br />
<input type="submit" name="action" value="View">
FORM;
}
else
{
if (!empty($_POST['user']) && !empty($_POST['page']))
{
$diff= strlen($_POST['user']) - strlen(rtrim($_POST['user']));// i separated this from the original code
//which was in the if statement
//so you can choose if the space left or right
//of the username by using either rtrim or ltrim
//and also choose the number of spaces required
if ($diff == 1)echo "
<a href=\"http://mig33.com/midlet/member/view_friends.php?username=$_POST[user]&pagenum=$_POST[page]\">
View $_POST[user]'s Friends.</a><br />
<a href=\"p.php\">Back</a>";
else echo "Friends are private";
}
else echo "Username or Page cannot be blank!";
}
?>
</body>
</html>
Perfection comes at a cost
I accept liberty!
i have created my code and its working now thanks forstymarvelous,kei_ki7 and something else
