Hi,
I am trying to implement a customer records page, where you can modify and save the changes on one page. What I am trying to do is, post a action using a link (or better button) and then execute a function depending on the action posted.
My code is as follow.
$action = $_GET["action"];
switch ($action){
case "addnew";
func_add_new_record();
break;
case "apply":
mysql_query("UPDATE users SET ........... ") or die(mysql_error());
break;
case "delete":
mysql_query(not done yet) or die(mysql_error());
break;
my problem is........ if you haven't already guessed is that, how to I grab the values from my form and pass them to my switch statement. I grab the value from my action, but I have no way to extract the text from the fields of the form.
my form looks like
<form name="main_form" method="post" action="">
<table border="0">
<tr>
<td width="90">User ID</td>
<td width="300"><input name="userid" type="text" disabled="disabled" id="userid" value="<?=$user_id?>" /></td>
<td width="90">Address</td>
<td width="250" rowspan="4"><textarea name="address" rows="5" id="address"><?=$address?>
</textarea></td>
</tr>
<tr>
<td>Name</td>
<td width="300"><input name="name" type="text" id="name" value="<?=$fullname?>" maxlength="30" width="200"/></td>
<td> </td>
</tr>
<tr>
<td>User Level</td>
<td width="300">
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td width="300"> </td>
<td> </td>
</tr>
<tr>
<td height="10">Tel</td>
<td width="300" height="10">
<input name="tel" type="text" id="tel value=" value="<?=$contact_no?>" maxlength="20" /></td>
<td height="10">Post Code</td>
<td width="250" height="10"><input name="post_code" type="text" id="post_code" value="<?=$postcode?>" /></td>
</tr>
<tr>
<td width="90" height="10">Mobile</td>
<td width="300" height="10"><input name="mobile" type="text" id="mobile" value="<?=$mobile_no?>" maxlength="20" /></td>
<td width="90" height="10"> </td>
<td width="250" height="10"> </td>
</tr>
<td width="90"> </td>
<td width="300"> </td>
<td width="90">Login Name</td>
<td width="250"><input name="user_login" type="text" id="user_login" value="<?php echo $user_login;?>" /></td>
</tr>
<tr>
<td width="90">Email</td>
<td width="300"><input name="email" type="text" id="email" value="<?=$email?>" maxlength="50" width="200"/></td>
<td width="90">Password</td>
<td width="250"><input name="password" type="text" id="password" value="<?php echo $password;?>" /></td>
</tr>
</table>
and my links are also in the form
<table width="50" border="0" align="right">
<tr align="center">
<td><a href="?action=addnew">Add</a></td>
<td><a href="?uid=<?=$uid?>&action=apply">Apply</a></td>
</tr>
<tr align="center">
<td><input type="reset" name="cancel" id="cancel" value="Cancel" /></td>
<td><input type="submit" name="back" id="back" value="Back" onClick="history.go(-1)"/></td>
</tr>
</table>/form>
any help would be appriciated. im really stuck and i need to get this done asap.
thanks in advance, but i will also thank again.
gaf.