2

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>

<html>
<head>

<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"> 

<style>
.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;
    border-radius:10px;
    -webkit-transition-duration: 0.4s; /* Safari */
    transition-duration: 0.4s;
    cursor: pointer;
}
.img{
    position: relative;
    display: inline-block;
}
.img2{
    -moz-transform: scaleX(-1);
    -o-transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1);
    filter: FlipH;
    -ms-filter: "FlipH";
}
</style>
</head>

<body style= "background-color:<?php echo GenerateRandomColor() ?>;">
<!-- /////////////////////////////////// -->
<?php
function GenerateRandomColor()
{
    $color = '#';
    $colorHexLighter = array("9","A","B","C","D","E","F" );
    for($x=0; $x < 6; $x++):
        $color .= $colorHexLighter[array_rand($colorHexLighter, 1)]  ;
    endfor;
    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)]  ;
    endfor;
    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(
"Money", 
"Time", 
"Sex", 
"Coffee", 
"A Better Job", 
"A Life", 
"Better Programming Skills", 
"Internet that was mine", 
"More Beer", 
"More Donuts", 
"Candy", 
"My Daughter",
"Cable",
"A Dining Room Table",
"Better Couches",
"A PS4",
"A New Laptop",
"A New Phone",
"Water",
"Rum",
"Movies",
"A Desktop Computer",
"A Fish Tank",
"My Socks",
"My Jacket", 
"More Coffee",
"More Koolaid",
"More Power",
"A Truck",
"Toolbox",
"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">
<?php 

    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">
</form>

</div>
<!-- //////////End Main Elements//////// -->
</body>
</html>

Edited by patk570: typo

2
Contributors
4
Replies
33
Views
2 Months
Discussion Span
Last Post by patk570
0

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

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.