Jump to content

create Dica page using PHP


rehab

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.

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.