Connecting Tech Pros Worldwide Forums | Help | Site Map

Parameter passing to php. can anyone help me debugging the code

Member
 
Join Date: Sep 2009
Location: London
Posts: 36
#1: Oct 13 '09
Hi,

I want to pass the parameter of employee_id to a page. My code is working fine and passing parameter to page but the problem is rather then the current parameter. It passed the parameter which was selected in previous submit. Below is the code.

Expand|Select|Wrap|Line Numbers
  1. <form action='manager_employee_select.php?proc_employee_id=<?php echo $_POST['proc_employee_id']; ?>' method="POST">
  2. <table>
  3. <tr> My team members timesheet</tr>
  4.  
  5. <tr>Select a team member from the list to continue</tr>
  6. <tr>
  7.  
  8.         <?php
  9.            $conn = pg_connect("host=localhost port=5432 dbname=aim user=postgres password=holiday");
  10.          $result = "select employee_id,first_name || '' || last_name as name from employee where reporting_manager_id = '1113'";
  11.              $result =  pg_query($conn, $result) or die(pg_last_error());
  12.  
  13.  
  14.         ?>
  15.  
  16.         <?php echo "<td name = \"employees\"  >
  17.         <select name=\"proc_employee_id\" id=\"dropdown\" >"; ?>
  18.         <option value=""></option>5
  19.         <?php
  20.  
  21.           while($emps = pg_fetch_assoc($result))
  22.         {
  23.           $val = $emps["employee_id"];
  24.           $caption = $emps["name"]; ?>
  25.         <option value="<?php echo $val ?>"><?php echo $caption ?></option>
  26.         <?php }  ?></select>
  27.             </td>
  28. </tr>
  29. </table>
  30. <input name="submit" value="Continue" type="submit">
  31. </form>
  32.  
Many Thanks in advance

zorgi's Avatar
Member
 
Join Date: Mar 2008
Location: here
Posts: 107
#2: Oct 13 '09

re: Parameter passing to php. can anyone help me debugging the code


The only place I can see that you store anything from the previous page is this:

Expand|Select|Wrap|Line Numbers
  1. <form action='manager_employee_select.php?proc_employee_id=<?php echo $_POST['proc_employee_id']; ?>' method="POST">
  2.  
Every next submit in its url has
Expand|Select|Wrap|Line Numbers
  1. proc_employee_id=<?php echo $_POST['proc_employee_id'] 
  2.  
Reply


Similar PHP bytes