Hi,
I am having two problewms. The first is in getting data from a row in a database into a dropdown on a form. I can get the data but the dropdown defaults th Novice not the Extra which is in the table.
The second is writing the data back to the row in the table.
Here is what I have, I am not familiar with the way I should post this:
<?php
session_start();
if (!isset($_SESSION['user']))
{
header("Location: login.php");
}
include ('dbc.php');
if ($_POST['Submit']=='Change')
{
$rsPwd = mysql_query("select user_pwd from users where user_email='$_SESSION[user]'") or die(mysql_error());
mysql_query("Update users
SET full_name = '$full_name'
WHERE user_email = '$_SESSION[user]'
") or die(mysql_error());
header("Location: settings.php?msg=Settings updated...");
}
?>
<?php
$result = mysql_query ("SELECT * FROM users
WHERE user_email LIKE '$_SESSION[user]'
");
if ($row = mysql_fetch_array($result)) {
do {
$checkfullname = $row['full_name'];
$checkname = $row['user_name'];
$checkemail = $row['user_email'];
$checkclass = $row['l_class'];
$checkcall = $row['call_sign'];
PRINT "<b>Username: </b> ";
print $row["full_name"];
print (" ");
print ("<br>");
PRINT "<b>Name: </b> ";
print $row["user_name"];
print ("<br>");
PRINT "<b>Email: </b> ";
print $row["user_email"];
print ("<br>");
PRINT "<b>Class: </b> ";
print $row["l_class"];
print ("<br>");
PRINT "<b>Call Sign: </b> ";
print $row["call_sign"];
print ("<br>");
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no records were found!";}
?>
<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>
</p>
<table width="65%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="d5e8f9" class="mnuheader"><strong><font size="5">Edit Account for
<?php
print $_SESSION[user]
?>
</font></strong></td>
</tr>
<tr>
<td bgcolor="e5ecf9" class="forumposts"><form name="form1" method="post" action="register.php" style="padding:5px;">
<p><br>
Name:
<input type="text" name="full_name" id="full_name" value="<?= $checkfullname ?>" />
Ex. John Wilson</p>
User Name:
<input name="user_name" type="text" id="user_name" value="<?= $checkname ?>" />Ex. John </p>
<p>Email:
<input name="email" type="text" id="email" value="<?= $checkemail ?>" />
Ex. [email]john@domain.com[/email]</p>
</p>
<p>Class:
<select name="l_class" id="select8" value="<?= $checkclass ?>" ;"/>
<option value="None">None</option>
<option value="Novice">Novice</option>
<option value="Tech">Tech</option>
<option value="HF Tech">HF Tech</option>
<option value="General">General</option>
<option value="Advanced">Advanced</option>
<option value="Extra">Extra</option>
</select>
</p>
<p>Call Sign:
<input name="call_sign" type="text" id="call_sign" value="<?= $checkcall ?>" />
</p>
<input name="user_code" type="text" size="10">
<img src="pngimg.php" align="middle"> </p>
<p align="center">
<input type="submit" name="Submit" value="Update">
</p>
</form></td>
</tr>