top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can i get the details of a user by just clicking on their name from drop down list?

0 votes
508 views
How can i get the details of a user by just clicking on their name from drop down list?
posted Jul 4, 2014 by Amritpal Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
What is the problem, please describe more so that it can be addressed. i.e. what is the context what you tried etc...

1 Answer

+1 vote

As per your problem,I think you are having a table with some records of user and you want to fetch out that particular user's record only after clicking on that particular user's id or user's name from drop-down list.
It can be done with the help of javascript only.

<?php
mysql_connect("localhost","root","");
mysql_select_db("dbtest");
if(isset($_REQUEST["eid"]))
{
    $id=$_REQUEST["eid"];
    $qry="select * from table_registration where id='$id'";
    $r=mysql_query($qry);
    $res=  mysql_fetch_row($r);
}
?>

<script>
    function getid(id)
    {
    window.location="javascript.php?eid="+id;
    }
</script>
<html>
    <form>
        <table>
            <tr>
                <td>
                    Name:
                </td>
                <td>
                    <select name="drpCountry" onchange="getid(this.value)">

                     <option value="0">SELECT HERE</option>   
                    <?php
                    $findqry="select * from registration";
                    $exe= mysql_query($findqry);
                    while($row=mysql_fetch_row($exe))
                    {
                        if(isset($_REQUEST["eid"])&& $_REQUEST["eid"]==$row[0])
                        {
                            echo"<option value=$row[0] selected>$row[1]</option>";
                        }
                        else
                        {
                         echo"<option value=$row[0]>$row[1]</option>";

                        }
                    }
                    ?>

                    </select>

                </td>

            </tr>
        </table>
        <table border="5">
            <tr>
                <td>
                    ID
                </td>
                <td>
                    Name
                </td>
                <td>
                  Address  
                </td>
                <td>
                    Salary
                </td>
            </tr>
            <?php 
            if(isset($res))
            {
            echo"<tr>";
            echo"<td>$res[0]</td>";
            echo"<td>$res[1]</td>";
            echo"<td>$res[2]</td>";
            echo"<td>$res[3]</td>";
            echo"</tr>";
            }
            ?>
            </table>
    </form>
</html>
answer Jul 8, 2014 by Rahul Mahajan
Similar Questions
+1 vote

I'm writing my first php extension and I need to list included files (in PHP script) from RINIT function, but I cannot figure out how.

I deep into PHP source code and I think it's related to EG(included_files), but I can't to access the list.

PHP_RINIT_FUNCTION(extname)
{
 // SAPI NAME AND PHP SCRIPT FILE HANDLE PATH
 char *pt_var_sapi_name = sapi_module.name;
 char *pt_var_file_handle_path = SG(request_info).path_translated;

 // HOW CAN I USE EG(included_files) to get included files list?

 return SUCCESS;
}
...