Jump to content

Recommended Posts

please can you help me in this question , imt confused about it

 

Create a dice page, that allow the user to enter an integer (from1 to 6) and the program must generate a random number (from1 to 6). if the random number equals the users’ entered number an image with smiley facemust be displayed if not another image with sad face must be displayed. Also,you have to display the integer user entered and the program generated integer in the page.

Link to comment
https://forums.phpfreaks.com/topic/292354-create-dica-page-using-php/
Share on other sites

All you need is a form with a text input field so the user can enter a number

 

You can generate a random number using the rand function.

 

When the form has been submitted you can receive the number the user entered from the $_POST superglobal variable (provided your forms submit method is set to post - Otherwise use $_GET)

 

To compare values you need to use an if statement with the == comparison operator

 

To display an image use a the <img> tag

 

Have ago yourself. If you get stuck then post what you have tried.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.