Hey everyone, I got bored one day and created this little jem. There are no issues with it, but it may help somone out later on down the road if they have a simple project that needs to be completed.      Everything is on one pages and includes elements like Array Functions, Randomization and CSS.

<!DOCTYPE html>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bored? Try This Random Generator</title>

<meta content="This is a random sentence generator, so if you get bored you can sit here and press the button multiple times." />
<link href="https://fonts.googleapis.com/css?family=Indie+Flower" rel="stylesheet"> 

.button {
           background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 16px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    -webkit-transition-duration: 0.4s; /* Safari */
    transition-duration: 0.4s;
    cursor: pointer;
    position: relative;
    display: inline-block;
    -moz-transform: scaleX(-1);
    -o-transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1);
    filter: FlipH;
    -ms-filter: "FlipH";

<body style= "background-color:<?php echo GenerateRandomColor() ?>;">
<!-- /////////////////////////////////// -->
function GenerateRandomColor()
    $color = '#';
    $colorHexLighter = array("9","A","B","C","D","E","F" );
    for($x=0; $x < 6; $x++):
        $color .= $colorHexLighter[array_rand($colorHexLighter, 1)]  ;
    return substr($color, 0, 7);
function GenerateRandomColor1()
    $color = '#';
    $colorHexLighter = array("9","A","B","C","D","E","F" );
    for($x=0; $x < 6; $x++):
        $color .= $colorHexLighter[array_rand($colorHexLighter, 1)]  ;
    return substr($color, 0, 7);
if(isset ($_POST['newQuote'])){
$quote = array(
"I wish I had",
"Why Can't I have",
"Can I have", 
"Did you have",
"Will you get",
"When will I get"
$rand_quote = array_rand($quote,1);
$items = array(
"A Better Job", 
"A Life", 
"Better Programming Skills", 
"Internet that was mine", 
"More Beer", 
"More Donuts", 
"My Daughter",
"A Dining Room Table",
"Better Couches",
"A PS4",
"A New Laptop",
"A New Phone",
"A Desktop Computer",
"A Fish Tank",
"My Socks",
"My Jacket", 
"More Coffee",
"More Koolaid",
"More Power",
"A Truck",
"More fish for Fish Tank",
"A Screwdriver",
"A Projector",
"More Pants"
    $rand_keys = array_rand($items,1);
    $stmt = $quote[$rand_quote] ." ". $items[$rand_keys];

} else {

    $stmt = 'Press Button to get started ';

<!-- /////////////////////////////////// -->
<!-- //////////Main Elements//////////// -->
<h1 align="center" style="font-family: 'Indie Flower', cursive;">Bored? Try This Random Generator.</h1>
<div style="width:400px; background-color:<?php echo GenerateRandomColor1() ?>; border:1px; text-align:center; margin:auto; border:3px ridge black; padding:10px; " >
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="randForm">
<b><span class="statement" style="font-family: 'Indie Flower', cursive; font-size:22px">

    echo ucwords($stmt); 

?></span></b><br /><br />
<hr />
<img class="img2" src="http://www.clker.com/cliparts/4/q/M/n/Z/v/1280pxl-blue-curved-arrow-hi.png" name="arrow" height="50" width="50"><input class="button" style="font-family: 'Indie Flower', cursive;" type="submit" value="Generate" name="newQuote" id="newQuote" /><img class="img" src="http://www.clker.com/cliparts/4/q/M/n/Z/v/1280pxl-blue-curved-arrow-hi.png" name="arrow" height="50" width="50">

<!-- //////////End Main Elements//////// -->

Recommended Answers

Where's the Java?

Jump to Post

All 4 Replies

Where's the Java?

Haha, that was a typo, there is no Java, its all PHP and CSS. I edited the content.

OK. I removed the Java tag as well.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.