Jump to content

need help with a variable :)


sinista

Recommended Posts

Hi guys can somone help me with this please ,

 

the problem is a cant get my php variable ($link)  into the hidden input box's value, any help wold be great.

 

<?php
			  

$host="localhost";
$username="root";
$password="sarah2004"; 
$db_name="user";
$tbl_name="members";


mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$result = mysql_query("SELECT * FROM $tbl_name ");


while($row = mysql_fetch_array($result))
  {
echo "<br>";
echo $row['username'];
echo"<br>";
echo $row['avatar']; 
echo"<br>";
$link=$row['username'];
echo'<form name="form2" method="post" action="profiletemplate.php">
  <input name="searchname" type="hidden" id="searchname" Value="<?php echo $link; ?> ">
  <label>
  <input type="submit" name="Submit" value="MyProfile">
  </label>
</form>';
echo"<br>";
  }

mysql_close();

?>

 

thanks in advance.

 

:)

Link to comment
https://forums.phpfreaks.com/topic/102142-need-help-with-a-variable/
Share on other sites

<?php
			  

$host="localhost";
$username="root";
$password="sarah2004"; 
$db_name="user";
$tbl_name="members";


mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$result = mysql_query("SELECT * FROM $tbl_name ");


while($row = mysql_fetch_array($result))
  {
echo "<br>";
echo $row['username'];
echo"<br>";
echo $row['avatar']; 
echo"<br>";
$link=$row['username'];
echo"<form name='form2' method='post' action='profiletemplate.php'>
  <input name='searchname' type='hidden' id='searchname' Value='$link'>
  <label>
  <input type='submit' name='Submit' value='MyProfile'>
  </label>
</form>";
echo"<br>";
  }

mysql_close();

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.