开发者

generating a random no.in php [closed]

开发者 https://www.devze.com 2023-04-02 20:56 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 7 years ago.

Improve this question

I am working in an application which is a online examination application. Now at first the students has to login and they will get the questions. Now what i want is when the students login then a random no. must be generated between 1 to 50. And that will extract 50 questions for him. How to generate the random number between 1 to 50 when the login is successful.

This is my html code:

<body>
<h3>Login Form</h3>
<form id="form1" name="form1" method="post" action="login.php">
  Student Username: 
  <label>
  <input type="text" name="username" id="use开发者_开发问答rname" />
  </label>
  <p>Student Password: 
    <label>
    <input type="text" name="password" id="password" />
    </label>
  </p>
  <p>
    <label>
    <input type="submit" name="button" id="button" value="login" />
    </label>
  </p>
</form>
</body>

Now when the login is successful then a random no. between 1 to 50 must be generated.


if i understand you, you need to use rand [docs] or mt_rand [docs] functions like:

rand(1, 50);
0

精彩评论

暂无评论...
验证码 换一张
取 消