Lorinda
11-09-2012, 10:12 AM
Good Morning,
I have a huge problem with some code in my site. I am creating a "Managers Login page" where the Head of the dept can allocate certain jobs to an specific user. I want the manager to complete the form and the system should send the form and hyperlink to the Dept Head.
Here is the Form in HTML: :eek:
<!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"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><style type="text/css"><!--body {background-image: url(SDM.png);background-color: #000;background-repeat: repeat-x;}.grey strong {color: #C0C0C0;}.Grey {color: #C0C0C0;}Grey {color: #C0C0C0;}--></style></head><body><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><form name="manspecification" action="post7.php" method="post"> <table align="center"> <td align="center"> <tr> <td height="25" colspan="2" align="center" valign="middle"><h1 class="grey"><strong>Specifications</strong></h1> <tr> <td class="grey "><p class="Grey"> Allocated to User: <td><select name="alloc"> <option value="s">MHAS002 - AS</option> <option value="t">MHMS004 - MS</option> <option value="u">MHMN005 - MM</option> <option value="v">MHMW005 - MVW</option> <option value="w">MHGC001 - GC</option> <option value="x">MHGK002 - GDP</option> <option value="y">MHLW009 - LW</option> <option value="z">MHZP001 - ZP</option> </select> <tr><td><tr> <td class="grey"><p class="Grey">Allocated By: <td><select name="allocby"> <option value="a">LM</option> <option value="b">User</option> <option value="c">Other</option> </select> <tr><td><tr> <td class="grey"><p> <span class="Grey">Specification Information:</span>: <td> <label> <textarea name="specification" cols="75" rows="9" id="type"></textarea> </label> <tr><td> <tr> <td class="grey"><p class="Grey"> Request number:<td><input name="reqno" type="text"> <span class="Grey">A value is required.</span> <tr><td> <tr> <td class="Grey"> Scheme: <td><span class="Grey" id="sprytextfield3"> <input name="scheme" type="text" id="scheme" value="Medihelp"> A value is required</span> <tr><td> <tr> <td class="Grey"><p>Date Received: <td><span class="Grey" id="fromtime"> <input name="fromtime" type="text" value="yyyy/mm/dd 00:00:00"> A value is required</span> <tr> <td class="Grey"><p> Date Sent to User:<td class="Grey"><span id="sprytextfield2"> <input name="totime" type="text" value="yyyy/mm/dd 00:00:00"> A value is required</span><tr> <td class="Grey"><p class="Grey">Target Date :<td><span class="Grey"> <input name="targetdate" type="text" value="yyyy/mm/dd 00:00:00" /> A value is required</span><tr> <td class="grey"><p class="Grey"> Comments: <td><textarea name="comments" cols="75" rows="7" id="comments"></textarea> <tr> <td><p> <p> <input type="submit" value="Send"> <input name="Reset" type="reset" value="Clear"> </table></body></html>
and Now the PHP code: :eek:
<?php$conn = mysql_connect("localhost","root","root");$db = mysql_select_db("mysql",$conn);?><?php$alloc = $_POST["alloc"];$allocby = $_POST["allocby"];$specification = $_POST["specification"];$reqno = $_POST["reqno"];$scheme = $_POST["scheme"];$fromtime = $_POST["fromtime"];$totime = $_POST["totime"];$targetdate = $_POST["targetdate"];$comments = $_POST["comments"];if($alloc == "s"){$alloc = 'MHAS002 - AS';}else if ($alloc == "t"){$alloc = 'MHMS004 - MS';}else if ($alloc == "u"){$alloc = 'MHMN005 - MM';}else if ($alloc =="v"){$alloc = 'MHMW005 - MVW';}else if ($alloc == "w"){$alloc = 'MHGC001 - GC';}else if ($alloc == "x"){$alloc = 'MHGK002 - GDP';}else if ($alloc == "y"){$alloc = 'MHLW009 - LW';}else if ($alloc == "z"){$alloc = 'MHZP001 - ZP';};if($allocby == "a"){$allocby = 'LM';}else if ($allocby == "b"){$allocby = 'User';}else if ($allocby == "c"){$allocby = 'Other';};$sql = "INSERT into manspecification values('$alloc','$allocby','$specification','$reqno','$scheme','$fromtime','$totime','$targetdate',' $comments')";$query = mysql_query($sql);if(!$query) echo mysql_error();else{ echo "Successfully Inserted<br />"; }?><p> </p><table border="0" cellspacing="0" cellpadding="3"><tr><td>Allocated To:<td><?=$alloc?><tr><td>Allocated By:<td><?=$allocby?><tr><td>Spec Info:<td><?=$type?><tr><Td>Request No:<td><?=$reqno?><tr><td>Scheme:<td><?=$scheme?><tr><td>From Time:<td><?=$fromtime?><tr><td>To Time:<td><?=$totime?><tr><td>Target Date:<td><?=$targetdate?><tr><td>Comments:<td><?=$comments?><td><td></td></table></form><p><A HREF="/manspesifications.html" target="_self"><strong>Go back</strong></A></p></body></html>
wil anybody be able to assist me with this ? I have been struggling for a long time now?
Please let me know if you can.
P.S I am fairly new at PHP coding....:D
Thanking you in advance.:thumbsup:
I have a huge problem with some code in my site. I am creating a "Managers Login page" where the Head of the dept can allocate certain jobs to an specific user. I want the manager to complete the form and the system should send the form and hyperlink to the Dept Head.
Here is the Form in HTML: :eek:
<!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"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><style type="text/css"><!--body {background-image: url(SDM.png);background-color: #000;background-repeat: repeat-x;}.grey strong {color: #C0C0C0;}.Grey {color: #C0C0C0;}Grey {color: #C0C0C0;}--></style></head><body><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><form name="manspecification" action="post7.php" method="post"> <table align="center"> <td align="center"> <tr> <td height="25" colspan="2" align="center" valign="middle"><h1 class="grey"><strong>Specifications</strong></h1> <tr> <td class="grey "><p class="Grey"> Allocated to User: <td><select name="alloc"> <option value="s">MHAS002 - AS</option> <option value="t">MHMS004 - MS</option> <option value="u">MHMN005 - MM</option> <option value="v">MHMW005 - MVW</option> <option value="w">MHGC001 - GC</option> <option value="x">MHGK002 - GDP</option> <option value="y">MHLW009 - LW</option> <option value="z">MHZP001 - ZP</option> </select> <tr><td><tr> <td class="grey"><p class="Grey">Allocated By: <td><select name="allocby"> <option value="a">LM</option> <option value="b">User</option> <option value="c">Other</option> </select> <tr><td><tr> <td class="grey"><p> <span class="Grey">Specification Information:</span>: <td> <label> <textarea name="specification" cols="75" rows="9" id="type"></textarea> </label> <tr><td> <tr> <td class="grey"><p class="Grey"> Request number:<td><input name="reqno" type="text"> <span class="Grey">A value is required.</span> <tr><td> <tr> <td class="Grey"> Scheme: <td><span class="Grey" id="sprytextfield3"> <input name="scheme" type="text" id="scheme" value="Medihelp"> A value is required</span> <tr><td> <tr> <td class="Grey"><p>Date Received: <td><span class="Grey" id="fromtime"> <input name="fromtime" type="text" value="yyyy/mm/dd 00:00:00"> A value is required</span> <tr> <td class="Grey"><p> Date Sent to User:<td class="Grey"><span id="sprytextfield2"> <input name="totime" type="text" value="yyyy/mm/dd 00:00:00"> A value is required</span><tr> <td class="Grey"><p class="Grey">Target Date :<td><span class="Grey"> <input name="targetdate" type="text" value="yyyy/mm/dd 00:00:00" /> A value is required</span><tr> <td class="grey"><p class="Grey"> Comments: <td><textarea name="comments" cols="75" rows="7" id="comments"></textarea> <tr> <td><p> <p> <input type="submit" value="Send"> <input name="Reset" type="reset" value="Clear"> </table></body></html>
and Now the PHP code: :eek:
<?php$conn = mysql_connect("localhost","root","root");$db = mysql_select_db("mysql",$conn);?><?php$alloc = $_POST["alloc"];$allocby = $_POST["allocby"];$specification = $_POST["specification"];$reqno = $_POST["reqno"];$scheme = $_POST["scheme"];$fromtime = $_POST["fromtime"];$totime = $_POST["totime"];$targetdate = $_POST["targetdate"];$comments = $_POST["comments"];if($alloc == "s"){$alloc = 'MHAS002 - AS';}else if ($alloc == "t"){$alloc = 'MHMS004 - MS';}else if ($alloc == "u"){$alloc = 'MHMN005 - MM';}else if ($alloc =="v"){$alloc = 'MHMW005 - MVW';}else if ($alloc == "w"){$alloc = 'MHGC001 - GC';}else if ($alloc == "x"){$alloc = 'MHGK002 - GDP';}else if ($alloc == "y"){$alloc = 'MHLW009 - LW';}else if ($alloc == "z"){$alloc = 'MHZP001 - ZP';};if($allocby == "a"){$allocby = 'LM';}else if ($allocby == "b"){$allocby = 'User';}else if ($allocby == "c"){$allocby = 'Other';};$sql = "INSERT into manspecification values('$alloc','$allocby','$specification','$reqno','$scheme','$fromtime','$totime','$targetdate',' $comments')";$query = mysql_query($sql);if(!$query) echo mysql_error();else{ echo "Successfully Inserted<br />"; }?><p> </p><table border="0" cellspacing="0" cellpadding="3"><tr><td>Allocated To:<td><?=$alloc?><tr><td>Allocated By:<td><?=$allocby?><tr><td>Spec Info:<td><?=$type?><tr><Td>Request No:<td><?=$reqno?><tr><td>Scheme:<td><?=$scheme?><tr><td>From Time:<td><?=$fromtime?><tr><td>To Time:<td><?=$totime?><tr><td>Target Date:<td><?=$targetdate?><tr><td>Comments:<td><?=$comments?><td><td></td></table></form><p><A HREF="/manspesifications.html" target="_self"><strong>Go back</strong></A></p></body></html>
wil anybody be able to assist me with this ? I have been struggling for a long time now?
Please let me know if you can.
P.S I am fairly new at PHP coding....:D
Thanking you in advance.:thumbsup: