Jump to content

[SOLVED] Form isn't posting information to my database.


Recommended Posts

Ok.

 

I have a page which calls information from the database. When you update a user, it redirects to this form, depending on the ID:

 

<?php
$host="localhost";
$username="wowdream_domaine";
$password="pass";
$db_name="wowdream_domaine";
$tbl_name="members";

mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$id=$_GET['id'];

$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);

$rows=mysql_fetch_array($result);
?>
<form name="form1" method="post" action="update_ac.php">
	<fieldset>
		<label>Username:</label>
		<input class="small" name="uname" type="text" id="uname" value="<? echo $rows['username']; ?>">
		<br class="hid" />
		<br class="hid" />
		 <label>Password:</label>
		<input class="small" name="pass" type="password" id="pass" value="<? echo $rows['password']; ?>">
		<br class="hid" />
		<br class="hid" />
            		<label>Rank:</label>
		<input class="small" name="access" type="text" id="access" value="<? echo $rows['access']; ?>" size="15">
		<br class="hid" />
		<br class="hid" />
            <label>Real Name:</label>
		<input class="small" name="name" type="text" id="name" value="<? echo $rows['name']; ?>">
		<br class="hid" />
		<br class="hid" />
            <label>E-Mail:</label>
		<input class="small" name="email" type="text" id="email" value="<? echo $rows['email']; ?>">
		<br class="hid" />
		<br class="hid" />
            <label>Contact Number:</label>
		<input class="small" name="number" type="text" id="number" value="<? echo $rows['number']; ?>">
		<br class="hid" />
		<br class="hid" />
<br class="hid" />
<br class="hid" />
<br class="hid" />
	<br class="hid" />
<br class="hid" />
<br class="hid" />
<br /><br /><br /><br />
		<a href="#" class="button submit" title="Submit"><span>Update</span></a>
		<span class="clear"></span>
	</fieldset>
	</form><?php
mysql_close();
?>

 

Which posts information to;

 

<?php
$host="localhost"; 
$username="wowdream_domaine";
$password="pass";
$db_name="wowdream_domaine"; 
$tbl_name="members";

mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$id=$_GET['id'];
$uname=$_POST['uname'];
$pass=$_POST['pass'];
$access=$_POST['access'];
$name=$_POST['name'];
$email=$_POST['email'];
$number=$_POST['number'];

$sql="UPDATE $tbl_name SET username='$uname', password='$pass', access='$access', name='$name', email='$email', number='$number' WHERE id='$id'";
$result=mysql_query($sql);

if($result){
header("location:editadmindone.php");
}

else {
header("location:editadminerror.php");
}

?>

 

I'm calling the information from the form, my database info is correct. Im just puzzled as to why it's redirecting to 'editadmindone.php', and not actually updating the database!

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.