Minimeallolla Posted May 5, 2011 Share Posted May 5, 2011 This is just my software assignment. We have to create a functioning vending machine. How does it look so far? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Vending Machine Assignment</title> <link href="vending.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="vending_machine_base"> <img src="vending_machine_base.gif" alt="Vending Machine Base" title="Vending Machine Base" /> </div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p>Coke<input type="radio" name="item" value="Coke" /></p> <p>Sprite<input type="radio" name="item" value="Sprite" /></p> <p>Fanta<input type="radio" name="item" value="Fanta" /></p> <input type="text" size="15" name="quantity" value="Enter quantity here" /> $<input type="text" value="Enter your financial balance." name="credit_input" size="23" /> <input type="submit" value="Submit" /> </form> <?php error_reporting(E_ALL); // Cost of items $coke_price = "1.25"; $sprite_price = "1.50"; $fanta_price = "1.75"; // Quantity of items $coke_quantity = "7"; $sprite_quantity = "5"; $fanta_quantity = "3"; // Selected radio button into variable $selected_item = $_POST['item']; // Credit into variable $credit = $_POST['credit_input']; // If funds are less than price, dispay error message if (($_POST['submit']) && ($selected_radio = 'coke') && ($credit >= $coke_price)) { echo "You have purchased a $selected_item!"; } else { echo "You do not have sufficient funds to purchase a $selected_item."; } if (($_POST['submit']) && ($selected_radio = 'sprite') && ($credit >= $sprite_price)) { echo "You have purchased a $selected_item!"; } else { echo "You do not have sufficient funds to purchase a $selected_item."; } if (($_POST['submit']) && ($selected_radio = 'fanta') && ($credit >= $fanta_price)) { echo "You have purchased a $selected_item!"; } else { echo "You do not have sufficient funds to purchase a $selected_item."; } // Item quantity if (($_POST['submit']) && ($coke_quantity = 0)) { echo ""; } else { echo "Coke resources depleted."; } if (($_POST['submit']) && ($sprite_quantity = 0)) { echo ""; } else { echo "Sprite resources depleted."; } if (($_POST['submit']) && ($fanta_quantity = 0)) { echo ""; } else { echo "Fanta resources depleted."; } // Item cost subtracted from credit if (($coke_quantity >= 1) && ($credit >= $coke_price)) { $coke_price - $credit; } if (($sprite_quantity >= 1) && ($credit >= $sprite_price)) { $sprite_price - $credit; } if (($fanta_quantity >= 1) && ($credit >= $fanta_price)) { $fanta_price - $credit; } // Funds available echo "Your current funds accumlate to $credit "; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/ Share on other sites More sharing options...
fugix Posted May 5, 2011 Share Posted May 5, 2011 change <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> to <form action="#" method="post"> to minimize potential security risks, also with your long list of if statements.. i myself would turn them into elseif statements, just a personal preference though Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1211191 Share on other sites More sharing options...
smsmarketeers Posted May 6, 2011 Share Posted May 6, 2011 You really should test more thoroughly. These code pasted directly into a .php file shows the following errors: Notice: Undefined index: item in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 36 Notice: Undefined index: credit_input in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 39 Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 42 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 46 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 50 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 55 Coke resources depleted. Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 61 Sprite resources depleted. Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 67 Fanta resources depleted.Your current funds accumlate to The problem is that "submit" is not defined because "submit" is the submit button which is not defined until the form is submitted. I suggested checking to see if the form was submitted a different way, perhaps using $_SERVER variables. For example: <html> <head> <title>Vending Machine</title> <style type="text/css"> * { font-size:12px; font-family:Arial; margin:0px; outline:0px; padding:0px; } body { background:#ffffff; color:#000000; margin:10px 0px 0px 0px; } img { border:0px; } p { margin:5px 0px 10px 0px; } form { border:none; margin:0px; padding:0px; } a { cursor:pointer; } a:link { color:#9AB324; text-decoration:none; } a:visited { color:#9AB324; text-decoration:none; } a:hover { color:#9AB324; text-decoration:underline; } a:active { color:#9AB324; text-decoration:none; } .container { margin:0px auto; width:400px; } .success { background:#EEF5CD; border:1px dashed #9AB324; color:#608339; margin-bottom:5px; padding:5px; text-align:left; } .warning { background:#eed4d2; border:1px dashed #a94637; color:#ac241a; margin-bottom:5px; padding:5px; text-align:left; } .attention { background:#fefbcc; border:1px dashed #e6db55; color:#ada019; margin-bottom:5px; padding:5px; text-align:left; } h1 { color:#9AB324; font-size:16px; } form, fieldset { border:none; margin:0px; padding:0px; } input, textarea, select { font:100% arial, sans-serif; vertical-align:middle; } input[type='text'] { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } input[type='password'] { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } input[type='radio'] { margin:0px 5px 0px 5px; } input[type='hidden'] { display:none !important; } select { border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; min-width:100px; padding:1px; } select option { padding:0px 5px 0px 5px; } textarea { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } table.data th { background:#9AB324; border-bottom:1px solid #596E0E; color:#ffffff; font-weight:bold; padding:5px; text-align:center; } table.data td { padding:5px; } table.data td.rowOne { background:#f0f0f0; border-bottom:1px solid #dddddd; } table.data td.rowTwo { background:#f5f5f5; border-bottom:1px solid #dddddd; } table.data td.button { background:#ffffff; border:none; text-align:right; } </style> </head> <body> <div class="container"> <?php // Check if form was submitted if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Cost of items $price = array('coke' => '1.25', 'diet' => '1.50', 'sprite' => '1.75'); // Quantity Available $quantity = array('coke' => '5', 'diet' => '7', 'sprite' => '2'); // Selected Item Information $quantAvail = $quantity[strtolower($_POST['item'])]; $itemPrice = $price[strtolower($_POST['item'])]; // First check Quantity if ($quantAvail < $_POST['quantity']) { echo '<div class="warning">Insufficient quantity available.</div>'; } elseif ($quantAvail >= $_POST['quantity']) { echo '<div class="success">Sufficient quantity available. Checking funds...</div>'; } // If we passed quantity, check funds if (($_POST['quantity'] * $itemPrice) > $_POST['funds']) { echo '<div class="warning">Insufficient funds available.</div>'; } elseif (($_POST['quantity'] * $itemPrice) <= $_POST['funds']) { echo '<div class="success">Sufficient funds available.</div>'; } // Remaining Funds $remainingFunds = $_POST['funds'] - ($_POST['quantity'] * $itemPrice); echo '<div class="attention">You have <strong>$' . $remainingFunds . '</strong> funds remaining</div>'; } ?> <h1>Vending Machine</h1> <p>What would you like to purchase?</p> <form action="" method="post" name="vend"> <table align="center" border="0px" cellpadding="0px" cellspacing="1px" class="data" width="400px"> <tr> <th width="30px"> </th> <th style="text-align:left;">Item</th> <th width="70px">Price</th> </tr> <tr> <td align="center" class="rowOne"><input name="item" type="radio" value="Coke" /></td> <td class="rowOne">Coke</td> <td align="center" class="rowOne">$1.25</td> </tr> <tr> <td align="center" class="rowTwo"><input name="item" type="radio" value="Diet" /></td> <td class="rowTwo">Diet Coke</td> <td align="center" class="rowTwo">$1.50</td> </tr> <tr> <td align="center" class="rowTwo"><input name="item" type="radio" value="Sprite" /></td> <td class="rowTwo">Sprite</td> <td align="center" class="rowTwo">$1.75</td> </tr> <tr> <td align="center" class="rowOne" colspan="3"> Qty: <input type="text" size="2" name="quantity" value="1" /> Available Funds: $<input type="text" value="5.00" name="funds" size="5" /> </td> </tr> <tr><td class="button" colspan="3"><input name="submit" type="submit" value="Vend" /></td></tr> </table> </form> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1211208 Share on other sites More sharing options...
Minimeallolla Posted May 9, 2011 Author Share Posted May 9, 2011 You really should test more thoroughly. These code pasted directly into a .php file shows the following errors: Notice: Undefined index: item in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 36 Notice: Undefined index: credit_input in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 39 Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 42 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 46 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 50 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 55 Coke resources depleted. Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 61 Sprite resources depleted. Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 67 Fanta resources depleted.Your current funds accumlate to The problem is that "submit" is not defined because "submit" is the submit button which is not defined until the form is submitted. I suggested checking to see if the form was submitted a different way, perhaps using $_SERVER variables. For example: <html> <head> <title>Vending Machine</title> <style type="text/css"> * { font-size:12px; font-family:Arial; margin:0px; outline:0px; padding:0px; } body { background:#ffffff; color:#000000; margin:10px 0px 0px 0px; } img { border:0px; } p { margin:5px 0px 10px 0px; } form { border:none; margin:0px; padding:0px; } a { cursor:pointer; } a:link { color:#9AB324; text-decoration:none; } a:visited { color:#9AB324; text-decoration:none; } a:hover { color:#9AB324; text-decoration:underline; } a:active { color:#9AB324; text-decoration:none; } .container { margin:0px auto; width:400px; } .success { background:#EEF5CD; border:1px dashed #9AB324; color:#608339; margin-bottom:5px; padding:5px; text-align:left; } .warning { background:#eed4d2; border:1px dashed #a94637; color:#ac241a; margin-bottom:5px; padding:5px; text-align:left; } .attention { background:#fefbcc; border:1px dashed #e6db55; color:#ada019; margin-bottom:5px; padding:5px; text-align:left; } h1 { color:#9AB324; font-size:16px; } form, fieldset { border:none; margin:0px; padding:0px; } input, textarea, select { font:100% arial, sans-serif; vertical-align:middle; } input[type='text'] { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } input[type='password'] { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } input[type='radio'] { margin:0px 5px 0px 5px; } input[type='hidden'] { display:none !important; } select { border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; min-width:100px; padding:1px; } select option { padding:0px 5px 0px 5px; } textarea { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } table.data th { background:#9AB324; border-bottom:1px solid #596E0E; color:#ffffff; font-weight:bold; padding:5px; text-align:center; } table.data td { padding:5px; } table.data td.rowOne { background:#f0f0f0; border-bottom:1px solid #dddddd; } table.data td.rowTwo { background:#f5f5f5; border-bottom:1px solid #dddddd; } table.data td.button { background:#ffffff; border:none; text-align:right; } </style> </head> <body> <div class="container"> <?php // Check if form was submitted if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Cost of items $price = array('coke' => '1.25', 'diet' => '1.50', 'sprite' => '1.75'); // Quantity Available $quantity = array('coke' => '5', 'diet' => '7', 'sprite' => '2'); // Selected Item Information $quantAvail = $quantity[strtolower($_POST['item'])]; $itemPrice = $price[strtolower($_POST['item'])]; // First check Quantity if ($quantAvail < $_POST['quantity']) { echo '<div class="warning">Insufficient quantity available.</div>'; } elseif ($quantAvail >= $_POST['quantity']) { echo '<div class="success">Sufficient quantity available. Checking funds...</div>'; } // If we passed quantity, check funds if (($_POST['quantity'] * $itemPrice) > $_POST['funds']) { echo '<div class="warning">Insufficient funds available.</div>'; } elseif (($_POST['quantity'] * $itemPrice) <= $_POST['funds']) { echo '<div class="success">Sufficient funds available.</div>'; } // Remaining Funds $remainingFunds = $_POST['funds'] - ($_POST['quantity'] * $itemPrice); echo '<div class="attention">You have <strong>$' . $remainingFunds . '</strong> funds remaining</div>'; } ?> <h1>Vending Machine</h1> <p>What would you like to purchase?</p> <form action="" method="post" name="vend"> <table align="center" border="0px" cellpadding="0px" cellspacing="1px" class="data" width="400px"> <tr> <th width="30px"> </th> <th style="text-align:left;">Item</th> <th width="70px">Price</th> </tr> <tr> <td align="center" class="rowOne"><input name="item" type="radio" value="Coke" /></td> <td class="rowOne">Coke</td> <td align="center" class="rowOne">$1.25</td> </tr> <tr> <td align="center" class="rowTwo"><input name="item" type="radio" value="Diet" /></td> <td class="rowTwo">Diet Coke</td> <td align="center" class="rowTwo">$1.50</td> </tr> <tr> <td align="center" class="rowTwo"><input name="item" type="radio" value="Sprite" /></td> <td class="rowTwo">Sprite</td> <td align="center" class="rowTwo">$1.75</td> </tr> <tr> <td align="center" class="rowOne" colspan="3"> Qty: <input type="text" size="2" name="quantity" value="1" /> Available Funds: $<input type="text" value="5.00" name="funds" size="5" /> </td> </tr> <tr><td class="button" colspan="3"><input name="submit" type="submit" value="Vend" /></td></tr> </table> </form> </div> </body> </html> Wow that is pretty amazing code right there compared to mine. I'm obviously starting out but oneday I want to code as well as you can. A few of those errors were merely stupid mistakes. I'm using a school laptop that can't run php or test it, so I practically use notepad without testing. Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1212596 Share on other sites More sharing options...
fugix Posted May 9, 2011 Share Posted May 9, 2011 You really should test more thoroughly. These code pasted directly into a .php file shows the following errors: Notice: Undefined index: item in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 36 Notice: Undefined index: credit_input in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 39 Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 42 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 46 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 50 You do not have sufficient funds to purchase a . Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 55 Coke resources depleted. Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 61 Sprite resources depleted. Notice: Undefined index: submit in /var/www/private_html/projects.smsmarketeers.com/html/scripts/vending_machine.php on line 67 Fanta resources depleted.Your current funds accumlate to The problem is that "submit" is not defined because "submit" is the submit button which is not defined until the form is submitted. I suggested checking to see if the form was submitted a different way, perhaps using $_SERVER variables. For example: <html> <head> <title>Vending Machine</title> <style type="text/css"> * { font-size:12px; font-family:Arial; margin:0px; outline:0px; padding:0px; } body { background:#ffffff; color:#000000; margin:10px 0px 0px 0px; } img { border:0px; } p { margin:5px 0px 10px 0px; } form { border:none; margin:0px; padding:0px; } a { cursor:pointer; } a:link { color:#9AB324; text-decoration:none; } a:visited { color:#9AB324; text-decoration:none; } a:hover { color:#9AB324; text-decoration:underline; } a:active { color:#9AB324; text-decoration:none; } .container { margin:0px auto; width:400px; } .success { background:#EEF5CD; border:1px dashed #9AB324; color:#608339; margin-bottom:5px; padding:5px; text-align:left; } .warning { background:#eed4d2; border:1px dashed #a94637; color:#ac241a; margin-bottom:5px; padding:5px; text-align:left; } .attention { background:#fefbcc; border:1px dashed #e6db55; color:#ada019; margin-bottom:5px; padding:5px; text-align:left; } h1 { color:#9AB324; font-size:16px; } form, fieldset { border:none; margin:0px; padding:0px; } input, textarea, select { font:100% arial, sans-serif; vertical-align:middle; } input[type='text'] { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } input[type='password'] { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } input[type='radio'] { margin:0px 5px 0px 5px; } input[type='hidden'] { display:none !important; } select { border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; min-width:100px; padding:1px; } select option { padding:0px 5px 0px 5px; } textarea { background:#ffffff; border:1px solid #c3c3c3; border-left-color:#7c7c7c; border-top-color:#7c7c7c; padding:2px; } table.data th { background:#9AB324; border-bottom:1px solid #596E0E; color:#ffffff; font-weight:bold; padding:5px; text-align:center; } table.data td { padding:5px; } table.data td.rowOne { background:#f0f0f0; border-bottom:1px solid #dddddd; } table.data td.rowTwo { background:#f5f5f5; border-bottom:1px solid #dddddd; } table.data td.button { background:#ffffff; border:none; text-align:right; } </style> </head> <body> <div class="container"> <?php // Check if form was submitted if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Cost of items $price = array('coke' => '1.25', 'diet' => '1.50', 'sprite' => '1.75'); // Quantity Available $quantity = array('coke' => '5', 'diet' => '7', 'sprite' => '2'); // Selected Item Information $quantAvail = $quantity[strtolower($_POST['item'])]; $itemPrice = $price[strtolower($_POST['item'])]; // First check Quantity if ($quantAvail < $_POST['quantity']) { echo '<div class="warning">Insufficient quantity available.</div>'; } elseif ($quantAvail >= $_POST['quantity']) { echo '<div class="success">Sufficient quantity available. Checking funds...</div>'; } // If we passed quantity, check funds if (($_POST['quantity'] * $itemPrice) > $_POST['funds']) { echo '<div class="warning">Insufficient funds available.</div>'; } elseif (($_POST['quantity'] * $itemPrice) <= $_POST['funds']) { echo '<div class="success">Sufficient funds available.</div>'; } // Remaining Funds $remainingFunds = $_POST['funds'] - ($_POST['quantity'] * $itemPrice); echo '<div class="attention">You have <strong>$' . $remainingFunds . '</strong> funds remaining</div>'; } ?> <h1>Vending Machine</h1> <p>What would you like to purchase?</p> <form action="" method="post" name="vend"> <table align="center" border="0px" cellpadding="0px" cellspacing="1px" class="data" width="400px"> <tr> <th width="30px"> </th> <th style="text-align:left;">Item</th> <th width="70px">Price</th> </tr> <tr> <td align="center" class="rowOne"><input name="item" type="radio" value="Coke" /></td> <td class="rowOne">Coke</td> <td align="center" class="rowOne">$1.25</td> </tr> <tr> <td align="center" class="rowTwo"><input name="item" type="radio" value="Diet" /></td> <td class="rowTwo">Diet Coke</td> <td align="center" class="rowTwo">$1.50</td> </tr> <tr> <td align="center" class="rowTwo"><input name="item" type="radio" value="Sprite" /></td> <td class="rowTwo">Sprite</td> <td align="center" class="rowTwo">$1.75</td> </tr> <tr> <td align="center" class="rowOne" colspan="3"> Qty: <input type="text" size="2" name="quantity" value="1" /> Available Funds: $<input type="text" value="5.00" name="funds" size="5" /> </td> </tr> <tr><td class="button" colspan="3"><input name="submit" type="submit" value="Vend" /></td></tr> </table> </form> </div> </body> </html> Wow that is pretty amazing code right there compared to mine. I'm obviously starting out but oneday I want to code as well as you can. A few of those errors were merely stupid mistakes. I'm using a school laptop that can't run php or test it, so I practically use notepad without testing. stupid mistakes happen to all of us so dont worry, you will learn alot more as you progress...just stick with it! Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1212599 Share on other sites More sharing options...
smsmarketeers Posted May 9, 2011 Share Posted May 9, 2011 As fugix said, stupid mistakes happen to everyone, even me. Thank you for the props but I am by no means that best developer. I have a very specific way that I write code and format my code. Not only does it help others understand what I was thinking, but it also helps me when I have to go back to something that I wrote six months or six years ago. Generally, everything is tabbed out and I use an MVC framework. The framework I use was taken from an open source piece of software. I stripped it out, tweaked it, and rewrote some of it to fit my needs. Again, I am not the best but I learned by pulling other peoples code and small snippets apart, I suggest the same. But don't start with a bloated piece of software or something that is going to be difficult to understand. For instance, you were building a piece of forums software I would suggest downloading an open source piece of software, installing it, and then pulling it apart bit by bit. However, I wouldn't do it with phpBB3, but possibly phpBB2. OpenCart is another great piece of open source free software that uses an MVC framework and has been written VERY well. May I suggest one more thing. If you are using a school laptop, or no matter what you are using, get a month to month hosting account for a few dollars a month that gives you at least on MySQL database and supports PHP. Then, you can either upload code or download an IDE such as Notepad++ or EditPlus (I use EditPlus but it isn't free) and edit code directly through FTP. May I suggest: http://www.viewmyserver.com Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1212649 Share on other sites More sharing options...
Minimeallolla Posted May 11, 2011 Author Share Posted May 11, 2011 Ok thanks everyone. I'm getting free web hosting through the school which should be good. btw. I understad all of your code except this "[strtolower($_POST['item'])" I've never used or learnt 'strtolower'. Sorry to seem a pain but do you think you could give me a quick run down? Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1214115 Share on other sites More sharing options...
PHPete Posted May 11, 2011 Share Posted May 11, 2011 Ok thanks everyone. I'm getting free web hosting through the school which should be good. btw. I understad all of your code except this "[strtolower($_POST['item'])" I've never used or learnt 'strtolower'. Sorry to seem a pain but do you think you could give me a quick run down? strtolower is basically just "string to lower(case)". It just converts a string to all lower case. Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1214119 Share on other sites More sharing options...
smsmarketeers Posted May 11, 2011 Share Posted May 11, 2011 @Minimeallolla: strtolower() is a function that will lowercase all of the alpha characters in the string given. For instance: <?php $string = 'ABCDEFGHI'; echo strtolower($string); // Output: abcdefghi ?> Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1214121 Share on other sites More sharing options...
Minimeallolla Posted May 11, 2011 Author Share Posted May 11, 2011 Oh ok thanks. So it wouldn't affect the code's functionality if it were removed, or does it have to be there to run properly? I don't really see the point of using it, although I will. Quote Link to comment https://forums.phpfreaks.com/topic/235652-my-php-assesment-need-experienced-advicecritique/#findComment-1214125 Share on other sites More sharing options...
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.