PDA

View Full Version : Updating underlying tables in database from web page form


Beeky
12-05-2010, 09:57 AM
Here is my problem. I have a page where the nominated user can update a member's details. Maybe a telephone number or a new email address etc. The code I am using displays a table from my database with all the current members so that the person making the change can identify the member that needs updating. Under the table is a form that the user can input the new member details. After pressing the submit button the database table is updated.

The problem with this arrangment is that the user has to input all the fields for the record whether or not they need to be updated. What I would like to be able to do is amend my code so that:

a. The user only needs to update the relevant field and no all of them.
b. Ideally I would like the user to be able to click on a combo box to select the member's id (field: member_id) which then populates all the fields for that record. The user should then only have to amend the required field.
Unfortunately it has taken me a while to get as far as I have and I don't have either the understand or knowledge to achieve this aim.
The code for this page is shown below and would be very grateful if anyone can help me with this.

Code:
<? require('each-sas.php'); ?><?php

$username = "**********";
$password = "*********";
$hostname = "localhost";

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
//select a database to work with
$selected = mysql_select_db("eachfrie_Events",$dbhandle)
or die("Could not select eachfrie_Events");
// query db and loop through rows example
/// query db and loop through rows example

$id = $_POST['member_id'];
$field2 = $_POST['FirstName'];
$field3 = $_POST['Surname'];
$field4 = $_POST['Role'];
$field5 = $_POST['Address1'];
$field6 = $_POST['Address2'];
$field7 = $_POST['Address3'];
$field8 = $_POST['Address4'];
$field9 = $_POST['PostCode'];
$field10 = $_POST['Telephone'];
$field11 = $_POST['email'];


if($id){

mysql_query("UPDATE tblMembers SET FirstName='$field2',Surname='$field3',Role='$field 4',Address1='$field5',Address2='$field6',Address3= '$field7',Address4='$field8',PostCode='$field9',Te lephone='$field10',email='$field11' WHERE eventid ='$id'");
}else{
$note1 = "The table below is the current list of members for the group. To update any of the members please type the event no in the update table below
and complete all the fields. If you don't update all fields only those that have been insert will be updated";
$warning = "Please key an ID number of which record you want to update";
$find = "find me";
}
/// query db and loop through rows example

$query = mysql_query("SELECT * FROM tblMembers");

$table = "<table border=\"1\" cellspacing=\"10\" body bgcolor=\"#AABBCC\" Align=Center>\n";
" <tr>
<td>Member No</td>
<td>First Name</td>
<td>Surname</td>
<td>Role</td>
<td>Address1</td>
<td>Address2</td>
<td>Address3</td>
<td>Address4</td>
<td>PostCode</td>
<td>Telephone</td>
<td>email</td>

</tr>";

while($row = mysql_fetch_array($query)){

$table .= " <tr>
<td>".$row['member_id']."</td>
<td>".$row['FirstName']."</td>
<td>".$row['Surname']."</td>
<td>".$row['Role']."</td>
<td>".$row['Address1']."</td>
<td>".$row['Address2']."</td>
<td>".$row['Address3']."</td>
<td>".$row['Address4']."</td>
<td>".$row['PostCode']."</td>
<td>".$row['Telephone']."</td>
<td>".$row['email']."</td>
</tr>";
}

$table .= "</table>";

?>
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AdminHomePage &nbsp;</title>
<meta http-equiv="Content-Type" content="text/html; charset =utf-8" />
<meta name="keywords" content="hospice" />
<meta name="description" content="Please insert Meta Description which contained 1-255 characters." />
<meta name="children" content="Childrens charity" />
<meta name="charity" content="Childrens charities" />
<meta name="hospice" content="Childrens Hospices" />
<meta name="childrensHospices" content="Find out about childrens hospices and the services they give" />
<meta name="ChildrensCharities" content="Fundraising for childrens charities" />
<meta name="fundraising" content="How can I help to fundraise?" />
<meta name="EACHPeterborough" content="Friends of EACH Peterborough" />
<meta name="generator" content="Rvglobalsoft" />
<meta name="progid" content="Version: 4.47 PRO; Project name: EACH_Friends_Peterborough; Project id: 87f3b81b6ae481ca6dda443368776514; Template Name: 23-561988-1_blue_DiyPicture_2; Published date: October 10, 2010, 12:50 26 (GMT -05:00" />

<link rel="stylesheet" href="http://eachfriends-peterborough.com/style.css" type="text/css" />
<link rel="stylesheet" href="http://eachfriends-peterborough.com/Verdana.css" type="text/css" />
<link rel="stylesheet" href="http://eachfriends-peterborough.com/Navigator.css" type="text/css" />
<link rel="stylesheet" href="http://eachfriends-peterborough.com/pathway.css" type="text/css" />

<script type="text/javascript" src="http://eachfriends-peterborough.com/rvsincludefile/rvsheadpage.js"></script>


<script type="text/javascript" src="http://eachfriends-peterborough.com/rvsincludefile/rvsnavigator.js"></script>
<script type="text/javascript" src="http://eachfriends-peterborough.com/js/publishNavigator/layersmenu-library.js"></script>
<script type="text/javascript" src="http://eachfriends-peterborough.com/js/publishNavigator/layersmenu.js"></script>

<script type="text/javascript" src="http://eachfriends-peterborough.com/rvsincludefile/rvscustomopenwindow.js"></script>

</head>

<body class="diybackground">
<table cellpadding="0" cellspacing="0" id="rv_top_adjust_width_0" width="100%" align="center" >
<tr>
<td align="left" valign="top">
<!-- START LOGO -->
<div style="position: absolute;">
<div id="Layer1" style="position:relative; left:20px; top:50px; width:120; height:60; text-align:center; z-index:1; overflow:visible; white-space:nowrap;"><!-- START LOGO --><a href="http://eachfriends-peterborough.com/index.php" >
<img src="http://eachfriends-peterborough.com/LOGO.GIF?682a8173c5c6d6d31b98a3b7f06dc15c" border="0" alt="Logo" />
</a><!-- END LOGO --></div>
</div>
<div style="position: absolute;">
<div id="Layer2" style="position:relative; left:200px; top:60px; width:auto; height:auto; text-align:left; z-index:2; overflow:visible; white-space:nowrap;" class="company"><div><font style="font-size: 24px; background-color: #0000ff" color="#ffffff"><strong>The Friends Group for Peterborough</strong></font><span></span></div></div>
</div>
<div style="position: absolute;">
<div id="Layer3" style="position:relative; left:200px; top:100px; width:auto; height:auto; text-align:left; z-index:3; overflow:visible; white-space:nowrap;" class="slogan"><div style="background-color: #0000ff"><font style="font-size: 18px"><strong>Supporting EACH a place for living</strong></font></div></div>
</div>
<!-- END LOGO -->
<table cellpadding="0" cellspacing="0" width="100%">
<tr><td class="topwhite"><img src="images/spacer.gif" width="1" height="40" /></td></tr>
<tr><td class="header_line1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr>
<tr><td class="header_line2"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr>
<tr>
<td class="bgheader" align="left"><img src="images/headerimage.gif" width="780" height="120" /></td>
</tr>
<tr><td class="header_line3"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr>
<tr><td class="header_line4"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr>
<tr>
<td align="left" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="bgnavigator" align="left" valign="top" height="32"><div class="navigator">
<ul class="navigator">
<li id="hormenu1L1" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="index.php" class="normal" onmouseover="shutdown();" target="_self" ><span>Home</span></a></li>
<li id="hormenu1L2" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="Events-Programmes.php" class="normal" onmouseover="shutdown();" target="_self" ><span>Events Programmes</span></a></li>
<li id="hormenu1L3" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="Members-Area.php" class="normal" onmouseover="moveLayerX1('L3', 'hormenu1'); LMPopUp('L3', false);" target="_self" ><span>Members Area&nbsp;<img src="images/down-arrow.gif" border="0" alt=">" /></span></a></li>
<li id="hormenu1L8" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="Contact-Us.php" class="normal" onmouseover="shutdown();" target="_self" ><span>Contact Us</span></a></li>
<li id="hormenu1L9" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="Admin.php" id="current" onmouseover="moveLayerX1('L9', 'hormenu1'); LMPopUp('L9', false);" target="_self" ><span>Admin&nbsp;<img src="images/down-arrow.gif" border="0" alt=">" /></span></a></li>
</ul>
</div>

<!-- START SUBMENU DATA -->
<!-- beginning of menu footer - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ -->
<div id="L3" class="submenu" onmouseover="clearLMTO();" onmouseout="setLMTO();">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap="nowrap">
<div class="subframe">
<div id="refL4" class="item">
<a href="Members-Details.php" onmouseover="LMPopUp('L3', true);" target="_self" ><span>&nbsp;Members Details&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
</div>
<div id="refL5" class="item">
<a href="Add-New-Member.php" onmouseover="LMPopUp('L3', true);" target="_self" ><span>&nbsp;Add New Member&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
</div>
<div id="refL6" class="item">
<a href="Update-Member.php" onmouseover="LMPopUp('L3', true);" target="_self" ><span>&nbsp;Update Member&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
</div>
<div id="refL7" class="item">
<a href="Delete-a-Member.php" onmouseover="LMPopUp('L3', true);" target="_self" ><span>&nbsp;Delete a Member&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
</div>
</div>
</td>
</tr>
</table>
</div>
<div id="L9" class="submenu" onmouseover="clearLMTO();" onmouseout="setLMTO();">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap="nowrap">
<div class="subframe">
<div id="refL10" class="item">
<a href="Add-New-Event.php" onmouseover="LMPopUp('L9', true);" target="_self" ><span>&nbsp;Add New Event&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
</div>
<div id="refL11" class="item">
<a href="Update-Existing-Event.php" onmouseover="LMPopUp('L9', true);" target="_self" ><span>&nbsp;Update Existing Event&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
</div>
<div id="refL12" class="item">
<a href="Delete-an-Event.php" onmouseover="LMPopUp('L9', true);" target="_self" ><span>&nbsp;Delete an Event&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
</div>
</div>
</td>
</tr>
</table>
</div>

<script language="JavaScript" type="text/javascript">
//<!--
loaded = 1;
// -->
</script>
<!-- end of menu footer - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ -->
<!-- END SUBMENU DATA -->
</td>
</tr>
<tr><td class="body_line1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr>
<tr><td class="body_line2"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr>
<tr><td class="bgtshadow"><img src="images/spacer.gif" alt="" width="1" height="12" /></td></tr>
<tr>
<td align="left" valign="top">
<table cellpadding="0" cellspacing="0" width="100%" class="bgbody">


<!-- Begin PATHWAY and ICON -->
<tr>
<td class="magin">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<!-- Begin PATHWAY -->
<td align="left" width="99%"><?php include("/home/eachfrie/public_html/rvsincludefile/icon_UpdateMember.htm"); ?></td>
<!-- End PATHWAY -->
<!-- Begin ICON -->
<td align="right"><?php include("/home/eachfrie/public_html/rvsincludefile/icon_a5bb94dfb5bd36a36f8071ca5a1ea33c.html"); ?></td>
<!-- End ICON -->
</tr>
</table>
</td>
</tr>
<!-- End PATHWAY and ICON -->
<tr>
<td align="left" valign="top">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>


<td align="left" valign="top" class="magin" id="rv_adjust_width_0" width="100%">

<table cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="100%" id="layout_zone1" style = ""><p>&nbsp;</p>

<?php echo $note1?>
<p>&nbsp;</p>
<?php echo $table; ?>
<p>&nbsp;</p>
<?php echo $warning; ?>

<p>&nbsp;</p>

<form id="form1" name="form1" method="post" action="">

<table width="49%" border="0" align="center">

<td width="35%"></td>

<tr>

<td>Member No</td>
<td><input name="member_id" type="text" id="member_id" /></td>
</tr>
<tr>
<td>First Name</td>

<td><input name="FirstName" type="text" id="FirstName" /></td>
</tr>
<tr>
<td>Surname</td>

<td><input name="Surname" type="text" id="Surname" /></td>
<tr>
<td>Role</td>

<td><input name="Role" type="text" id="Role" /></td>
<tr>
<td>Address</td>

<td><input name="Address1" type="text" id="Address1" /></td>
</tr>
<td></td>
<td><input name="Address2" type="text" id="Address2" /></td>
</tr>
<td></td>
<td><input name="Address3" type="text" id="Address3" /></td>
</tr>
<td></td>
<td><input name="Address4" type="text" id="Address4" /></td>
</tr>
<td>Post Code</td>

<td><input name="PostCode" type="text" id="PostCode" /></td>
</tr>
<td>Telephone</td>

<td><input name="Telephone" type="text" id="Telephone" /></td>
</tr>
<td>email</td>

<td><input name="email" type="text" id="email" /></td>
</tr>
</tr>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form></p></td> </tr></table></td> </tr></table></td> </tr></table>
<p>&nbsp;</p>
</p>

<p>Please click button to logout. Don't forget to log out before
returning to main website:</p> <?=$logout_button?>
<p>
</td>


</tr>
</table>
</td>
</tr>
<!-- Begin FOOTER -->
<tr>
<td align="center" class="magin"></td>
</tr>
<!-- End FOOTER -->


<tr>
<td align="center" valign="bottom">
<table cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="bottom" class="marginpw"></td>
<td width="8"></td>
<td align="center" valign="bottom" class="marginpw"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bgbshadow"><img src="images/spacer.gif" alt="" width="1" height="18" /></td>
</tr>
<tr>
<td class="bgfooter"><img src="/images/spacer.gif" alt="" width="1" height="30" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

</body>
</html>

Corrosive
12-05-2010, 10:31 AM
Rather than echoing out the details into a table why don't you echo them out into the form? Then the user simply changes the bits they need to but all the details get updated because they are in the form already?

Beeky
12-06-2010, 05:40 PM
I have really tried to achieve this but somehow it has not worked. The trouble is that when you don't know how to achieve something it is hard to see where you go wrong. For example I have tried this:

?>
<form id="form1" name="form1" method="post" action="">

<table width="49%" border="0" align="center">

<td width="35%"></td>

<tr>

<td>Member No</td>
<td><input name="member_id" type="text" id="member_id" value="<?PHP echo $id ?>"/></td>
</tr>
<tr>
<td>First Name</td>

<td><input name="FirstName" type="text" id="FirstName" value="<?PHP echo $field2 ?>" /></td>
</tr>
<tr>
<td>Surname</td>

<td><input name="Surname" type="text" id="Surname" value="<?php echo $field3 ?>" /></td>
<tr>
<td>Role</td>

<td><input name="Role" type="text" id="Role" value="<?php echo $field4 ?>"/></td>
<tr>
<td>Address</td>

<td><input name="Address1" type="text" id="Address1" value="<?php echo $field5 ?>"/></td>
</tr>
<td></td>
<td><input name="Address2" type="text" id="Address2" value="<?PHP echo $field6 ?>"/></td>
</tr>
<td></td>
<td><input name="Address3" type="text" id="Address3" value="<?PHP echo $field7 ?>"/></td>
</tr>
<td></td>
<td><input name="Address4" type="text" id="Address4" value="<?PHP echo $field8 ?>"/></td>
</tr>
<td>Post Code</td>

<td><input name="PostCode" type="text" id="PostCode" value="<?PHP echo $field9 ?>"/></td>
</tr>
<td>Telephone</td>

<td><input name="Telephone" type="text" id="Telephone" value="<?PHP echo $field10 ?>"/></td>
</tr>
<td>email</td>

<td><input name="email" type="text" id="email" value="<?PHP echo $field11 ?>"/></td>
</tr>
</tr>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form></p></td> </tr></table></td> </tr></table></td> </tr></table>This was just to try and echo the records. Clearly this is impossibly wrong but I don't know where to go from here. Also I would still like to have a combo box at the beginning of the form that shows both the member_id and Surname where the user can select a member to amend.

Help!!!

Corrosive
12-06-2010, 05:43 PM
Surprised that isn't working!

Beeky
12-06-2010, 06:15 PM
Well it ain't. The full code for this part is:

<?php
// You need to query this member's info from the database
$query = "SELECT * FROM `tblMembers` WHERE $id=$id LIMIT 1";
$result = mysql_query($query);
if($result){
$info = mysql_fetch_array($result);
}
?>
<form id="form1" name="form1" method="post" action="">

<table width="49%" border="0" align="center">

<td width="35%"></td>

<tr>

<td>Member No</td>
<td><input name="member_id" type="text" id="member_id" value="<?PHP echo $id ?>"/></td>
</tr>
<tr>
<td>First Name</td>

<td><input name="FirstName" type="text" id="FirstName" value="<?PHP echo $field2 ?>" /></td>
</tr>
<tr>
<td>Surname</td>

<td><input name="Surname" type="text" id="Surname" value="<?php echo $field3 ?>" /></td>
<tr>
<td>Role</td>

<td><input name="Role" type="text" id="Role" value="<?php echo $field4 ?>"/></td>
<tr>
<td>Address</td>

<td><input name="Address1" type="text" id="Address1" value="<?php echo $field5 ?>"/></td>
</tr>
<td></td>
<td><input name="Address2" type="text" id="Address2" value="<?PHP echo $field6 ?>"/></td>
</tr>
<td></td>
<td><input name="Address3" type="text" id="Address3" value="<?PHP echo $field7 ?>"/></td>
</tr>
<td></td>
<td><input name="Address4" type="text" id="Address4" value="<?PHP echo $field8 ?>"/></td>
</tr>
<td>Post Code</td>

<td><input name="PostCode" type="text" id="PostCode" value="<?PHP echo $field9 ?>"/></td>
</tr>
<td>Telephone</td>

<td><input name="Telephone" type="text" id="Telephone" value="<?PHP echo $field10 ?>"/></td>
</tr>
<td>email</td>

<td><input name="email" type="text" id="email" value="<?PHP echo $field11 ?>"/></td>
</tr>
</tr>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form></p></td> </tr></table></td> </tr></table></td> </tr></table>

I am clearly doing something wrong!

Corrosive
12-06-2010, 06:48 PM
If you are echoing the array that is caught in the $info variable then your echos should be more like <?PHP echo $info['id'] ?> shouldn't they?

Beeky
12-07-2010, 07:33 AM
No I tried this and it still doesn't work.

Corrosive
12-07-2010, 09:19 AM
OK, fair enough. Back to the drawing board then.

jmichae3
12-07-2010, 09:20 AM
- your action attribute in the form element must contain the path to your PHP file that processes your form.
- when you process your form, your form input will be available as $_POST['member_id'], etc. and you really should use isset() to see if that form variable is set or not first before assigning it to anything.
- always validate and constrain external input against SQL Injection attacks (for instance, don't allow quotes of any kind, or in most cases, newlines). you don't know if the form input is coming from outside your web site by a hacker, so don't give them any slack! there are other methods for form validation as well, like .
- your echo statements are missing the terminating semicolon (;). all PHP statements must end with a semicolon. this is not javascript.
- $id=$id should be id='$id' shouldn't it? or did your mean member_id='$id'? if you had intended to include no where clause, simply drop it.
- when expanding a php variable in a string
- by the way, you can add ORDER BY Surname, FirstName to your query to make things easier on the person reading the list.
- a SELECT listbox with Change and Delete options with the name action might be helpful for editing.
- give the forms some padding between them, and box them. use dashed lines or whatever you like in green or orange or blue or whatever your choice is. float:left will cause the form to make a smaller box. but I don't know if the table is going to allow you to do that.
- don't forget an add form and the ability to process it.

jmichae3
12-07-2010, 09:34 AM
LIMIT 1 should be LIMIT 1 OFFSET 0

$info = mysql_fetch_array($result);
should be
$info = mysql_fetch_assoc($result);
if you want to use named rather than numbered variables like $info['FirstName']

I will post proper code for you after I have edited it.

oh, also, you should make your editor work in pages rather then all on one page. if you have a huge number of people, you are going to bog down the browser and make the user miserable trying to look through it.



make sure you free $result after you are done with it:
mysql_free_result($result);

jmichae3
12-07-2010, 10:05 AM
php POST and GET fields are no longer available as regular variables.
the <?php tag is lowercase, although the case may not matter...

here is my version of the corrected code for a one-off form.
all you have to do, is make sure that $id is an integer. I think you do something like $id=intval($id);
[code]<?php
$dblink = mysql_connect("server", "user", "password");
mysql_select_db("members", $dblink);
//from this point on, you can share $dblink across your PHP files.
//you can stick the above 2 lines in a php include file.
$query = "SELECT * FROM `tblMembers` WHERE member_id='".intval($id)."'";
$result = mysql_query($query, $dblink);
if($result){
$info = mysql_fetch_assoc($result);
}
?>
<form id="form1" name="form1" method="post" action="something.php">
<table width="49%" border="0" align="center">
<td width="35%"></td>
<tr>
<td>Member No</td>
<td><input name="member_id" type="text" id="member_id" value="<?php echo $_POST['member_id']; ?>"/></td>
</tr>
<tr>
<td>First Name</td>

<td><input name="FirstName" type="text" id="FirstName" value="<?php echo $_POST['FirstName']; ?>" maxlength="200" /></td>
</tr>
<tr>
<td>Surname</td>

<td><input name="Surname" type="text" id="Surname" value="<?php echo $_POST['Surname']; ?>" maxlength="200" /></td>
<tr>
<td>Role</td>

<td><input name="Role" type="text" id="Role" value="<?php echo $_POST['Role']; ?>"/></td>
<tr>
<td>Address</td>

<td><input name="Address1" type="text" id="Address1" value="<?php echo $_POST['Address1']; ?>" maxlength="200" /></td>
</tr>
<td></td>
<td><input name="Address2" type="text" id="Address2" value="<?php echo $_POST['Address2']; ?>" maxlength="200" /></td>
</tr>
<td></td>
<td><input name="Address3" type="text" id="Address3" value="<?php echo $_POST['']; ?>Address3" maxlength="200" /></td>
</tr>
<td></td>
<td><input name="Address4" type="text" id="Address4" value="<?php echo $_POST['Address4']; ?>" maxlength="200" /></td>
</tr>
<td>Post Code</td>

<td><input name="PostCode" type="text" id="PostCode" value="<?php echo $_POST['PostCode']; ?>" maxlength="30" /></td>
</tr>
<td>Telephone</td>

<td><input name="Telephone" type="text" id="Telephone" value="<?php echo $_POST['Telephone']; ?>" maxlength="60" /></td>
</tr>
<td>email</td>

<td><input name="email" type="text" id="email" value="<?php echo $_POST['']; ?>" maxlength="65" /></td>
</tr>
</tr>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form></p></td> </tr></table></td> </tr></table></td> </tr></table>
<?php
}
mysql_free_result($result);
?>


sorry, I was thinking you were trying to have multiple forms on one page. that is doable. I have done it.

email addresses, according to the RFC, are 64 characters long. due to browser off-by-one-error, you have to set maxlength to 65.

some names can be very long. one man, named dave obie for short, has a very long name.