here i fetched all information of my users with a loop. as you see my table is like this:
and my code is this:
<?php
$id=$fgmembersite->UserID();
/* echo "$id"; */
$db_host = 'localhost';
$db_name= 'site';
$db_table= 'tablesite';
$db_user = 'root';
$db_pass = '';
$con = mysql_connect($db_host,$db_user,$db_pass) or die("خطا در اتصال به پايگاه داده");
$selected=mysql_select_db($db_name, $con) or die("خطا در انتخاب پايگاه داده");
mysql_query("SET CHARACTER SET utf8");
$dbresult=mysql_query("SELECT tablesite.name,
tablesite.family,
tablesite.username,
tablesite.phone_number,
tablesite.email
FROM $db_table",$con);
$i = 1;
while($amch=mysql_fetch_assoc($dbresult))
{?>
<?php
echo "<form name=f1 id='form_$i' method='post' action='{$_SERVER['PHP_SELF']}' accept-charset='UTF-8'>\r\n";
echo'<div dir="rtl">';
echo "نام خدمت دهنده: "."   ".$amch["name"]." ".$amch["family"]."   "."شماره تماس: ".$amch["phone_number"]."   "."ایمیل: ".$amch["email"].'<br>';
echo '<input type="submit" name="submit" value="انتخاب مشتری"/>';echo'<hr/>';
echo'<hr/>';
echo'</div>';
echo "</form>\r\n";
$i++;
}
?>
<?php
if(isset($_POST['submit']))
{
}
?>
for each user, there is a button for choosing hem/her (for send him/her information to another page)
this is a part of printing user's information with button for each one of them.
i just do not know how to choose that buddy and send selected information to another page. thanks
You can add a hidden input with the value of that buddy. For example (I only added the email field, but you can extend this however you need):
echo "<form name=f1 id='form_$i' method='post' action='{$_SERVER['PHP_SELF']}' accept-charset='UTF-8'>\r\n";
echo'<div dir="rtl">';
echo "نام خدمت دهنده: "."   ".$amch["name"]." ".$amch["family"]."   "."شماره تماس: ".$amch["phone_number"]."   "."ایمیل: ".$amch["email"].'<br>';
echo '<input type="submit" name="submit" value="انتخاب مشتری"/>';echo'<hr/>';
echo'<hr/>';
echo'</div>';
echo '<input type="hidden" name="email" value="' . $amch["email"] . '">'; // SEND THE EMAIL ADDRESS IN THE "email" FIELD
echo "</form>\r\n";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With