Should we make a bank? Maybe like 50% goes to the person who does the work... and 50% goes to the bank?
Simple Calculator Code I just wrote. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Simple Calculator © Tommyfx.com</title> </head> <body> <div align="center"> <font face="Tahoma" size="2pt"> <form name="form1" action="calctest.php" method="post"> First Number: <input type="text" name="first" /> Add: <input type="radio" name="add" /> Subtract: <input type="radio" name="sub" /> Multiply: <input type="radio" name="mult" /> Divide: <input type="radio" name="div" /> Second Number: <input type="text" name="second" /> <input name="submit" type="submit" value="Submit" alt="Submit" /> </form> The solution is: <?php $add = $_POST[add]; $sub = $_POST[sub]; $mult = $_POST[mult]; $div = $_POST[div]; $first = $_POST[first]; $second = $_POST[second]; if ($_POST[add] == true) { $total = $first + $second; echo $total; } if ($_POST[sub] == true) { $total = $first - $second; echo $total; } if ($_POST[mult] == true) { $total = $first * $second; echo $total; } if ($_POST[div] == true) { $total = $first / $second; echo $total; } ?> </font> </div> </body> </html> Live preview: http://tommyfx.com/calctest.php
Why not make it simpilar, instead of using radio buttons, create 4 differnt submit buttons add subtract, ect... Or better yet, have the user type it in, but set an array for keys that can be used $keys = array('+','-','*','/'); if($_POST['mathbox2'] /= $keys){ die(); } else { echo $_POST['mathbox1'].$_POST['mathbox2'].$_POST['mathbox3']; } Simplified the php code down about 4 times the size of yoru original lol
That works too.. lol You have to remember I am new to PHP, so I tend to do things the hard way... but I never though about using an array...
Yeah I suppose we could create a shop. I'm just saying you guys shouldn't be too disappointed if we don't get that much business. Also, why would we set aside 50%? There aren't really many web design resources floating around GR to buy, and it would be kind of weird for us to be buying signatures and stuff. I think we should just split up the money. But for the pack, if we included: PHP scripts a couple coded templates a couple myspace DIV overlays and a page with credits and sites they can visit for more help I think that would be pretty good. If you guys want me to create a shop, let me know and I'll get that done. I'll listen to what you guys want. It's your crew as much as it is mine.
I agree. The owner of the script should get full credits. Hoping to get this damn guestbook done in the next day or so. I will be selling or atleast try to sell on here. lol
Yeah, that would be a group project. But I'm saying single projects like my Guestbook, I did myself, so I should get those credits...
Well, I'm stuck... I am running my install.php, and I can create 3 table then it poops out on me saying Mysql Query was Empty... Here is the table and info... $login = "CREATE TABLE `".$_POST['login']."` ( `id` int(11) NOT NULL auto_increment, `username` char(20) NOT NULL default '', `password` char(32) NOT NULL default '', `cookie` char(32) NOT NULL default '', `session` char(32) NOT NULL default '', `ip` char(15) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) TYPE=MyISAM"; mysql_query($login) or die(mysql_error()); Anyone know??
I know this was from a couple posts back, but I just want to clear something up, because it's bugging me. That code right there isn't a calculator, it will display "12/3", not "4". You are confusing strings with numbers. The period function implicitly casts variables into strings, then concatenates them. It does not perform a mathematical operation based on the character within a string. Tommy's original calculator is done correctly, as the + function makes everything it can into a number before addition, and the result will be as expected. More alarming though is that if you were to ever implement this modified calculator into anything more permanent, you would be opening a magnificent XSS (cross-site scripting) security loophole into your site. I think it's important that we, as the gamerenders web design group, don't go around spreading messy, non-functional code.