Okay, isset() will return a bool (true or false) which won't be < 13. So your logic is jumbled.
You need to check if it's set with isset outside of what the value is.
The second thing wrong is your scope. Functions have their own scope. So even though your main script has the variables $atk1, $atk2, ..., $atk6, the function attack will not have access to them; unless you use the global keyword.
All of your functions need to add a global line. Something like:
function function_name() {
global $var1, $var2, $var3, $var4, $var5, $var6;
// The rest of your function code...
}
THat way the function can use those values.
Now, I'd suggest that you drop all those variables for a single array. So (using $atk as my variables) you'd get an array like this:
$attack[0] == $atk;
$attack[1] == $atk1;
$attack[2] == $atk2;
...
$attack[6] == $atk6;
So then you're including one variable in your function (or better yet passing it as an argument).
I've gone ahead and modified your script to take out the three identical functions, and shaved it to one. I've also added the ability for the sum function to take either an array of numbers, or an unlimited number of arguments and add them together.
<?php
$atk = $def = $stam = $acc = $nan = array();
//name statement
if(isset($_GET['char'])) {
print $_GET['char'].'<br>';
} else {
print 'You didn\'t pick a name dude!<br>';
}
//age statement
if(isset($_GET['age']) < 13) {
$atk[0] = -1;
$def[0] = -1;
$stam[0] = -1;
$acc[0] = -1;
$nan[0] = "ok";
print "{$_GET['age']}<br>";
} elseif($_GET['age'] >= 13 and $_GET['age'] <= 29) {
$atk[0] = 2;
$def[0] = 2;
$stam[0] = 2;
$acc[0] = 2;
$nan[0] = "ok";
print "{$_GET['age']}<br>";
} elseif($_GET['age'] >= 30 and $_GET['age'] <= 55) {
$atk[0] = 0;
$def[0] = 0;
$stam[0] = 0;
$acc[0] = 0;
$nan[0] = "ok";
print "{$_GET['age']}<br>";
} elseif($_GET['age'] >= 56) {
$atk[0] = -2;
$def[0] = -2;
$stam[0] = -2;
$acc[0] = -2;
$nan[0] = "ok";
print "{$_GET['age']}<br>";
} else {
print "you didn't put a age<br>";
}
//below is the class statement
if(isset($_GET['elf'])){
$atk[1] = 2;
$def[1] = 5;
$stam[1] = 2;
$acc[1] = 5;
$nan[1] = "ok";
} elseif(isset($_GET['war'])){
$atk[1] = 5;
$def[1] = 3;
$stam[1] = 4;
$acc[1] = 4;
$nan[1] = "ok";
} elseif(isset($_GET['mon'])){
$atk[1] = 4;
$def[1] = 4;
$stam[1] = 3;
$acc[1] = 3;
$nan[1] = "ok";
} elseif(isset($_GET['fre'])){
$atk[1] = 3;
$def[1] = 2;
$stam[1] = 5;
$acc[1] = 1;
$nan[1] = "ok";
} elseif(isset($_GET['poo'])){
$atk[1] = 1;
$def[1] = 1;
$stam[1] = 5;
$acc[1] = 2;
$nan[1] = "ok";
} else {
print "you didn't pick a class<br>";
}
//Below is the apperance statement
if(isset($_GET['pre'])){
$atk[2] = 2;
$def[2] = 3;
$stam[2] = 2;
$acc[2] = 4;
$nan[2] = "ok";
} elseif(isset($_GET['scr'])){
$atk[2] = 3;
$def[2] = 1;
$stam[2] = 4;
$acc[2] = 3;
$nan[2] = "ok";
} elseif(isset($_GET['gan'])){
$atk[2] = 4;
$def[2] = 2;
$stam[2] = 1;
$acc[2] = 1;
$nan[2] = "ok";
} elseif(isset($_GET['fru'])){
$atk[2] = 1;
$def[2] = 4;
$stam[2] = 1;
$acc[2] = 2;
$nan[2] = "ok";
} else {
print "You didn't pick an apperance<br>";
}
//Below is the weapon statement
if(isset($_GET['kni'])){
$atk[3] = 2;
$def[3] = 3;
$stam[3] = 4;
$acc[3] = 4;
$nan[3] = "ok";
} elseif(isset($_GET['swd'])){
$atk[3] = 3;
$def[3] = 2;
$stam[3] = 4;
$acc[3] = 3;
$nan[3] = "ok";
} elseif(isset($_GET['pis'])){
$atk[3] = 4;
$def[3] = 2;
$stam[3] = 4;
$acc[3] = 4;
$nan[3] = "ok";
} elseif(isset($_GET['shot'])){
$atk[3] = 4;
$def[3] = 1;
$stam[3] = 3;
$acc[3] = 1;
$nan[3] = "ok";
} else {
print "You didn't pick a weapon<br>";
}
//Below is the personality statement
if(isset($_GET['mea'])){
$atk[4] = 4;
$def[4] = 1;
$stam[4] = 3;
$acc[4] = 2;
$nan[4] = "ok";
} elseif(isset($_GET['nic'])){
$atk[4] = 1;
$def[4] = 4;
$stam[4] = 2;
$acc[4] = 4;
$nan[4] = "ok";;
} elseif(isset($_GET['shy'])){
$atk[4] = 2;
$def[4] = 3;
$stam[4] = 1;
$acc[4] = 3;
$nan[4] = "ok";
} elseif(isset($_GET['ret'])){
$atk[4] = 3;
$def[4] = 2;
$stam[4] = 4;
$acc[4] = 1;
$nan[4] = "ok";
} else {
print "You didn't pick a personality<br>";
}
//Below is the apperance statement
if(isset($_GET['yes'])){
$atk[5] = 0;
$def[5] = 0;
$stam[5] = 0;
$acc[5] = 0;
$nan[5] = "ok";
} elseif(isset($_GET['no'])){
$atk[5] = 3;
$def[5] = 3;
$stam[5] = 3;
$acc[5] = 3;
$nan[5] = "ok";
/*
} elseif(isset($_GET['no']) and isset($_GET['gan']){
$atk5 = 5;
$def5 = 5;
$stam5 = 5;
$acc5 = 5;
$nan = "ok";
*/
} else {
print "You didn't say if you did drugs<br>";
}
//Below is the gang statement
if(isset($_GET['gus'])){
$atk[6] = 1;
$def[6] = 1;
$stam[6] = 1;
$acc[6] = 1;
$nan[6] = "ok";
} elseif(isset($_GET['cry'])){
$atk[6] = 0;
$def[6] = 0;
$stam[6] = 3;
$acc[6] = 3;
$nan[6] = "ok";
} elseif(isset($_GET['blo'])){
$atk[6] = 3;
$def[6] = 3;
$stam[6] = 0;
$acc[6] = 0;
$nan[6] = "ok";
} elseif(isset($_GET['pus'])){
$atk[6] = 0;
$def[6] = 0;
$stam[6] = 0;
$acc[6] = 0;
$nan[6] = "ok";
} else {
print "You didn't choose a gang option<br>";
}
function sum($nums) {
if(is_array($nums)) {
$total = array_sum($nums);
}
else {
$args = func_get_args();
$total = 0;
foreach($args as $num) {
$total += $num;
}
}
return $total;
}
if(isset($nan[0]) and isset($nan[1]) and isset($nan[2]) and isset($nan[3]) and isset($nan[4]) and isset($nan[5]) and isset($nan[6])) {
print "Your attack strength is:";
print sum($atk);
print "<br>Your defense strength is:";
print sum($def);
print "<br>Your HP is:";
print sum($stam);
print "<br>your accuracy is:";
print sum($acc);
} else {
//none
}
?>
Hope that helps.