Page 1 of 1

past the value ??

Posted: Wed Sep 08, 2004 2:08 am
by g3ckO
I have code sumthing like this:

Code: Select all

<?php
session_start(); 
include("database.php");


$user=addslashes($_SESSION[username]);

function extract_user() 
{ 
   $user=addslashes($_SESSION[username]); 
   $q="SELECT * FROM employee WHERE username ='$user'"; 
   $r=mysql_query($q); 
   $row_array=mysql_fetch_array($r); 
   return $row_array; 
}
   $row_array=extract_user(); 
   $ack_by=$row_array['EmpName'];


   $sql="SELECT * FROM leave WHERE Head = '$user' AND(Status= 'Pending Review' OR Status =  'Acknowledged')";
   $rs=mysql_query($sql) or die(mysql_error());

while ($row = mysql_fetch_array($rs))
{
   $nama = $row["Nama"];
   $refid=$row["RefID"];

   echo"<form action=leave_app_2.php?$approved method=POST>";

?>
	
<div align="left">
<table border="0" cellpadding="2" cellspacing="1" width="100%">
<tr>
<td align="left" valign="bottom" width="2%"
bgcolor="lightskyblue" valign="TOP" marginwidth="12" marginheight="12">
          
<?echo"<input type=checkbox name=approved[] value=$refid>";?>
</td>
<td align="left" valign="bottom" width="25%"
bgcolor="lightskyblue" valign="TOP" marginwidth="12" marginheight="12">
          
<?echo"$nama";?>
</td>

</table>
</div>
<?
}
?>
<br>
<div align="left">
<table width="100%">
<tr>
<td align="right" width="50%">                    
<input type="submit" value="APPROVED" name="app">            
</td>
<td align="left" width="50%">            
<input type="submit" value="NOT APPROVED" name="notapp">
</td></tr>
</table></div></form>
?>
In line 39, I want to change it to:

Code: Select all

<?php
<a href="detail.php"><?echo"$nama";?>
?>
How can I past the value of $nama to detail.php

Posted: Wed Sep 08, 2004 2:33 am
by jakobdoppler
There must not be a second <?php ?> tags within another.
Just use it like this.

Code: Select all

<?php 
echo "<a href="detail.php?value=$nama">Link</a>";
?>
So afterwards in detail.php you can call the value of $nama with $_GET['value'].

Posted: Wed Sep 08, 2004 2:36 am
by g3ckO
Ok. I will try that.
~TQ~