Problem: urlencode in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




hi all
i have a problem in PHP.
i am populating the list of user from database and on
click of the user name i want to open the details of
that user. i am also psssing some hidden value in the
page. for this  i am using the onclick function on a
href. and now i wanna to pass the user_id as
urlencode. as this id will changes user to user so how
will i pass this changing user id in java script. can
any one help me.  my code is as below:
***************** Java Script **********************

<Script language="javascript">
    function userdetails()
         {
         document.form1.action =
"performance1.php?usercode= <?php echo
urlencode($user_code_list); ?> "

        document.form1.submit()
      }
                                                      
                                                      
               
</script>

****************** PHP Code *************************

$db = mysql_connect("localhost", "username",
"password") or die ('Unable to connect to server.');

mysql_select_db("userdb",$db); 
$list1 = mysql_query("SELECT * FROM user order by name
", $db);


while ($row = mysql_fetch_array($list1)) {
                $name = $row['name'];
                $emp_code_list = $row['usercode'];
                $desig = $row['desig'];
                $email= $row['email'];
                $num_rows = mysql_num_rows($list1);
                $i++;


echo" Name: <a href= # onclick= userdetails() >".
$name. "</a> User code". $user_code_list. " Desig ".
$desig . "  email ". $email . "<br> ";

}

*********** Ends Code *********************

Can anyone please help me sort out this problem..


with thanks
Sunit 










PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux