Jump to content
MakeWebGames

[In Production] Brewery Mod


Recommended Posts

<?php

include_once "globals.php";

  print "
<h3>Your Home Brewery</h3>";

  echo "
<br>You are sitting in your shed.
</br>What would you like to brew?</br>";

  echo "
       <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'>Brewery Options</th>
</tr>
<tr>
<td>Beer</td>
<td> <a href='brewery.php?action=beer'>Brew</a> </td>
</tr>
<tr>
<td>Whiskey</td>
<td> <a href='brewery.php?action=whiskey'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Cider</td>
<td> <a href='brewery.php?action=cider'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Vodka</td>
<td> <a href='brewery.php?action=vodka'>Brew</a> </td>
</tr>
</table><hr width=85%>
  ";
  print "This module is a working progress.
  Should be up and running in a few weeks.";
?>

 

What does everyone think?

Link to comment
Share on other sites

  • Replies 68
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

you could tab the code a little so its easier to read for people also you have some extra </tr>

 

<?php

include_once "globals.php";

print "<h3>Your Home Brewery</h3
<p>You are sitting in your shed.</br>What would you like to brew?</p></br>
<table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
	<th colspan='3'>Brewery Options</th>
</tr>
<tr>
	<td>Beer</td>
	<td><a href='brewery.php?action=beer'>Brew</a></td>
</tr>
<tr>
	<td>Whiskey</td>
	<td><a href='brewery.php?action=whiskey'>Brew</a></td>
</tr>
<tr>
	<td>Cider</td>
	<td><a href='brewery.php?action=cider'>Brew</a></td>
</tr>
<tr>
	<td>Vodka</td>
	<td><a href='brewery.php?action=vodka'>Brew</a></td>
</tr>
</table><hr width=85%>";
print "This module is a working progress.Should be up and running in a few weeks.";
?>
Link to comment
Share on other sites

you could tab the code a little so its easier to read for people also you have some extra </tr>

 

<?php

include_once "globals.php";

print "<h3>Your Home Brewery</h3
<p>You are sitting in your shed.</br>What would you like to brew?</p></br>
<table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
	<th colspan='3'>Brewery Options</th>
</tr>
<tr>
	<td>Beer</td>
	<td><a href='brewery.php?action=beer'>Brew</a></td>
</tr>
<tr>
	<td>Whiskey</td>
	<td><a href='brewery.php?action=whiskey'>Brew</a></td>
</tr>
<tr>
	<td>Cider</td>
	<td><a href='brewery.php?action=cider'>Brew</a></td>
</tr>
<tr>
	<td>Vodka</td>
	<td><a href='brewery.php?action=vodka'>Brew</a></td>
</tr>
</table><hr width=85%>";
print "This module is a working progress.Should be up and running in a few weeks.";
?>

He said in a different topic that he uses a mobile editor , so I don't think he'll be able to tabulate his code

Link to comment
Share on other sites

He said in a different topic that he uses a mobile editor , so I don't think he'll be able to tabulate his code

That is true, but what do you guys think?

Getting all the tables and everything done is the easy part now time to start doing the sql side of things, and the actions.

Will take me a while I reckon

Link to comment
Share on other sites

You should focus on trying to create dynamic content and not static content something like this:

<?php

include_once "globals.php";

print "<h3>Your Home Brewery</h3
<p>You are sitting in your shed.</br>What would you like to brew?</p></br>
<table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
   <tr>
       <th colspan='3'>Brewery Options</th>
   </tr>";
   $results = $db->query("SELECT brewery_name, brewery_action FROM brewery");
   if!($db->num_rows($results)) {
        echo "<tr>
           "<td colspan='2' align='center'>There are no results</td>
       </tr>";
   }
   else {
       while($r = $db->fetch_row($results)) {
            echo "<tr>
                <td>".$r['brewery_name']."</td>
                <td><a href='brewery.php?action=".$r['brewery_action']."'>Brew</a></td>
            </tr>"
       }
   }
</table><hr width=85%>";
print "This module is a working progress.Should be up and running in a few weeks.";
?>

 

Now you can create a staff panel with stuff to credit people and make stuff on the fly

Link to comment
Share on other sites

you could tab the code a little so its easier to read for people also you have some extra </tr>

 

<?php

include_once "globals.php";

print "<h3>Your Home Brewery</h3
<p>You are sitting in your shed.</br>What would you like to brew?</p></br>
<table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
	<th colspan='3'>Brewery Options</th>
</tr>
<tr>
	<td>Beer</td>
	<td><a href='brewery.php?action=beer'>Brew</a></td>
</tr>
<tr>
	<td>Whiskey</td>
	<td><a href='brewery.php?action=whiskey'>Brew</a></td>
</tr>
<tr>
	<td>Cider</td>
	<td><a href='brewery.php?action=cider'>Brew</a></td>
</tr>
<tr>
	<td>Vodka</td>
	<td><a href='brewery.php?action=vodka'>Brew</a></td>
</tr>
</table><hr width=85%>";
print "This module is a working progress.Should be up and running in a few weeks.";
?>

True, just a quick question.

As you know I'm new to this coding stuff.

I just want to know how I can get it so when you click "Brew" it takes you to say (Brew Beer)(brewery.php?action=beer)

I think I might just use my coding style for now until I get a little better at it..

I'm just learning as I go..

I'm not exactly sure what I want to do with this mod, or what the brewed alcohol does.

Maybe give you a passive boost to energy or something? I don't know..

Link to comment
Share on other sites

True, just a quick question.

As you know I'm new to this coding stuff.

I just want to know how I can get it so when you click "Brew" it takes you to say (Brew Beer)(brewery.php?action=beer)

I think I might just use my coding style for now until I get a little better at it..

I'm just learning as I go..

I'm not exactly sure what I want to do with this mod, or what the brewed alcohol does.

Maybe give you a passive boost to energy or something? I don't know..

Do you know what requests are? If not there are a few types of requests but you will mostly be dealing with GET and POST. POST requests are mostly used in forms and GET requests are generally used in URLs. In your case your GET is action i.e. $_GET['action'] so you could do something like:

$action = isset($_GET['action']) ? $db->escape($_GET['action']) : null; //Yeah I know, escape() isnt the best so sue me. Its just a standard mres()
if($action) {
   echo "You are currently brewing ".ucfirst($action);
}

 

So if you clicked on the beer link it would say: "You are currently brewing Beer."

Link to comment
Share on other sites

Do you know what requests are? If not there are a few types of requests but you will mostly be dealing with GET and POST. POST requests are mostly used in forms and GET requests are generally used in URLs. In your case your GET is action i.e. $_GET['action'] so you could do something like:
$action = isset($_GET['action']) ? $db->escape($_GET['action']) : null; //Yeah I know, escape() isnt the best so sue me. Its just a standard mres()
if($action) {
   echo "You are currently brewing ".ucfirst($action);
}

 

So if you clicked on the beer link it would say: "You are currently brewing Beer."

Thanks, I will give it a go.

Or could you give me a little example or something please?

Link to comment
Share on other sites

I just did and you quoted it

Something like this.

But it's returning a blank page at the moment as I have no clue when it comes to cases and functions :/

<?php

include_once "globals.php";

}

$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : '';
switch($_GET['action'])

{
       case 'beer': brew_beer(); break;
       default: brewery(); break;
}

function brewery()
global $db,$ir,$c,$userid,$h;
{

  print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'><br> <br><br>
<table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table><br>

<h3>Your Home Brewery</h3>";

  echo "
You are sitting in your shed.
</br>What would you like to brew?</br>";

  echo "
       <br><table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'>Brewery Options</th>
</tr>
<tr>
<td>Beer</td>
<td> <a href='brewery.php?action=beer'>Brew</a> </td>
</tr>
<tr>
<td>Whiskey</td>
<td> <a href='brewery.php?action=whiskey'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Cider</td>
<td> <a href='brewery.php?action=cider'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Vodka</td>
<td> <a href='brewery.php?action=vodka'>Brew</a> </td>
</tr>
</table><hr width=85%></br>
  ";
  print "This module is a working progress.
  Should be up and running in a few weeks.";
?>
Link to comment
Share on other sites

Something like this.

But it's returning a blank page at the moment as I have no clue when it comes to cases and functions :/

<?php

include_once "globals.php";

}

$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : '';
switch($_GET['action'])

{
       case 'beer': brew_beer(); break;
       default: brewery(); break;
}

function brewery()
global $db,$ir,$c,$userid,$h;
{

  print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'><br> <br><br>
<table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table><br>

<h3>Your Home Brewery</h3>";

  echo "
You are sitting in your shed.
</br>What would you like to brew?</br>";

  echo "
       <br><table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'>Brewery Options</th>
</tr>
<tr>
<td>Beer</td>
<td> <a href='brewery.php?action=beer'>Brew</a> </td>
</tr>
<tr>
<td>Whiskey</td>
<td> <a href='brewery.php?action=whiskey'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Cider</td>
<td> <a href='brewery.php?action=cider'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Vodka</td>
<td> <a href='brewery.php?action=vodka'>Brew</a> </td>
</tr>
</table><hr width=85%></br>
  ";
  print "This module is a working progress.
  Should be up and running in a few weeks.";
?>

if you look on line 5 you have a extra curly brace that needs removing and then should work

Link to comment
Share on other sites

if you look on line 5 you have a extra curly brace that needs removing and then should work

Still not working.

Here is what I had have so far..

<?php

include_once "globals.php";



$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : '';
switch($_GET['action'])

       case 'beer': brew_beer(); break;
       default: brewery(); break;
}

function brewery() {
global $db,$ir,$c,$userid,$h;


  print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'><br> <br><br>
<table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table><br>

<h3>Your Home Brewery</h3>";

  echo "
You are sitting in your shed.
</br>What would you like to brew?</br>";

  echo "
       <br><table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'>Brewery Options</th>
</tr>
<tr>
<td>Beer</td>
<td> <a href='brewery.php?action=beer'>Brew</a> </td>
</tr>
<tr>
<td>Whiskey</td>
<td> <a href='brewery.php?action=whiskey'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Cider</td>
<td> <a href='brewery.php?action=cider'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Vodka</td>
<td> <a href='brewery.php?action=vodka'>Brew</a> </td>
</tr>
</table><hr width=85%></br>
  ";
  print "This module is a working progress.
  Should be up and running in a few weeks.";

}

function brew_beer() {
print "<h3>Beer Brewing</h3>";
?>
Edited by -BRAIDZ-
Link to comment
Share on other sites

you where also missing two closing curly braces check this updated one for you

<?php  
require_once("globals.php");



$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : '';
switch($_GET['action']){

       case 'beer': brew_beer(); break;
       default: brewery(); break;
}

function brewery() {
global $db,$ir,$c,$userid,$h;


  print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'> 
<table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table>

<h3>Your Home Brewery</h3>";

  echo "
You are sitting in your shed.
</br>What would you like to brew?</br>";

  echo "
       <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'>Brewery Options</th>
</tr>
<tr>
<td>Beer</td>
<td> <a href='brewery.php?action=beer'>Brew</a> </td>
</tr>
<tr>
<td>Whiskey</td>
<td> <a href='brewery.php?action=whiskey'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Cider</td>
<td> <a href='brewery.php?action=cider'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Vodka</td>
<td> <a href='brewery.php?action=vodka'>Brew</a> </td>
</tr>
</table><hr width=85%></br>
  ";
  print "This module is a working progress.
  Should be up and running in a few weeks.";

}

function brew_beer() {
print "<h3>Beer Brewing</h3>";
}
?>
Link to comment
Share on other sites

you where also missing two closing curly braces check this updated one for you
<?php  
require_once("globals.php");



$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : '';
switch($_GET['action']){

       case 'beer': brew_beer(); break;
       default: brewery(); break;
}

function brewery() {
global $db,$ir,$c,$userid,$h;


  print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'> 
<table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table>

<h3>Your Home Brewery</h3>";

  echo "
You are sitting in your shed.
</br>What would you like to brew?</br>";

  echo "
       <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'>Brewery Options</th>
</tr>
<tr>
<td>Beer</td>
<td> <a href='brewery.php?action=beer'>Brew</a> </td>
</tr>
<tr>
<td>Whiskey</td>
<td> <a href='brewery.php?action=whiskey'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Cider</td>
<td> <a href='brewery.php?action=cider'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Vodka</td>
<td> <a href='brewery.php?action=vodka'>Brew</a> </td>
</tr>
</table><hr width=85%></br>
  ";
  print "This module is a working progress.
  Should be up and running in a few weeks.";

}

function brew_beer() {
print "<h3>Beer Brewing</h3>";
}
?>

Thanks, working now, where was I missing the closing brackets?

Link to comment
Share on other sites

sorry i got it wrong you where missing a opening one after you switch clause and on after your function before the ?>

Thanks, what I have now

<?php  
require_once("globals.php");



$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : '';
switch($_GET['action']){

       case 'beer': brew_beer(); break;
       case 'whiskey': brew_whiskey(); break;
       default: brewery(); break;
}

function brewery() {
global $db,$ir,$c,$userid,$h;


  print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'> 
<table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table>

<h3>Your Brewery</h3>";

  echo "
You are sitting in your shed.
</br>What would you like to brew?</br>";

  echo "
       <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'>Brewery Options</th>
</tr>
<tr>
<td>Beer</td>
<td> <a href='brewery.php?action=beer'>Brew</a> </td>
</tr>
<tr>
<td>Whiskey</td>
<td> <a href='brewery.php?action=whiskey'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Cider</td>
<td> <a href='brewery.php?action=cider'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Vodka</td>
<td> <a href='brewery.php?action=vodka'>Brew</a> </td>
</tr>
</table>
  ";
  print "This module is a working progress.
  Should be up and running in a few weeks.";

}

function brew_beer() {
print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'>
<h3>Beer</h3>";


  echo "
       <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'> Beer Information</th>
</tr>
<tr>
<td>Time to brew Beer?</td>
<td>25 Minutes</td>
</tr>
<tr>
<td>Brave Needed to brew Beer?</td>
<td>5 Brave</td>
</tr>
<td>What does beer do?</td>
<td>Gives you an energy boost</td>
</tr>
</table>
<input type='submit' name='brewbeer' value='Brew Beer' />
  ";

}

function brew_whiskey() {
print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'>
<h3>Whiskey</h3>";

}
?>
Link to comment
Share on other sites

Could someone help me set the queries in the last function?

I only want 'brew' in the 'users' table..

Also, a die message when you have gone over 10 brews a day..

And it will be an item added to the user (set at rand)

<?php  
require_once("globals.php");


$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : '';
switch($_GET['action']){

       case 'beer': brew_beer(); break;
       case 'brewbeer': brew_beer_sub(); break;
       case 'whiskey': brew_whiskey(); break;
       default: brewery(); break;
}

function brewery() {
global $db,$ir,$c,$userid,$h;


  print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'> 
<table class='tablee'><tr><td><center><img src='/images/brewery.jpg' /></td></tr></table>

<h3>Your Brewery</h3>";

  echo "
You are sitting in your shed.
</br>What would you like to brew?</br>";

  echo "
       <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'>Brewery Options</th>
</tr>
<tr>
<td>Beer</td>
<td> <a href='brewery.php?action=beer'>Brew</a> </td>
</tr>
<tr>
<td>Whiskey</td>
<td> <a href='brewery.php?action=whiskey'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Cider</td>
<td> <a href='brewery.php?action=cider'>Brew</a> </td>
</tr>
</tr>
<tr>
<td>Vodka</td>
<td> <a href='brewery.php?action=vodka'>Brew</a> </td>
</tr>
</table>
  ";
  print "This module is a working progress.
  Should be up and running in a few weeks.";

}

function brew_beer() {
print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'>
<h3>Beer</h3>";


  echo "
       <table width='55%' border='0' cellspacing='1' cellpadding='3' class='table' style='text-align:center;'>
<tr>
<th colspan='3'> Beer Information</th>
</tr>
<tr>
<td>Time to brew Beer?</td>
<td>25 Minutes</td>
</tr>
<tr>
<td>Brave needed to brew Beer?</td>
<td>5 Brave</td>
</tr>
<td>What does beer do?</td>
<td>Gives you an energy boost</td>
</tr>
</table>
<form method='post' action='brewery.php?action=brewbeer'>
<input type='submit' name='brewbeer' value='Brew Beer' />
</form>
  ";

}

function brew_whiskey() {
print "<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'>Brewery</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'>
<h3>Whiskey</h3>";

}

function brew_beer_sub() {
print "You brewed (number of bottles) Bottles of Beer";

}
?>
Link to comment
Share on other sites

True, just a quick question.

As you know I'm new to this coding stuff.

I just want to know how I can get it so when you click "Brew" it takes you to say (Brew Beer)(brewery.php?action=beer)

I think I might just use my coding style for now until I get a little better at it..

I'm just learning as I go..

I'm not exactly sure what I want to do with this mod, or what the brewed alcohol does.

Maybe give you a passive boost to energy or something? I don't know..

Hey, like kyle said :) Posts are usually used in forms for example you know when you login in? it sends a post request which checks your credentials if there right or wrong.

What your asking for or in this case needing is something called a GET request (

 $_GET['action'] 

) note*Where it says action is can be anything like

$_GET['type']

 

What it basically does is GET your request and it shows it in a url form for example say i typed my username and password in a form and used a get request(Strongly not advised im just using this as an example) and the file name was authorise.php the output after i submit my detail would be

authorise.php?action=login&username=jcvenom&password=123

As you can see the login details appear, right so what we need for your mod is

switch();

function

switch($_GET['action']){
case 'beer': beer(); break;
case 'whiskey': whiskey(); break;
case 'cider': cider(); break;
case 'vodka': vodka(); break;
default: exit("Requires and action"); break;
function cider(){
//Code right here

}

}

Its alot to take in but it takes time to learn, i suggest looking at http://www.codecademy.com/ to learn the basics of PHP which is the next step in completing this mod, codecademy teachs the basics of PHP and it also runs over the

 switch(); 

function and the GET & POST requests, i hope this helped in some way

Edited by jcvenom
Link to comment
Share on other sites

Hey, like kyle said :) Posts are usually used in forms for example you know when you login in? it sends a post request which checks your credentials if there right or wrong.

What your asking for or in this case needing is something called a GET request (

 $_GET['action'] 

) note*Where it says action is can be anything like

$_GET['type']

 

What it basically does is GET your request and it shows it in a url form for example say i typed my username and password in a form and used a get request(Strongly not advised im just using this as an example) and the file name was authorise.php the output after i submit my detail would be

authorise.php?action=login&username=jcvenom&password=123

As you can see the login details appear, right so what we need for your mod is

switch();

function

switch($_GET['action']){
case 'beer': beer(); break;
case 'whiskey': whiskey(); break;
case 'cider': cider(); break;
case 'vodka': vodka(); break;
default: exit("Requires and action"); break;
function cider(){
//Code right here

}

}

Its alot to take in but it takes time to learn, i suggest looking at http://www.codecademy.com/ to learn the basics of PHP which is the next step in completing this mod, codecademy teachs the basics of PHP and it also runs over the

 switch(); 

function and the GET & POST requests, i hope this helped in some way

Thank you, but I got it working now mate :)

[MENTION=67703]adamhull[/MENTION] helped me

Link to comment
Share on other sites

He said in a different topic that he uses a mobile editor , so I don't think he'll be able to tabulate his code

[MENTION=68406]-BRAIDZ-[/MENTION] You will find programming much more practical if you didn't use a mobile editor. Why would you even attempt to program on your phone?! Like wuttttttt.....

Link to comment
Share on other sites

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.   Paste as plain text instead

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