Darkmatter5 Posted May 22, 2008 Share Posted May 22, 2008 If I have this item <form method="post"> <table border="0"> <tr> <td>First name:</td> <td><div align='center'><input name="FirstName" type='text' id="FirstName" /></div></td> </tr> </table> </form> in my page and then I have another form which consists of the following code. <form method="post"> <table width="770" border="0"> <tr> <td><div align='center'><input name='editclient' type='submit' id='editclient' value='Store new client data' /></div></td> <td width="140"><div align="right">Function Status =></div></td> <td width="344"><div class="style2"> <?php if(isset($_POST['editclient'])) { include 'library/dbconfig.php'; include 'library/opendb.php'; $fields=array("ClientID","FirstName","LastName","CompanyName","ContactTitle","Address","City","State","ZipCode","HomePhone","WorkPhone","WorkPhoneExtension","FaxPhone","Email"); for($i=0; $i<=13; $i++) { if(isset($_POST['$fields[$i]'])) mysql_query("UPDATE INTO byrnjobdb.clients SET $fields[$i]=$_POST['$fields[$i]'] WHERE $fields[0]=$_POST['$fields[0]']"); if(empty($_POST['$fields[3]'])) echo $_POST['$fields[2]']. ", " . $_POST['$fields[1]']. " updated!"; else echo $_POST['$fields[2]']. ", " .$_POST['$fields[1]']. " of " .$_POST['$fields[3]']. " updated!"; include 'library/closedb.php'; } ?> </div></td> </tr> </table> </form> How do I call the FirstName item in the first table from the "Store new client data" button you click? Right now as it is, it always gives me the output of " , updated!" regardless if I leave FirstName blank or enter something in there. Help please! Link to comment https://forums.phpfreaks.com/topic/106829-calling-a-form-item-from-another-form/ Share on other sites More sharing options...
micmania1 Posted May 22, 2008 Share Posted May 22, 2008 It's not possible without javascript. I suggest a more structured approach to your html output. Link to comment https://forums.phpfreaks.com/topic/106829-calling-a-form-item-from-another-form/#findComment-547682 Share on other sites More sharing options...
nloding Posted May 22, 2008 Share Posted May 22, 2008 I don't understand the question. Are these two forms on the same page? Neither form has an action (the page it sends the data to) -- what page does the processing of the forms? It appears the form page itself does. Why do you have two separate forms? Why not just make them both one form? Link to comment https://forums.phpfreaks.com/topic/106829-calling-a-form-item-from-another-form/#findComment-547683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.