Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-17-2010, 09:27 AM   #1
New Member
 
Join Date: Feb 2010
Posts: 3
Default php how to pass value

I have created admin page where admin see all the users username and i have made the username list as link to process the details of the user but when i click it should pass the username to the processing page. the code -

members list- members_detail.php
<?php
if(!mysql_connect("localhost","root","admin"))
{
echo "<h2>".$TEXT['product-error to connect']."</h2>";
die();
}
echo "<h5>Users:-</h5><br>";
$link = mysql_connect("localhost", "root", "admin");
mysql_select_db("jc214330", $link);
$i=0;
$sql = mysql_query("SELECT * FROM users");
while($members = mysql_fetch_array($sql))
{
echo "<p><a href=\"members_process.php\">".$members[username] ."</a></p>";
echo "<p>Name - ".$members[first_name] ." ".$members[last_name] ."<br><br><br></p>";
}

?>


members process to get full details, edit and delete users - members_process.php

<?php
$username[i] = $_REQUEST['$username[i]'];
if(!mysql_connect("localhost","root","admin"))
{
echo "<h2>".$TEXT['product-error to connect']."</h2>";
die();
}
echo "<h5>Users:-</h5><br>";
$link = mysql_connect("localhost", "root", "admin");
mysql_select_db("jc214330", $link);
$sql = mysql_query("SELECT * FROM users where username = 'username[i]'");
while($membersdtl = mysql_fetch_array($sql))
{
echo "<p>Name - ".$membersdtl[first_name] ." ".$membersdtl[last_name] ."<br><br><br></p>";
}
?>


how do i pass $username[i] from members_detail.php to members_process.php
abhi4u is offline   Reply With Quote


Old 02-23-2010, 02:34 PM   #2
New Member
 
Join Date: Feb 2010
Posts: 2
Default php how to pass value

hiiiii
In PHP u can pass value in two ways or we can say 2 methods POST and GET

1)POST method is simply declare post method in form tag <form method="post">
<input value=""> through this u can pass
2) by passing query string

ex->

<a href="pagename.php?userid=".<?=$usernameid?>><?=$u sername?></a>

through u can pass the id

i hope this 2 method help u

thanks
paragkale is offline   Reply With Quote
Old 02-26-2010, 12:57 PM   #3
New Member
 
Join Date: Apr 2009
Location: Romania
Posts: 18
Default

one link should be
echo "members_process.php?username=$members[username]";

and in members_process.php tou should get the username like this

$username=$_GET['username'];
__________________
Code Generators
bozy12v is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:07 AM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.