Posted By

ryarwood on 07/20/10


Tagged

form edit php process


Versions (?)

Simple Edit Page PHP


 / Published in: PHP
 

  1. <?php require 'config.php'; ?>
  2.  
  3. <?php
  4. # | $Id$
  5.  
  6. if(!session_is_registered(myusername)){
  7. header("location:index.php");
  8. }
  9.  
  10. # | db connection
  11.  
  12. $idNumerial = $_GET['idNum'];
  13.  
  14. $con = mysql_connect("$p11server","$p11username","$p11password");
  15. if (!$con)
  16. {
  17. die('Could not connect: ' . mysql_error());
  18. }
  19.  
  20. mysql_select_db("$p11database", $con);
  21.  
  22. $sql="SELECT * FROM contacts Where idNum = $idNumerial";
  23. $result=mysql_query($sql);
  24. $num=mysql_numrows($result);
  25.  
  26. if (!mysql_query($sql,$con)) {
  27. die('Error: ' . mysql_error());
  28. }
  29.  
  30.  
  31. $i = 0;
  32.  
  33. $idNum=mysql_result($result,$i,"idNum");
  34. $submitDate=mysql_result($result,$i,"submitDate");
  35. $firstName=mysql_result($result,$i,"firstName");
  36. $lastName=mysql_result($result,$i,"lastName");
  37. $title=mysql_result($result,$i,"title");
  38. $email=mysql_result($result,$i,"email");
  39. $occupation=mysql_result($result,$i,"occupation");
  40.  
  41. ?>
  42.  
  43. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  44. <html>
  45. <head>
  46. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  47. <title><?php echo($p11pagename); ?> List Manager | Edit Contact</title>
  48. <link href="includes/list.css" rel="stylesheet" type="text/css">
  49. <script type="text/javascript" src="includes/scripts.js"></script>
  50. </head>
  51.  
  52. <body onLoad="MM_preloadImages('images/add.gif','images/delete.gif','images/edit.gif','images/stats.gif','images/logout.gif');">
  53. <div id="outerContainerSmall">
  54.  
  55. <div id="newHeaderSkinny">
  56. <div id="logo"><img src="images/globallogo.gif" width="250" height="75" /></div>
  57. <div id="pageTitleSkinny">
  58. <h1>Edit Contact</h1></div>
  59. </div>
  60.  
  61. <form action="editcontact.php" method="post" name="htmlEmail" id="htmlEmail">
  62. <input name="idNum" type="hidden" value="<?php echo($idNum) ?>">
  63. <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
  64. <tr>
  65. <td><table border="0" align="center" cellpadding="0" cellspacing="0">
  66. <tr>
  67. <td width="100">First Name</td>
  68. <td><input name="firstName" type="text" class="textFieldStyle" id="firstName" alt="First Name" value="<?php echo($firstName); ?>"></td>
  69. </tr>
  70. <tr>
  71. <td colspan="2"><img src="images/spacer.gif" width="10" height="10"></td>
  72. </tr>
  73. <tr>
  74. <td>Last Name</td>
  75. <td><input name="lastName" type="text" class="textFieldStyle" id="lastName" alt="Last Name" value="<?php echo($lastName); ?>"></td>
  76. </tr>
  77. <tr>
  78. <td colspan="2"><img src="images/spacer.gif" width="10" height="10"></td>
  79. </tr>
  80. <tr>
  81. <td>Email</td>
  82. <td><input name="email" type="text" class="textFieldStyle" id="email" value="<?php echo($email); ?>" alt="Phone"></td>
  83. </tr>
  84. <tr>
  85. <td colspan="2"><img src="images/spacer.gif" width="10" height="10"></td>
  86. </tr>
  87. <tr>
  88. <td>Title</td>
  89. <td><input name="title" type="text" class="textFieldStyle" id="title" value="<?php echo($title); ?>"></td>
  90. </tr>
  91. <tr>
  92. <td colspan="2"><img src="images/spacer.gif" width="10" height="10"></td>
  93. </tr>
  94. <tr>
  95. <td>Occupation</td>
  96. <td><input name="occupation" type="text" class="textFieldStyle" id="occupation" value="<?php echo($occupation); ?>"></td>
  97. </tr>
  98. </table></td>
  99. </tr>
  100.  
  101. <tr>
  102. <td><img src="images/spacer.gif" width="10" height="20"></td>
  103. </tr>
  104. <tr>
  105. <td align="center"><input name="imageField" type="image" id="imageField" onClick="MM_validateForm('firstName','','R','lastName','','R','phone','','R','email','','R');return document.MM_returnValue" src="images/update.gif">
  106. <a href="main.php"><img src="images/cancel.gif" alt="Cancel - Back to Main" width="173" height="28" class="buttonSpacer"></a> </td>
  107. </tr>
  108. </table>
  109. </form>
  110. </div>
  111. </body>
  112. </html>

Report this snippet  

You need to login to post a comment.