My PHP code will only execute the first part of my code...
Code: <?php
session_start();
?>
<html>
<head>
<title> Create a Character</title>
<style type="text/css">
body{
background-color: #000;
font-family: Arial, Tahoma;
font-size: .78em;
}
fieldset{
padding: 10px;
margin: 10px;
border: 1px solid #57626B;
width: 70%;
float: left;
}
legend{
background-color: #6A8CA5;
border: 1px solid #000;
padding: 5px;
}
input{
font-style: italic;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
#tester{
background-color: #333;
margin: 0 auto;
padding: 10px;
width: 70%;
height: 80%;
}
#stats{
float: left;
width: 25%;
font-style: italic;
color: #000;
padding: 5px;
border: 1px dashed #999;
}
</style>
</head>
<body>
<div id="tester">
<?php
//Creation script designed by Cetanu of http://mythscape.freezoka.com and http://tehfreerpg.proboards.com
//This script is licensed by the Creative Commons for: Sharing, Attribution, Non-derivative, and non-commercial.
//You MUST leave these notices in for LEGAL use of this script. YOU MAY NOT EDIT THIS SCRIPT LEGALLY.
//For more: http://creativecommons.org/licenses/by-nc-nd/3.0/us/
if(empty($_SESSION['user_id'])){
die("<strong>You are not logged in. Please do so to access the RPG Sector.</strong>");
}
if(empty($_POST['cont'])){
echo " Time to create your character!<br/>
<form action='create.php' method='post'>
<fieldset>
<legend>Create Character for <strong>".$_SESSION['user_id']."</strong></i></u></legend>
<p>Please choose a species.</p>
<input type='radio' name='Species' id='pred' value='Predator'/>Predator (Yautja)<br/>
<input type='radio' name='Species' id='alien' value='Alien'/>Alien (Xenomorph)<br/>
<input type='radio' name='Species' id='human' value='Marine'/>Marine<br/> <br/>
<label for='name'>Character Name</label>
<input type='text' maxlength='25' id='name' name='name'/><br/>
<input type='hidden' maxlength='30' value='{$_SESSION['user_id']}' id='player' name='player' readonly='readonly'/><br/>
<input type='submit' name='cont' id='cont' value='Continue On'/>
</fieldset>
</form>";
}
echo "<br/>";
if(!empty($_POST['cont'])){
$species = $_POST['species'];
include "db.php";
if(empty($_POST['name']) || empty($_POST['Species'])){
echo "<script>document.write('You must input a species and a name!'); setTimeout("window.location.reload()", 350);</script>";
}
if ($species== "Predator" || "Alien" || "Marine" && !empty($_POST['name'])){
mysql_query("INSERT INTO rpg (name, species, player) VALUES ('{$_POST['name']}' , '{$_POST['Species']}' , '{$_POST['player']}')")
or die(mysql_error());
}
elseif($species=="Predator"){
mysql_query("UPDATE rpg SET max_health=25, health=25, attack=25, defense=25, honor=20 WHERE player='{$_POST['player']}')");
}
elseif($species=="Alien"){
mysql_query("UPDATE rpg SET health=20, max_health=20, attack=20 , defense=20 , stealth=20 WHERE player='{$_POST['player']}");
}
elseif($species=="Marine"){
mysql_query("UPDATE rpg SET health=15, max_health=15 , attack=20 , defense=20 , melee=20 WHERE player='{$_POST['player']}");
}
else{
echo "Invalid Species. Try again!";
}
mysql_query("INSERT INTO bank (player , amount) VALUES('{$_SESSION['user_id']}' , 5)");
header('Location: statadd.php');
}
?>
</div>
</body>
</html>
The part starts here...When it gets to the three elseif statements, they are the only things that won't execute. Everything else works. I don't get errors.
Code: <?php
if(!empty($_POST['cont'])){
$species = $_POST['species'];
include "db.php";
if(empty($_POST['name']) || empty($_POST['Species'])){
echo "<script>document.write('You must input a species and a name!'); setTimeout("window.location.reload()", 350);</script>";
}
if ($species== "Predator" || "Alien" || "Marine" && !empty($_POST['name'])){
mysql_query("INSERT INTO rpg (name, species, player) VALUES ('{$_POST['name']}' , '{$_POST['Species']}' , '{$_POST['player']}')")
or die(mysql_error());
}
elseif($species=="Predator"){
mysql_query("UPDATE rpg SET max_health=25, health=25, attack=25, defense=25, honor=20 WHERE player='{$_POST['player']}')");
}
elseif($species=="Alien"){
mysql_query("UPDATE rpg SET health=20, max_health=20, attack=20 , defense=20 , stealth=20 WHERE player='{$_POST['player']}");
}
elseif($species=="Marine"){
mysql_query("UPDATE rpg SET health=15, max_health=15 , attack=20 , defense=20 , melee=20 WHERE player='{$_POST['player']}");
}
else{
echo "Invalid Species. Try again!";
}
mysql_query("INSERT INTO bank (player , amount) VALUES('{$_SESSION['user_id']}' , 5)");
header('Location: statadd.php');
}
?>
A little help in c#
i am doing a simple paint program using c# i want to draw with the mouse so i wrote the code of the panel events but i want to add a button and when i press the button this events happen how can i do
Linking with Foreign Keys
I have been getting an erro when I try and link:
SCRIPT ERROR
Here is the CONTACT FORM I made for our website:<form id="form1" name="form1" method="post" action=""> <table width="528"
php forms and database navigatio
Hello,I'm new to php and i'd like to post the following.I have written code to get records from a DB and i need one record at a time to be filled in a form i created. Then the next record should be
Is it possible to stop reservation creation in PM Order?
Hi All,
Email logic not working
I would like to send an email using the php email() function then if it does execute i.e sends i would like to update a particular field in my db.however no matter how hard i try to the code seem to
image upload, resize THEN submit form
Ok so I have a form that requires the user to upload an image, and then do something with that image (using some ajax scripts), then fill out the rest of the form and submit. I have the upload script
Deleting Partners on the Customer Master.
Does SAP handle removing the Partner from Open Sales Orders when a Partner is deleted in the Customer Master. For us, this is not happening, this there some config that must be turned on for this to
Warning: session_start() [function.session-start]: Cann.....
hi, can someone help me with this? I keep getting this error....Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by ......I tried to upload my files
Form help: Syntax & Logic
Hello again all,I'm working on a form and ran into a wall (again) and can't seem to think through how to best code what i need (the logic side). I've begun by just sitting down and starting to code