No Reloading..

[php]<?php
session_start();
mysql_connect(“localhost”,“Howey”,“b14T3aqMM”);
mysql_select_db(“howeydb”);

$tcontent=’’;

if(!$_SESSION[‘name’] || $_SESSION[‘name’]==“NoLog”){
$_SESSION[‘name’] = “NoLog”;
echo “Please login here”;
}else{
if(isset($_POST[‘submi’])){
$keyn = $_POST[‘keyname’];
$posi = $_POST[‘position’];
mysql_query(“INSERT INTO staff (staffname, position)
VALUES (’$keyn’, ‘$posi’)”);
}elseif(isset($_POST[‘remov’])){
$keyn = $_POST[‘keynamee’];
$posi = $_POST[‘positionn’];
mysql_query(“DELETE FROM staff WHERE staffname=’$keyn’ AND position=’$posi’”);
mysql_query(“INSERT INTO oldstaff (staffname, position)
VALUES (’$keyn’, ‘$posi’)”);
}else{
$tcontent = 'Add Staff


Key Name:

Position:
Master Game Moderator
Moderator
Public Relations
Player Liaison
Graphics


						</form><br /><br />Remove Staff<br /><br /><form action="editstaff.php" method="post">
						Key Name: <input type="text" name="keynamee" /><br />
						Position: <select name="positionn">
								<option value="Master Game Moderator">Master Game Moderator</option>
								<option value="Moderator">Moderator</option>
								<option value="Public Relations">Public Relations</option>
								<option value="Player Liaison">Player Liaison</option>
								<option value="Pixel Artist">Graphics</option>
							  </select><br />
						<input type="submit" name="remov" value="Submit" />
						
						</form>';
}

}
?>[/php]

For some reason, when I submit a form, neither of the forms load back up. It doesn’t echo them out (It does when you enter the page, just not when you submit one of the forms).

There was no edit so I just replying…

The forms work and it adds what I need to the correct databases, the only problem is the forms don’t reload back up.

According to your if… else conditions, when you submit a form i.e. isset($_POST[‘submi’]) is true - the form should not display. The form is generated (in this variable $tcontent) only when form was not submitted.

So how would I make it so that it goes to false after a submit has happened?

Just move this code outside the last else{} block. Just eliminate this last block i.e. - remove else{ before $tcontent assignment and also remove closing }

Thanks a lot. :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service