How do I get the following script to show all the details in the edit account form/template.
Can any one help.
YourAccount.php:
<?
require_once("conn.php");
require_once("includes.php");
require_once("access.php");
if(isset($_POST[s1]))
{
$q1 = "update class_members set
password = '$_POST == $a1[p1]',
FirstName = '$_POST[FirstName]',
LastName = '$_POST[LastName]',
Address = '$_POST[Address]',
City = '$_POST[City]',
State = '$_POST[State]',
ZipCode = '$_POST[ZipCode]',
Phone = '$_GET[phone]',
email = '$_POST[email]',
news = '$_POST[news]',
format = '$_POST[format]'
where MemberID = '$_SESSION[MemberID]' ";
mysql_query($q1);
if(!mysql_error())
{
$error = "<font face=verdana size=2 color=green>You account was updated!</font>";
}
}
//get the member info
$q1 = "select * from class_members where MemberID = '$_SESSION[MemberID]' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
//check the Expire Date
$after5_1 = mktime(0,0,0,date(m),date(d) + 5,date(Y));
$after5_2 = mktime(23,59,59,date(m),date(d) + 5,date(Y));
if(($after5_1 <= $a1[ExpDate]) && ($a1[ExpDate] <= $after5_2 ))
{
$ExpireMessage = "
<center><a class=RedLink href=\"renew.php\">Renew Account[/url]</center>
";
}
if($a1[news] == 'y')
{
$ch1 = "checked";
}
else
{
$ch2 = "checked";
}
if($a1[format] == 'html')
{
$ch3 = "checked";
}
else
{
$ch4 = "checked";
}
//get the number of posted ads by this user
$qp = "select count(*) from class_catalog where MemberID = '$_SESSION[MemberID]' ";
$rp = mysql_query($qp) or die(mysql_error());
$ap = mysql_fetch_array($rp);
$RemainingCredits = $a1[StandardAds] + $a1[FeaturedAds] - $ap[0];
$PostedAds = $ap[0];
Editaccount.php:
<table align=center width=200 cellspacing=0 rules=rows border=0 bordercolor=black>
<tr>
<td width=150 align=right bgcolor=dddddd>Remaining Credits:</td>
<td width=50 align=right bgcolor=dddddd>
<?=$RemainingCredits?>
</td>
</tr>
<tr>
<td align=right>Posted Ads:</td>
<td align=right>
<?=$PostedAds?>
</td>
</tr>
<tr>
<td colspan="2" align=right><div align="center"><a href="AddAsset.php">
<strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Post
New Ad</font></strong>[/url]</div></td>
</tr>
</table>
<?=$BuyMore?>
<?=$ExpireMessage?>
<form method=post action="YourAccount.php" name=RegForm onsubmit="return CheckProfile();">
<table align=center width=400>
<caption align=center><font face=verdana size=2>Update Your Info or Do one of the above</font>
<?=$error?></caption>
<tr>
<td align=right>Username:</td>
<td><input type=text name=Username value="<?$a1[username]?>"></td>
</tr>
<tr>
<td align=right>Password:</td>
<td><input type=password name=p1></td>
</tr>
<tr>
<td align=right>Confirm Password:</td>
<td><input type=password name=p2></td>
</tr>
<tr>
<td align=right>First Name:</td>
<td><input type=text name=FirstName value="<?=$a1[FirstName]?>"></td>
</tr>
<tr>
<td align=right>Last Name:</td>
<td><input type=text name=LastName value="<?=$a1[LastName]?>"></td>
</tr>
<tr>
<td align=right>Address:</td>
<td><input type=text name=Address value="<?=$a1[Address]?>"></td>
</tr>
<tr>
<td align=right>City:</td>
<td><input type=text name=City value="<?=$a1[City]?>"></td>
</tr>
<tr>
<td align=right>State:</td>
<td><input type=text name=State value="<?=$a1[State]?>"></td>
</tr>
<tr>
<td align=right>ZIP/Postal Code:</td>
<td><input type=text name=ZipCode value="<?=$a1[ZipCode]?>"></td>
</tr>
<tr>
<td align=right>Phone:</td>
<td><input type=text name=phone value="<?=$a1[Phone]?>"></td>
</tr>
<tr>
<td align=right>Email:</td>
<td><input type=text name=email value="<?=$a1[email]?>"></td>
</tr>
<tr>
<td align=right>Receive updates:</td>
<td>
<input type=radio name=news value="y" <?=$ch1?>>yes
<input type=radio name=news value="n" <?=$ch2?>>no
</td>
</tr>
<tr>
<td align=right>Newsletter format:</td>
<td>
<input type=radio name=format value="html" <?=$ch3?>>html
<input type=radio name=format value="plain" <?=$ch4?>>plain text
</td>
</tr>
<tr>
<td> </td>
<td><input type=submit name=s1 value="Update"></td>
</tr>
</table>
</form>