<?php
function Connect() {
mssql_connect('Server','USERNAME','USERPW') or die('Error: Connection to DB
Failed.');
}
function InitForm(){
//layout for the form
echo "<strong>Character Auth</strong><br>
<form name='character' method='post'>
<lable>Character Name</lable><br/>
<input type='text' name='character_name'/><br/>
<lable>Auth Level</lable><br/>
<input type='text' name='auth'/><br/>
<input type='submit'/>
</form>
<br><br>
<strong>Select Character Auth</strong>
<form name='select' method='post'>
<lable>Character Name</lable><br/>
<input type='text' name='char2'/><br/>
<input type='submit'/>
</form>";
}
function PostListener (){
//Add more post variables if needed and add them to initform() function aswell
################################
##### Connection and Post ######
################################
$init = Connect(); //will work once you put the right information
$char = @$_POST['character_name'];
$auth = @$_POST['auth'];
$name = @$_POST['char'];
$name2 = @$_POST['char2'];
################################
//Check both variables for empty value
if (!empty($_POST['character_name']) && !empty($_POST['auth'])){
//Perform Query
$query = mssql_query("update [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] set m_chAuthority
= '{$auth}' where m_szName = '{$char}'");
echo "{$char} is Now Authority '{$auth}'";
}
if (!empty($_POST['char2'])){
$Auth = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
m_szName = '{$name2}'");
while ($row = mssql_fetch_object($Auth)){
echo "{$name2} Is Currently Authority '$row->m_chAuthority'";
}
}
}
$InitForm = InitForm();
$Listener = PostListener();
?>