Thanks for the speedy response.
OK so ive merged the two forms into one (the new member and new band profile forms) and they both sumbit all the right information into the right tables.
and the search and display profile still works fine =]
now just the editing bit. Ive made an edit form using a tutorial and the code looks like this:
PHP Code:
<?
mysql_connect("HOST","DBUSERNAME","PASSWORD");
mysql_select_db("DBNAME");
if(!isset($cmd))
{
$result = mysql_query("select * from Users order by id");
while($r=mysql_fetch_array($result))
{
$bandname=$r["bandname"];
$id=$r["id"];
echo "<a href='edit.php?cmd=edit&id=$id'>$bandname - Edit</a>";
echo "<br>";
}
}
?>
<?
if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
{
if (!isset($_POST["submit"]))
{
$id = $_GET["id"];
$sql = "SELECT * FROM Users WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<form action="edit.php" method="post">
<input type=hidden name="id" value="<?php echo $myrow["id"] ?>">
Band Name:<INPUT TYPE="TEXT" NAME="bandname" VALUE="<?php echo $myrow["bandname"] ?>" SIZE=30><br>
Band Bio:<INPUT TYPE="TEXT" NAME="bio" VALUE="<?php echo $myrow["bio"] ?>" SIZE=30><br>
Band Photo:<INPUT TYPE="TEXT" NAME="photo" VALUE="<?php echo $myrow["photo"] ?>" SIZE=30><br>
Band Website:<INPUT TYPE="TEXT" NAME="site" VALUE="<?php echo $myrow["site"] ?>" SIZE=30><br>
<input type="hidden" name="cmd" value="edit">
<input type="submit" name="submit" value="submit">
</form>
<? } ?>
<?
if ($_POST["$submit"])
{
$bandname = $_POST["bandname"];
$bio = $_POST["bio"];
$photo = $_POST["photo"];
$site = $_POST["site"];
$sql = "UPDATE Users SET bandname='$bandname',bio='$bio',photo='$photo',site='$site' WHERE id=$id";
$result = mysql_query($sql);
echo "Thank you! Information updated.";
}
}
?>
Now this works in so much as it allows you to select an entry, and edit the fields. but i have to click the name of the prfile id like to edit first.
I was wondering, could you fix it so that i can put a link on my members page (the page you see when you sucessfully log in) saying "edit profile" and when you click it you are shown the form filled in with just your information automatically?
thanks for all your help on this by the way! but considering where I was not afew days ago I think we are making great progress wouldnt you say =]
x