-BRAIDZ- Posted June 7, 2015 Posted June 7, 2015 <?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? Quote
NonStopCoding Posted June 7, 2015 Posted June 7, 2015 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."; ?> Quote
Coly010 Posted June 7, 2015 Posted June 7, 2015 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 Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 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 Quote
KyleMassacre Posted June 7, 2015 Posted June 7, 2015 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 Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 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.. Quote
KyleMassacre Posted June 7, 2015 Posted June 7, 2015 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." Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 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? Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 I just did and you quoted it Yes, but where do I put it? That's what I meant by an example. And do I have to have a default case or function or Anything? Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 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."; ?> Quote
KyleMassacre Posted June 7, 2015 Posted June 7, 2015 Its probably due to an undefined function brew_beer() the function doesnt exist so try removing that case Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 Its probably due to an undefined function brew_beer() the function doesnt exist so try removing that case Still nothing. Quote
AdamHull Posted June 7, 2015 Posted June 7, 2015 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 Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 (edited) 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 June 7, 2015 by -BRAIDZ- Quote
AdamHull Posted June 7, 2015 Posted June 7, 2015 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>"; } ?> Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 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? Quote
AdamHull Posted June 7, 2015 Posted June 7, 2015 sorry i got it wrong you where missing a opening one after you switch clause and on after your function before the ?> Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 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>"; } ?> Quote
-BRAIDZ- Posted June 7, 2015 Author Posted June 7, 2015 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"; } ?> Quote
jcvenom Posted June 7, 2015 Posted June 7, 2015 (edited) 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 June 7, 2015 by jcvenom Quote
-BRAIDZ- Posted June 8, 2015 Author Posted June 8, 2015 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 Quote
NonStopCoding Posted June 8, 2015 Posted June 8, 2015 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 so he does never mind then :D but if you do it on pc remember to tab ;) Quote
-BRAIDZ- Posted June 8, 2015 Author Posted June 8, 2015 so he does never mind then :D but if you do it on pc remember to tab ;) I will mate thanks Quote
sniko Posted June 8, 2015 Posted June 8, 2015 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..... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.