Jump to content

Help me with this task please..

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
gpeer

gpeer

    Newbie

  • Members
  • Pip
  • 4 posts
Can someone do this for me, please..

----------------------------------------

Create a from such as the one below. POST the information over to a new php document which will test to see if the user guessed correctly. You'll use te php function rand() to generate a random number between 1 and 10. Then compare the random number with the users guess. (as in the example from class)

----------------------

HEre is code

<html>
<head>

<title>Pick a Number</title>
<style type="text/css">
<!--
.style1 {
color: #0000CC;
font-size: x-large;
}
-->
</style>
</head>

<body>
<div align="center"><span class="style1">I'm thinking of a number from 1 - 10 guess what it is.</span></div>
<center><form action="" method="post">
<select name= "guess" >Take a guess!</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
</select>


<p><input name="" type="submit"></p>
</form></center>
</body>
</html>

--------------------


Can someone do the rest of the task, please...

#2
so1i

so1i

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 312 posts
I think you should probably have a go at creating the PHP yourself first :)

Is this homework? It doesn't sound too difficult for you if it is exactly as you described. What part is it you are finding hard to start with?

You basically grab the value by using:

$var = $_POST['guess'];

so the value they have chosen is now in $var. You can then store the random number in a variable and compare them.

From there you let the user know if they guess right!

But if you want help in a specific part, you are going to have to be a bit more specific yourself. :) And at least have a go!

#3
gpeer

gpeer

    Newbie

  • Members
  • Pip
  • 4 posts
POST the information over to a new php document which will test to see if the user guessed correctly. You'll use te php function rand() to generate a random number between 1 and 10. Then compare the random number with the users guess.

This part is a problem :)

Can you do it for me, pleasee..

#4
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
this is pretty simple
we don't do it for you, but we help you do it.

don't you know anything of the thing above?
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#5
gpeer

gpeer

    Newbie

  • Members
  • Pip
  • 4 posts
This is for school. I just started with this class and I know very little about it..

#6
gpeer

gpeer

    Newbie

  • Members
  • Pip
  • 4 posts
anyone...


please

#7
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
if you show me a try of how this second page could look like in your eyes, I'll help you fill in stuff
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall