I have a running php scripts via MSSQL Server but I need help. Here is the problem I want to stay in the same page if the data given is not the same if they click submit button and update user button, but in the scripts when pressing the said button in keep going to the user list page. I do some debugging by my self. please help me
here is the script
<?php
session_start();
include("../../Includes/functions.inc.php");
include("../../Includes/functions.biosched.php");
include("../../connect.php");
include("../../Includes/sqlclass.php");
$q1 = new csql('test_db','register');
if($_POST['proc']==1)
{
$q1->tblcol = 'username,password,passwords,email';
if($_POST['password1'] != $_POST['password2'])
{
echo ("Password Mismatch<br>");
}
else
$q1->i_ms("'".$_POST['name']."','".$_POST['password1']."','".$_POST['password2']."','".$_POST['email']."'");
}
$uid = $_GET['getid'];
$id = $_POST['aydi'];
$uun = $_POST['name'];
$upas = $_POST['password1'];
$upass = $_POST['password2'];
if($_POST['password1'] != $_POST['password2'])
{
echo ("Password Mismatch<br>");
}
else
$q1->u_ms("username = '$uun',password = '$upas',passwords = '$upass'",$id);
if($_GET['delid'] != '')
{
$q1->d_ms($_GET['delid']);
}
?>
<style type="text/css">
<!--
.style18 {font-family: Arial, Helvetica, sans-serif; font-size: 16px; }
.style22 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
.style25 {font-size: 12px}
.style26 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
-->
</style>
<?php if($_GET['pg']==1){ ?>
<form id="form6" name="form6" method="" action="">
<table width="433" cellpadding="0" cellspacing="0">
<tr>
<th width="431"><p><a href="javascript:void(0);" class="style18" onclick="ajax_loadContent('content','Modules/<?=$_GET['fp']?>?pg=2&fp=<?=$_GET['fp']?>');return false">Add User</a></p></th>
</tr>
</table>
</form>
<form id="form2" name="form2" method="" action="">
<table width="432" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" bgcolor="#CCCCCC"><span class="style26">User's List </span></td>
</tr>
<tr>
<td width="47"><div align="center"><span class="style26">ID</span></td>
<td width="126"><div align="center"><span class="style26">Username</span></td>
<td width="170"><div align="center"><span class="style26">Email Address </span></td>
<td width="94"><div align="center"><span class="style26">Action</span></td>
</tr>
<?php
$q1->q_ms();
while($g1 = $q1->g_ms())
{
$id = $g1['id'];
$un = $g1['username'];
$pas = $g1['password'];
$pass = $g1['passwords'];
$em = $g1['email'];
?>
<tr>
<td><div align="center"><?=$id?></td>
<td><div align="center"><?=$un?></td>
<td><div align="center"><?=$em?></td>
<td><div align="center"><a href="javascript:void(0);" onclick="ajax_loadContent('content','Modules/<?=$_GET['fp']?>?pg=3&fp=<?=$_GET['fp']?>&getid=<?=$g1['id']?>');return false">Edit</a> | <a href="javascript:void(0);" onclick="doYouWantTo('<?=$_GET['fp']?>?pg=1&delid=<?=$g1['id']?>&fp=<?=$_GET['fp']?>&sec=1')">Delete</a></td>
</tr>
<?php } ?>
</table>
</form>
<p>
<?php } ?>
</p>
<?php if($_GET['pg']==2){ ?>
<form id="form5" name="form5" method="" action="">
<table width="271" cellpadding="0" cellspacing="0">
<tr>
<th width="269"><p><a href="javascript:void(0);" class="style18" onclick="ajax_loadContent('content','Modules/<?=$_GET['fp']?>?pg=1&fp=<?=$_GET['fp']?>');return false">User's List</a></p></th>
</tr>
</table>
</form>
<form id="form1" name="form1" method="" action="">
<table width="268" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" bgcolor="#CCCCCC"><span class="style26">Add User </span></td>
</tr>
<tr>
<td width="118"><span class="style26">Username</span></td>
<td width="144"><input name="name" type="text" id="name" class="field"/></td>
</tr>
<tr>
<td><span class="style26">Password</span></td>
<td><input name="password1" type="password" id="password1" class="field"/></td>
</tr>
<tr>
<td><span class="style26">Re-Type Password </span></td>
<td><input name="password2" type="password" id="password2" class="field"/></td>
</tr>
<tr>
<td><span class="style26">Email Address </span></td>
<td><input name="email" type="text" id="email" class="field"/></td>
</tr>
</table>
<p>
<input name="Submit" type="button" id="Submit" value="Submit" onclick="new Ajax.Updater('content', 'Modules/<?=$_GET['fp']?>?pg=1&fp=<?=$_GET['fp']?>', {method: 'post', asynchronous:true, parameters:Form.serialize(document.form1)});"/>
<input name="proc" type="hidden" id="proc" value="1" />
</p>
</form>
<p>
<?php } ?>
</p>
<?php
if($_GET['pg']==3){
$q1->filter = "id = ".$_GET['getid'];
$q1->q_ms();
$g1 = $q1->g_ms();
$id = $g1['id'];
$un = $g1['username'];
$pas = $g1['password'];
$pass = $g1['passwords'];
$em = $g1['email'];
?>
<form id="form4" name="form4" method="" action="">
<table width="268" cellpadding="0" cellspacing="0">
<tr>
<th width="266" class="style18"><p><a href="javascript:void(0);" onclick="ajax_loadContent('content','Modules/<?=$_GET['fp']?>?pg=1&fp=<?=$_GET['fp']?>');return false">User's List</a> | <a href="javascript:void(0);" onclick="ajax_loadContent('content','Modules/<?=$_GET['fp']?>?pg=2&fp=<?=$_GET['fp']?>');return false">Add User</a></p></th>
</tr>
</table>
</form>
<form id="form3" name="form3" method="" action="">
<table width="266" border="1" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" bgcolor="#CCCCCC" class="style22 style25">Edit User</td>
</tr>
<tr>
<td width="116"><span class="style26">ID</span></td>
<td><input name="aydi" type="" class="field" id="aydi" value="<?=$id?>"/></td>
</tr>
<tr>
<td><span class="style26">Username</span></td>
<td width="144"><input name="name" type="text" class="field" id="name" value="<?=$un?>"/></td>
</tr>
<tr>
<td><span class="style26">Password</span></td>
<td><input name="password1" type="password" class="field" id="password1" value="<?=$pas?>"/></td>
</tr>
<tr>
<td><span class="style26">Re-Type Password </span></td>
<td><input name="password2" type="password" class="field" id="password2" value="<?=$pass?>"/></td>
</tr>
</table>
<p>
<input name="submit" type="button" id="submit" value="Update User" class="button" onclick="new Ajax.Updater('content', 'Modules/<?=$_GET['fp']?>?pg=1&fp=<?=$_GET['fp']?>', {method: 'post', asynchronous:true, parameters:Form.serialize(document.form3)});"/>
<input name="proc" type="hidden" id="proc" value="1" />
<input name="proc" type="hidden" id="proc" value="<?=$g1['id']?>" />
</p>
</form>
<p>
<?php } ?>
</p>
Note:
This is already a running php script via mssql server