English 中文(简体)
h门链条用户名
原标题:Username from hpyerlink

I have got a while loop getting usernames from a SQL database. Thanks

最佳回答

You are doing it all wrong.
There is no use for the session here.
Only you heed is just a regular hyperlink which will pass the users ID to the next page. got the idea?

    echo "<tr></td><a href= viewallforms.php?id=$user_id >$name</a></td></tr> ;

之后,您的浏览器将有一个用户。 网址:$_GET[id]

问题回答

You can use a parameter to pass to other page using a view.php?name=value. you want a solution in your way.check it.

<?php
if ($result) 
  {
    echo "<table border="1" align="center">"; 
    echo "<th><center>User ID</center></th>";
    echo "<th><center>Name</center></th>";
    while ($row = mysql_fetch_array($result)) 
    {
        $name = $row[ first_name ] .     . $row[ last_name ];
                $user_id = $row[ user_id ];
        echo "<tr><td>";
        echo $user_id
        echo "</td><td>";
        echo  <form method="post" action="viewallforms.php">
    <input type="submit" value="  . $name .  "/>
    <input type="hidden" name="sumbit" value="true"/>
    <input type="hidden" name="userid" value="$user_id"/></form> ; 
        echo "</td></tr>";          
    }
  }
  echo "</table>";  

  if (isset($_POST[ submit ])) {
  }
  else {
    $_SESSION[ user ] = $_POST[ userid ];           
    echo $user_id;
    }

  ?>




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签