tagert123 Posted October 29, 2007 Share Posted October 29, 2007 Hi there I need some help as i have recently changed my server for another one that has register globals switched off. So now i'd need some help in changing my form for entering/editing/deleting data from a mysql database. I will post my whole code bellow but not need someone to change the whole code for me but just to show me a few example of how i am to do this. Thnx in advance. <?php ini_set("display_errors", 1); error_reporting(2048); $db = mysql_connect("localhost", "dbuser", "dbpass") or die("Could not connect to the database"); mysql_select_db("dbname",$db) or die("Could not select the database"); if ($submit) { // here if no ID then adding else we're editing if ($id) { $sql = "UPDATE profile SET name='$name',name2='$name2',backgroundimage='$backgroundimage',listassignement='$listassignement',listassignement2='$listassignement2',listposition='$listposition',listposition2='$listposition2',rank_image='$rank_image', medal_image='$medal_image', rank='$rank', species='$species', birthplace='$birthplace', current_posting='$current_posting', qualification='$qualification', age='$age', sex='$sex', dob='$dob', appearance='$appearance',history='$history', background='$background', service_record='$service_record', commendations='$commendations', reprimands='$reprimands', med_record='$med_record', interests='$interests', added_notes='$added_notes', picture='$picture', type='$type' WHERE id=$id"; echo $sql; } else { $sql = "INSERT INTO {b13_1129628_test}profile (name,name2,listassignement,backgroundimage,listassignement2,listposition,listposition2,rank_image,medal_image,rank,species,birthplace,current_posting,qualification,age,sex,dob,appearance,history,background,service_record,commendations,reprimands,med_record,interests,added_notes,picture,type) VALUES ('$name','$name2','$backgroundimage','$listassignement','$listassignement2','$listposition','$listposition2','$rank_image','$medal_image','$rank','$species','$birthplace','$current_posting','$qualification','$age','$sex','$dob','$appearance','$history','$background','$service_record','$commendations','$reprimands','$med_record','$interests','$added_notes','$picture','$type')"; } // run SQL against the DB $result = mysql_query($sql) or die(mysql_error()); echo "Record updated/edited!<p>"; } elseif ($delete) { // delete a record $sql = "DELETE FROM profile WHERE id=$id"; $result = mysql_query($sql); echo "$sql Record deleted!<p>"; } else { // this part happens if we don't press submit if (!$id) { // print the list if there is not editing $result = mysql_query("SELECT * FROM profile ORDER BY name",$db); while ($myrow = mysql_fetch_array($result)) { printf("<a href=\"%s?id=%s\">%s %s</a> \n", $PHP_SELF, $myrow["id"], $myrow["name"], $myrow["rank"]); printf("<a href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>", $PHP_SELF, $myrow["id"]); } } ?> <P> <a href="<?php echo $PHP_SELF?>">ADD A RECORD</a> <P> <form method="post" action="<?php echo $PHP_SELF?>"> <?php if ($id) { // editing so select a record $sql = "SELECT * FROM profile WHERE id=$id"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); $id = $myrow["id"]; $backgroundimage = $myrow["backgroundimage"]; $name = $myrow["name"]; $name2 = $myrow["name2"]; $listassignement = $myrow["listassignement"]; $listassignement2 = $myrow["listassignement2"]; $listposition = $myrow["listposition"]; $listposition2 = $myrow["listposition2"]; $rank_image = $myrow["rank_image"]; $medal_image = $myrow["medal_image"]; $rank = $myrow["rank"]; $species = $myrow["species"]; $birthplace = $myrow["birthplace"]; $current_posting = $myrow["current_posting"]; $qualification = $myrow["qualification"]; $age = $myrow["age"]; $sex = $myrow["sex"]; $dob = $myrow["dob"]; $appearance = $myrow["appearance"]; $history = $myrow["history"]; $background = $myrow["background"]; $service_record = $myrow["service_record"]; $commendations = $myrow["commendations"]; $reprimands = $myrow["reprimands"]; $med_record = $myrow["med_record"]; $interests = $myrow["interests"]; $added_notes = $myrow["added_notes"]; $picture = $myrow["picture"]; $type = $myrow["type"]; // print the id for editing ?> <input type=hidden name="id" value="<?php echo $id ?>"> <?php } ?> <p>Select here if the person is active (assigned to a ship/starbase or any other active simming position) or inactive (trivia only, unassigned) or a cadet (in training at the Academy only)<p> <?php $po[1][0] = "active"; $po[1][1] = "Active Simming Member"; $po[2][0] = "inactive"; $po[2][1] = "Trivia Only/Unassigned"; $po[3][0] = "cadet"; // added by Elron 04-06-07 $po[3][1] = "Cadet Training at Academy"; // added by Elron 04-06-07 echo "<select name=\"type\">"; foreach ($po as $po1) { // for testing purposes to see what is in $v1 //print_r($v1); // comment out when all is working fine echo "<option value='" . $po1[0] . "'" ; // where is $listposition coming from? if ($po1[0] == $type) { echo " selected "; } echo ">".$po1[1]."</option>"; } echo "</select>"; ?> <br> <p><b><h2>The following 3 options refer to the settings on the positions page:</h2></b> </p> <br><br> <p>Link of the vessel on which the person is serving. Choose the link from the drop down box:</p> <br> <br> <?php $c[1][0] = "fleet/starbase47.php"; $c[1][1] = "Starbase 47.php"; $c[2][0] = "fleet/Assaillant47.php"; $c[2][1] = "Starbase Assaillant.php"; $c[3][0] = "fleet/tigershark.php"; $c[3][1] = "Tiger Shark.php"; $c[4][0] = "fleet/elsalvador.php"; $c[4][1] = "El Salvador.php"; $c[5][0] = "fleet/victory.php"; $c[5][1] = "Victory.php"; $c[6][0] = "fleet/nevada.php"; $c[6][1] = "Nevada.php"; $c[7][0] = "fleet/scavenger.php"; $c[7][1] = "Scavenger.php"; $c[8][0] = "fleet/jefferson.php"; $c[8][1] = "Jefferson.php"; $c[9][0] = "fleet/sbbellicose.php"; $c[9][1] = "Starbase Bellicose.php"; $c[10][0] = "fleet/blacktulip.php"; $c[10][1] = "Black Tulip.php"; $c[11][0] = "fleet/vesuvius.php"; $c[11][1] = "Vesuvius.php"; $c[12][0] = "fleet/raven.php"; $c[12][1] = "Raven.php"; $c[13][0] = "fleet/majesty.php"; $c[13][1] = "Majesty.php"; $c[14][0] = "fleet/olympia.php"; $c[14][1] = "Olympia.php"; $c[15][0] = "fleet/excalibur.php"; $c[15][1] = "Excalibur.php"; $c[16][0] = "fleet/challenger.php"; $c[16][1] = "Challenger.php"; $c[17][0] = "fleet/colombia.php"; $c[17][1] = "Colombia.php"; $c[18][0] = "academy/officerslounge.php"; $c[18][1] = "Starbase Conqueror.php"; $c[19][0] = "fleet/hepta.php"; $c[19][1] = "Hepta.php"; $c[20][0] = "fleet/hanson.php"; $c[20][1] = "Hanson.php"; $c[21][0] = "fleet/hope.php"; $c[21][1] = "Hope.php"; $c[22][0] = "ranksInactive.php"; $c[22][1] = "Trivia Only.php"; $c[23][0] = "req.php"; $c[23][1] = "Unassigned.php"; echo "<select name=\"listassignement\">"; foreach ($c as $cc1) { // for testing purposes to see what is in $v1 //print_r($v1); // comment out when all is working fine echo "<option value='" . $cc1[0] . "'" ; // where is $listposition coming from? if ($cc1[0] == $listassignement) { echo " selected "; } echo ">".$cc1[1]."</option>"; } echo "</select>"; ?> <br><br><br> <p>Name of the ship/starbase the person is serving on. Please choose from the drop-down menu. (Note: choose Starbase Conqueror for officers assigned to the base and for cadets awaiting assignment; for cadets currently assigned to a training mission choose the appropriate Academy ship).</p> <br><br> <?php $d[1][0] = "Starbase 47"; $d[1][1] = "Starbase 47"; $d[2][0] = "Starbase Assaillant"; $d[2][1] = "Starbase Assaillant"; $d[3][0] = "USS Tiger Shark"; $d[3][1] = "Tiger Shark"; $d[4][0] = "USS El Salvador"; $d[4][1] = "El Salvador"; $d[5][0] = "USS Victory"; $d[5][1] = "Victory"; $d[6][0] = "USS Nevada"; $d[6][1] = "Nevada"; $d[7][0] = "USS Scavenger"; $d[7][1] = "Scavenger"; $d[8][0] = "USS Jefferson"; $d[8][1] = "Jefferson"; $d[9][0] = "Starbase Bellicose"; $d[9][1] = "Starbase Bellicose"; $d[10][0] = "USS Black Tulip"; $d[10][1] = "Black Tulip"; $d[11][0] = "USS Vesuvius"; $d[11][1] = "Vesuvius"; $d[12][0] = "USS Raven"; $d[12][1] = "Raven"; $d[13][0] = "USS Majesty"; $d[13][1] = "Majesty"; $d[14][0] = "USS Olympia"; $d[14][1] = "Olympia"; $d[15][0] = "USS Excalibur"; $d[15][1] = "Excalibur"; $d[16][0] = "Challenger"; $d[16][1] = "Challenger"; $d[17][0] = "Colombia"; $d[17][1] = "Colombia"; $d[18][0] = "Starbase Conqueror"; $d[18][1] = "Starbase Conqueror"; $d[19][0] = "USS Hepta"; $d[19][1] = "Hepta"; $d[20][0] = "USS Hanson"; $d[20][1] = "Hanson"; $d[21][0] = "USS Hope"; $d[21][1] = "Hope"; $d[22][0] = "Trivia Only"; $d[22][1] = "Trivia Only"; $d[23][0] = "Unassigned"; $d[23][1] = "Unassigned"; echo "<select name=\"listassignement2\">"; foreach ($d as $dd1) { // for testing purposes to see what is in $v1 //print_r($v1); // comment out when all is working fine echo "<option value='" . $dd1[0] . "'" ; // where is $listposition coming from? if ($dd1[0] == $listassignement2) { echo " selected "; } echo ">".$dd1[1]."</option>"; } echo "</select>"; ?> <br><br><br> <p>Position for the positions page. Choose the position from the drop down list.:</p><br><br> <?php // THIS IS YOUR ARRAY $a[0][0] = "CO"; $a[0][1] = "Commanding Officer"; $a[1][0] = "FO"; $a[1][1] = "First Officer"; $a[2][0] = "CTSO"; $a[2][1] = "Chief Tactical/Security Officer"; $a[3][0] = "SMO"; $a[3][1] = "Senior Marine Officer"; $a[4][0] = "CEO"; $a[4][1] = "Chief Engineering Officer"; $a[5][0] = "COO"; $a[5][1] = "Chief Operations Officer"; $a[6][0] = "CNO"; $a[6][1] = "Chief Navigation Officer (conn)"; $a[7][0] = "CScO"; $a[7][1] = "Chief Science Officer"; $a[8][0] = "CMO"; $a[8][1] = "Chief Medical Officer"; $a[9][0] = "CNS"; $a[9][1] = "Counsellor"; $a[10][0] = "EXO"; $a[10][1] = "Exobiologist"; $a[11][0] = "MLT"; $a[11][1] = "Medical Lab Tech"; $a[12][0] = "CTO"; $a[12][1] = "Chief Tactical Officer"; $a[13][0] = "CSO"; $a[13][1] = "Chief Security Officer"; $a[14][0] = "Tac"; $a[14][1] = "Tactical Officer"; $a[15][0] = "Sec"; $a[15][1] = "Security Officer"; $a[16][0] = "CIVIL"; $a[16][1] = "Civilian"; $a[17][0] = "ORE"; $a[17][1] = "Omicron Research Engineer"; $a[18][0] = "DCS"; $a[18][1] = "Diplomatic Corps Service"; $a[19][0] = "AMB"; $a[19][1] = "Ambassador"; $a[20][0] = "CSbS"; $a[20][1] = "Chief of Starbase Security"; $a[21][0] = "CSbO"; $a[21][1] = "Chief of Starbase Operations"; $a[22][0] = "ECH"; $a[22][1] = "Emergency Command Hologram"; $a[23][0] = "LiO"; $a[23][1] = "Liaison Officer"; $a[24][0] = "CSOO"; $a[24][1] = "Chief Strategic Operations Officer"; $a[25][0] = "CIO"; $a[25][1] = "Chief Intelligence Officer"; $a[26][0] = "AI"; $a[26][1] = "Academy Instructor"; $a[27][0] = " "; $a[27][1] = "Training in the Academy (position unknown)"; $a[28][0] = "Tac/Sec"; $a[28][1] = "Tactical/Security Cadet in the Academy"; $a[29][0] = "Mar"; $a[29][1] = "Marine Cadet in the Academy"; $a[30][0] = "Eng"; $a[30][1] = "Engineering Cadet in the Academy"; $a[31][0] = "Ops"; $a[31][1] = "Operations Cadet in the Academy"; $a[32][0] = "Nav"; $a[32][1] = "Navigation Cadet in the Academy"; $a[33][0] = "Sci"; $a[33][1] = "Science Cadet in the Academy"; $a[34][0] = "Med"; $a[34][1] = "Medical Cadet in the Academy"; $a[35][0] = "Cns"; $a[35][1] = "Counselling Cadet in the Academy"; $a[36][0] = "CHO"; $a[36][1] = "Chief Helm Officer"; $a[37][0] = "TO"; $a[37][1] = "Trivia Only"; $a[38][0] = "SO"; $a[38][1] = "Second Officer"; $a[39][0] = "FW"; $a[39][1] = "Fighter Wing"; $a[40][0] = "CCO"; $a[40][1] = "Chief Communications Officer"; $a[41][0] = "NS"; $a[41][1] = "Nurse"; $a[42][0] = "CAO"; $a[42][1] = "Chief Armoury Officer"; $a[43][0] = "Acting CO"; $a[43][1] = "Acting Commanding Officer"; $a[44][0] = "Acting FO"; $a[44][1] = "Acting First Officer"; $a[45][0] = "1st Fleet CO"; $a[45][1] = "1st Fleet CO"; $a[46][0] = "2nd Fleet CO"; $a[46][1] = "2nd Fleet CO"; $a[47][0] = "3rd Fleet CO"; $a[47][1] = "3rd Fleet CO"; $a[48][0] = "Sec. JAG"; $a[48][1] = "Sector JAG Officer"; $a[49][0] = "DCS - Director"; $a[49][1] = "DCS - Director"; $a[50][1] = "DCS - Deputy Director"; $a[50][1] = "DCS - Deputy Director"; $a[51][0] = " "; $a[51][1] = "Unassigned"; echo "<select name=\"listposition\">"; foreach ($a as $v1) { // for testing purposes to see what is in $v1 //print_r($v1); // comment out when all is working fine echo "<option value='" . $v1[0] . "'" ; // where is $listposition coming from? if ($v1[0] == $listposition) { echo " selected "; } echo ">".$v1[1]."</option>"; } echo "</select>"; ?> <br><br><br> If the person holds an additional position or holds an Assistant position please enter it into the text box bellow. If it is an assistant position(example Assistant CMO) enter Asst. and be sure to hit space behind the point(Asst. ). If the person holds another position make sure you add a slash behind the position abrevation. Per example if the person is FO and COO, enter COO/ or FO/ depending on which of the two positions you chose in the drop down box above. <br><br><input type="Text" name="listposition2" value="<?php echo $listposition2 ?>"> <br><br><br> Character Name which will be dsplayed on the positions page(when entering a character name make sure you put it in format Last Name, First Name. In cases where there is only 1 name just enter that name):<br><br> <input type="Text" name="name" value="<?php echo $name ?>"> <br><br><br><br> <p><h2>The rest of the options refer to the actual bio.</h2></p> <br><br><br> Background image. Select the background image for the bio. The defaul option stands for the background image used in almost all bios, fancy 1 stands for the background that can be seen in Duke Nova's bio nd fancy 2 stands for the image which can be seen in Drake's bio. <br><br> <?php $p[0][0] = "Default"; $p[0][1] = "laurel ufp background.gif"; $p[1][0] = "Fancy 1"; $p[1][1] = "UFPbackground.jpg"; $p[2][0] = "Fancy 2"; $p[2][1] = "fedback.jpg"; echo "<select name=\"backgroundimage\">"; foreach ($p as $pp1) { // for testing purposes to see what is in $v1 //print_r($v1); // comment out when all is working fine echo "<option value='" . $pp1[1] . "'" ; // where is $listposition coming from? if ($pp1[1] == $backgroundimage) { echo " selected "; } echo ">".$pp1[0]."</option>"; } echo "</select>"; ?> <br><br><br> Character Name which will be displayed in the bio(when entering a character name make sure you put it in format Last Name, First Name. In cases where there is only 1 name just enter that name):<br><br> <input type="Text" name="name2" value="<?php echo $name2 ?>"> <br><br><br> <p>Rank Image. Choose the rank of the person from the drop down box.:</p> <br><br> <?php // THIS IS YOUR ARRAY $b[0][0] = "TOS/toseny1.jpg"; $b[0][1] = "TOS Ensign Yellow"; $b[1][0] = "TOS/tosenr1.jpg"; $b[1][1] = "TOS Ensign Red"; $b[2][0] = "TOS/tosenb1.jpg"; $b[2][1] = "TOS Ensign Teal"; $b[3][0] = "TOS/tosltjgy2.jpg"; $b[3][1] = "TOS Lieutenant Jg. Yellow"; $b[4][0] = "TOS/tosltjgr2.jpg" ; $b[4][1] = "TOS Lieutenant Jg. Red"; $b[5][0] = "TOS/tosltjgb2.jpg"; $b[5][1] = "TOS Lieutenant Jg. Teal"; $b[6][0] = "TOS/toslty3.jpg"; $b[6][1] = "TOS Lieutenant Yellow"; $b[7][0] = "TOS/tosltr3.jpg"; $b[7][1] = "TOS Lieutenant Red"; $b[8][0] = "TOS/tosltb3.jpg"; $b[8][1] = "TOS Lieutenant Teal"; $b[9][0] = "TOS/tosltcy4.jpg" ; $b[9][1] = "TOS Lt. Commander Yellow"; $b[10][0] = "TOS/tosltcr4.jpg" ; $b[10][1] = "TOS Lt. Commander Red"; $b[11][0] = "TOS/tosltcb4.jpg"; $b[11][1] = "TOS Lt. Commander Teal"; $b[12][0] = "TOS/toscmdry5.jpg"; $b[12][1] = "TOS Commander Yellow"; $b[13][0] = "TOS/toscmdrr5.jpg"; $b[13][1] = "TOS Commander Red"; $b[14][0] = "TOS/toscmdrb5.jpg"; $b[14][1] = "TOS Commander Teal"; $b[15][0] = "TOS/toscmdry51st.jpg"; $b[15][1] = "TOS Commander 1st Class Yellow"; $b[16][0] = "TOS/toscmdrr51st.jpg"; $b[16][1] = "TOS Commander 1st Class Red"; $b[17][0] = "TOS/toscmdrb51st.jpg"; $b[17][1] = "TOS Commander 1st Class Teal"; $b[18][0] = "TOS/toscpty6.jpg"; $b[18][1] = "TOS Captain Yellow"; $b[19][0] = "TOS/toscptr6.jpg"; $b[19][1] = "TOS Captain Red"; $b[20][0] = "TOS/toscptb6.jpg"; $b[20][1] = "TOS Captain Teal"; $b[21][0] = "TOS/toscoy8.jpg" ; $b[21][1] = "TOS Commodore Yellow"; $b[22][0] = "TOS/toscor8.jpg"; $b[22][1] = "TOS Commodore Red"; $b[23][0] = "TOS/toscob8.jpg"; $b[23][1] = "TOS Commodore Teal"; $b[24][0] = "TOS/tosya1.jpg"; $b[24][1] = "TOS Rear Admiral"; $b[25][0] = "TOS/tosya2.jpg"; $b[25][1] = "TOS Vice Admiral"; $b[26][0] = "TOS/tosya3.jpg"; $b[26][1] = "TOS Admiral"; $b[27][0] = "TOS/tosya4.jpg"; $b[27][1] = "TOS Fleet Admiral"; $b[28][0] = "TOS/tosya5.jpg"; $b[28][1] = "TOS Commander Star Fleet"; $b[29][0] = "TOS/tosw4.jpg"; $b[29][1] = "TOS Crewman"; $b[30][0] = "TOS/tosw5.jpg"; $b[30][1] = "TOS Petty Officer Second Class"; $b[31][0] = "TOS/tosw6.jpg"; $b[31][1] = "TOS Petty Officer First Class"; $b[32][0] = "TOS/tosw7.jpg"; $b[32][1] = "TOS Chief Petty Officer"; $b[33][0] = "TOS/tosw8.jpg"; $b[33][1] = "TOS Chief Petty Officer First Class"; $b[34][0] = "TOS/tosw9.jpg"; $b[34][1] = "TOS Master Chief Petty Officer"; $b[35][0] = "enterprise/yensign.jpg"; $b[35][1] = "Enterprise Ensign Yellow"; $b[36][0] = "enterprise/rensign.jpg"; $b[36][1] = "Enterprise Ensign Red"; $b[37][0] = "enterprise/tensign.jpg"; $b[37][1] = "Enterprise Ensign Teal"; $b[38][0] = "enterprise/yltjg.jpg"; $b[38][1] = "Enterprise Lieutenant Jg. Yellow"; $b[39][0] = "enterprise/rltjg.jpg"; $b[39][1] = "Enterprise Lieutenant Jg. Red"; $b[40][0] = "enterprise/tltjg.jpg"; $b[40][1] = "Enterprise Lieutenant Jg. Teal"; $b[41][0] = "enterprise/ylt.jpg"; $b[41][1] = "Enterprise Lieutenant Yellow"; $b[42][0] = "enterprise/rlt.jpg"; $b[42][1] = "Enterprise Lieutenant Red"; $b[43][0] = "enterprise/tlt.jpg"; $b[43][1] = "Enterprise Lieutenant Teal"; $b[44][0] = "enterprise/yltcmdr.jpg"; $b[44][1] = "Enterprise Lt. Commander Yellow"; $b[45][0] = "enterprise/rltcmdr.jpg"; $b[45][1] = "Enterprise Lt. Commander Red"; $b[46][0] = "enterprise/tltcmdr.jpg"; $b[46][1] = "Enterprise Lt. Commander Teal"; $b[47][0] = "enterprise/ycmdr.jpg"; $b[47][1] = "Enterprise Commander Yellow"; $b[48][0] = "enterprise/rcmdr.jpg"; $b[48][1] = "Enterprise Commander Red"; $b[49][0] = "enterprise/tcmdr.jpg"; $b[49][1] = "Enterprise Commander Teal"; $b[50][0] = "enterprise/ycmdr1st.jpg"; $b[50][1] = "Enterprise Commander 1st Class Yellow"; $b[51][0] = "enterprise/rcmdr1st.jpg"; $b[51][1] = "Enterprise Commander 1st Class Red"; $b[52][0] = "enterprise/tcmdr1st.jpg"; $b[52][1] = "Enterprise Commander 1st Class Teal"; $b[53][0] = "enterprise/ycpt.jpg"; $b[53][1] = "Enterprise Captain Yellow"; $b[54][0] = "enterprise/rcpt.jpg"; $b[54][1] = "Enterprise Captain Red"; $b[55][0] = "enterprise/tcpt.jpg"; $b[55][1] = "Enterprise Captain Teal"; $b[56][0] = "enterprise/flecpt.jpg"; $b[56][1] = "Enterprise Commodore"; $b[57][0] = "enterprise/flagcomm.jpg"; $b[57][1] = "Enterprise Rear Admiral"; $b[58][0] = "enterprise/flagradm.jpg"; $b[58][1] = "Enterprise Vice Admiral"; $b[59][0] = "enterprise/flagviceadm.jpg"; $b[59][1] = "Enterprise Admiral"; $b[60][0] = "enterprise/flagadm.jpg"; $b[60][1] = "Enterprise Fleet Admiral"; $b[61][0] = "enterprise/flagfadm.jpg"; $b[61][1] = "Enterprise Commander Star Fleet"; $b[62][0] = "enterprise/macoo1.jpg"; $b[62][1] = "Enterprise Marine 2nd Lieutenant"; $b[63][0] = "enterprise/macoo2.jpg"; $b[63][1] = "Enterprise Marine 1st Lieutenant"; $b[64][0] = "enterprise/macoo3.jpg"; $b[64][1] = "Enterprise Marine Captain" ; $b[65][0] = "enterprise/macoo4.jpg"; $b[65][1] = "Enterprise Marine Major"; $b[66][0] = "enterprise/macoo5.jpg"; $b[66][1] = "Enterprise Marine Lieutenant Colonel"; $b[67][0] = "enterprise/macoo51st.jpg"; $b[67][1] = "Enterprise Marine Lieutenant Colonel 1st Class"; $b[68][0] = "enterprise/macoo6.jpg"; $b[68][1] = "Enterprise Marine Colonel"; $b[69][0] = "ensignred.jpg"; $b[69][1] = "Ensign Red"; $b[70][0] = "ensignteal.jpg"; $b[70][1] = "Ensign Teal"; $b[71][0] = "ensignyellow.jpg"; $b[71][1] = "Ensign Yellow"; $b[72][0] = "ensignwhite.jpg"; $b[72][1] = "Ensign White"; $b[73][0] = "ltjgred.jpg"; $b[73][1] = "Lieutenant Jg. Red"; $b[74][0] = "ltjgteal.jpg"; $b[74][1] = "Lieutenant Jg. Teal"; $b[75][0] = "ltjgyellow.jpg"; $b[75][1] = "Lieutenant Jg. Yellow"; $b[76][0] = "ltjgwhite.jpg"; $b[76][1] = "Lieutenant Jg. White"; $b[77][0] = "lieutred.jpg"; $b[77][1] = "Lieutenant Red"; $b[78][0] = "lieutteal.jpg"; $b[78][1] = "Lieutenant Teal"; $b[79][0] = "lieutyellow.jpg"; $b[79][1] = "Lieutenant Yellow"; $b[80][0] = "lieutwhite.jpg"; $b[80][1] = "Lieutenant White"; $b[81][0] = "ltcmdrred.jpg"; $b[81][1] = "Lt. Commander Red"; $b[82][0] = "ltcmdrteal.jpg"; $b[82][1] = "Lt. Commander Teal"; $b[83][0] = "ltcmdryellow.jpg"; $b[83][1] = "Lt. Commander Yellow"; $b[84][0] = "ltcmdrwhite.jpg"; $b[84][1] = "Lt. Commander White"; $b[85][0] = "cmdrred.jpg"; $b[85][1] = "Commander Red"; $b[86][0] = "cmdrteal.jpg"; $b[86][1] = "Commander Teal"; $b[87][0] = "cmdryellow.jpg"; $b[87][1] = "Commander Yellow"; $b[88][0] = "cmdrwhite.jpg"; $b[88][1] = "Commander White"; $b[89][0] = "cmdr1red.jpg"; $b[89][1] = "Commander 1st Class Red"; $b[90][0] = "cmdr1teal.jpg"; $b[90][1] = "Commander 1st Class Teal"; $b[91][0] = "cmdr1yellow.jpg"; $b[91][1] = "Commander 1st Class Yellow"; $b[92][0] = "cmdr1white.jpg"; $b[92][1] = "Commander 1st Class White"; $b[93][0] = "captainred.jpg"; $b[93][1] = "Captain Red"; $b[94][0] = "captainwhite.jpg" ; $b[94][1] = "Captain White"; $b[95][0] = "commodore.jpg" ; $b[95][1] = "Commodore Red"; $b[96][0] = "commodorewhite.jpg" ; $b[96][1] = "Commodore White"; $b[97][0] = "rearadm.jpg"; $b[97][1] = "Rear Admiral Red"; $b[98][0] = "rearadmwhite.jpg" ; $b[98][1] = "Rear Admiral White"; $b[99][0] = "viceadm.jpg" ; $b[99][1] = "Vice Admiral Red"; $b[100][0] = "viceadm.jpg"; $b[100][1] = "Vice Admiral White"; $b[101][0] = "admiral.jpg"; $b[101][1] = "Admiral Red"; $b[102][0] = "admiralwhite.jpg"; $b[102][1] = "Admiral White"; $b[103][0] = "fleetadm.jpg"; $b[103][1] = "Fleet Admiral Red"; $b[104][0] = "fleetadmwhite.jpg"; $b[104][1] = "Fleet Admiral White"; $b[105][0] = "sectadm.jpg"; $b[105][1] = "Section Admiral Red"; $b[106][0] = "sectadmwhite.jpg"; $b[106][1] = "Section Admiral White"; $b[107][0] = "m2ndlt.jpg"; $b[107][1] = "Marine 2nd Lieutenant"; $b[108][0] = "m1stlt.jpg"; $b[108][1] = "Marine 1st Lieutenant"; $b[109][0] = "mcapt.jpg"; $b[109][1] = "Marine Captain"; $b[110][0] = "major.jpg"; $b[110][1] = "Marine Major"; $b[111][0] = "mltcol.jpg"; $b[111][1] = "Marine Lieutenant Colonel"; $b[112][0] = "mcol.jpg"; $b[112][1] = "Marine Lieutenant Colonel 1st Class"; $b[113][0] = "mfcol.jpg"; $b[113][1] = "Marine Colonel"; $b[114][0] = "msgtmajorgen.jpg"; $b[114][1] = "Marine Brigadier"; $b[115][0] = "mbgen.jpg"; $b[115][1] = "Marine Brigadier General"; $b[116][0] = "mMajGen.jpg"; $b[116][1] = "Marine Major General"; $b[117][0] = "mLtgen.jpg"; $b[117][1] = "Marine Lieutenant General"; $b[118][0] = "mgen.jpg"; $b[118][1] = "Marine General"; $b[119][0] = "mFMar.jpg"; $b[119][1] = "Marine Field Marshall"; $b[120][0] = "Civil1.jpg" ; $b[120][1] = "Civilian Rating 1"; $b[121][0] = "Civil2.jpg" ; $b[121][1] = "Civilian Rating 2"; $b[122][0] = "Civil3.jpg" ; $b[122][1] = "Civilian Rating 3"; $b[123][0] = "Civil4.jpg"; $b[123][1] = "Civilian Rating 4"; $b[124][0] = "Civil5.jpg" ; $b[124][1] = "Civilian Rating 5"; $b[125][0] = "Civil6.jpg" ; $b[125][1] = "Civilian Rating 6"; $b[126][0] = "Civil7.jpg"; $b[126][1] = "Governor Civilian Rating 7"; $b[127][0] = "Ambas1.jpg" ; $b[127][1] = "Ambassador Rating 1"; $b[128][0] = "Ambas2.jpg" ; $b[128][1] = "Ambassador Rating 2"; $b[129][0] = "Ambas3.jpg" ; $b[129][1] = "Ambassador Rating 3"; $b[130][0] = "Ambas4.jpg" ; $b[130][1] = "Ambassador Rating 4"; $b[131][0] = "Ambas5.jpg" ; $b[131][1] = "Ambassador Rating 5"; $b[132][0] = "Ambas6.jpg"; $b[132][1] = "Ambassador Rating 6"; $b[133][0] = "cadet1.jpg"; $b[133][1] = "Cadet 4th Class"; $b[134][0] = "cadet2.jpg"; $b[134][1] = "Cadet 3rd Class"; $b[135][0] = "cadet3.jpg"; $b[135][1] = "Cadet 2nd Class"; $b[136][0] = "cadet4.jpg"; $b[136][1] = "Cadet 1st Class"; $b[137][0] = "actensignyellow.jpg"; $b[137][1] = "Acting Ensign Yellow"; $b[138][0] = "actensignteal.jpg"; $b[138][1] = "Acting Ensign Teal"; $b[139][0] = "actensignred.jpg"; $b[139][1] = "Acting Ensign Red"; $b[140][0] = "m3rdlt.jpg"; $b[140][1] = "Acting Ensign Marine"; $b[141][0] = "Civil.jpg"; $b[141][1] = "Civilian Rating 0"; $b[142][0] = "Ambas0.jpg"; $b[142][1] = "Ambassador Rating 0"; echo "<select name=\"rank_image\">"; foreach ($b as $bb1) { // for testing purposes to see what is in $v1 //print_r($v1); // comment out when all is working fine echo "<option value='" . $bb1[0] . "'" ; // where is $listposition coming from? if ($bb1[0] == $rank_image) { echo " selected "; } echo ">".$bb1[1]."</option>"; } echo "</select>"; ?> <br><br><br> Medal image(enter the html code to display the medal image, in cases when a person has several medals enter them in the proper order by starting with the medal that is more important and hit enter at the end of each line): <br><br> <textarea name="medal_image" cols="60" rows="20" wrap="VIRTUAL" ><?php echo $medal_image ?></textarea><br><br><br> Picture(enter the url of the picture with the html code to display it(don't forget to specify height, width)):<br><br> <textarea name="picture" cols="70" rows="2"><?php echo $picture ?></textarea> <br><br><br> Rank name:<br><br> <?php $f[29][1] = "Crewman"; $f[30][1] = "Petty Officer Second Class"; $f[31][1] = "Petty Officer First Class"; $f[32][1] = "Chief Petty Officer"; $f[33][1] = "Chief Petty Officer First Class"; $f[34][1] = "Master Chief Petty Officer"; $f[61][1] = "Commander Star Fleet"; $f[72][1] = "Ensign"; $f[76][1] = "Lieutenant Jg."; $f[80][1] = "Lieutenant"; $f[84][1] = "Lt. Commander"; $f[88][1] = "Commander"; $f[92][1] = "Commander 1st Class"; $f[94][1] = "Captain"; $f[96][1] = "Commodore"; $f[98][1] = "Rear Admiral"; $f[99][1] = "Vice Admiral"; $f[101][1] = "Admiral"; $f[103][1] = "Fleet Admiral"; $f[106][1] = "Section Admiral"; $f[107][1] = "Marine 2nd Lieutenant"; $f[108][1] = "Marine 1st Lieutenant"; $f[109][1] = "Marine Captain"; $f[110][1] = "Marine Major"; $f[111][1] = "Marine Lieutenant Colonel"; $f[112][1] = "Marine Lieutenant Colonel 1st Class"; $f[113][1] = "Marine Colonel"; $f[114][1] = "Marine Brigadier"; $f[115][1] = "Marine Brigadier General"; $f[116][1] = "Marine Major General"; $f[117][1] = "Marine Lieutenant General"; $f[118][1] = "Marine General"; $f[119][1] = "Marine Field Marshall"; $f[141][1] = "Civilian Rating 0"; $f[120][1] = "Civilian Rating 1"; $f[121][1] = "Civilian Rating 2"; $f[122][1] = "Civilian Rating 3"; $f[123][1] = "Civilian Rating 4"; $f[124][1] = "Civilian Rating 5"; $f[125][1] = "Civilian Rating 6"; $f[126][1] = "Governor Civilian Rating 7"; $f[127][1] = "Ambassador Rating 1"; $f[128][1] = "Ambassador Rating 2"; $f[129][1] = "Ambassador Rating 3"; $f[130][1] = "Ambassador Rating 4"; $f[131][1] = "Ambassador Rating 5"; $f[132][1] = "Ambassador Rating 6"; $f[133][1] = "Cadet 4th Class"; $f[134][1] = "Cadet 3rd Class"; $f[135][1] = "Cadet 2nd Class"; $f[136][1] = "Cadet 1st Class"; $f[137][1] = "Acting Ensign"; echo "<select name=\"rank\">"; foreach ($f as $ff1) { // for testing purposes to see what is in $v1 //print_r($v1); // comment out when all is working fine echo "<option value='" . $ff1[1] . "'" ; // where is $listposition coming from? if ($ff1[1] == $rank) { echo " selected "; } echo ">".$ff1[1]."</option>"; } echo "</select>"; ?> <br><br><br> Species:<br><br><input type="Text" name="species" value="<?php echo $species ?>"><br><br><br> Birthplace:<br><br> <textarea name="birthplace" cols="80"><?php echo $birthplace ?></textarea> <br><br><br> Current Posting:<br><br><input type="Text" name="current_posting" value="<?php echo $current_posting ?>"><br><br><br> Qualification:<br><br> <textarea name="qualification" cols="80" rows="5"><?php echo $qualification ?></textarea> <br><br><br> Age:<br><br><input type="Text" name="age" value="<?php echo $age ?>"><br><br><br> Sex:<br><br><input type="Text" name="sex" value="<?php echo $sex ?>"><br><br><br> Date of Birth:<br><br><input type="Text" name="dob" value="<?php echo $dob ?>"><br><br><br> Apperance:<br><br><textarea name="appearance" cols="60" rows="20" wrap="VIRTUAL" ><?php echo $appearance ?></textarea> <br><br><br> History:<br><br><textarea name="history" cols="80" rows="20" wrap="VIRTUAL" ><?php echo $history ?></textarea> <br><br><br> Background:<br><br><textarea name="background" cols="80" rows="20" wrap="VIRTUAL" ><?php echo $background ?></textarea> <br><br><br> Service record, enter a break (br) at the end of each line):<br><br><textarea name="service_record" cols="60" rows="20" wrap="VIRTUAL" ><?php echo $service_record ?></textarea> <br><br><br> Commendations(same as above):<br><br><textarea name="commendations" cols="60" rows="20" wrap="VIRTUAL" ><?php echo $commendations ?></textarea> <br><br><br> Reprimands:<br><br><textarea name="reprimands" cols="60" rows="20" wrap="VIRTUAL" ><?php echo $reprimands ?></textarea> <br><br><br> Medical Record:<br><br><textarea name="med_record" cols="60" rows="20" wrap="VIRTUAL" ><?php echo $med_record ?></textarea> <br><br><br> Interests:<br><br><textarea name="interests" cols="60" rows="20" wrap="VIRTUAL" ><?php echo $interests ?></textarea> <br><br><br> Additional Notes:<br><br><textarea name="added_notes" cols="60" rows="20" wrap="VIRTUAL" ><?php echo $added_notes ?></textarea> <br><br><br> <input type="Submit" name="submit" value="Enter information"> </form> Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 29, 2007 Share Posted October 29, 2007 In the past you could use $id to mean the value of id passed in the URL or Posted. Now you need to do $id = $_POST['id']; or $id = $_GET['id']; depending if it was posted or in the url. You also need to sanitize your data, look up SQL injection on google. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted October 29, 2007 Share Posted October 29, 2007 you could do something like <?php $comment= strip_tags(trim(mysql_real_escape_string($comment));// avoids injection ?> Quote Link to comment Share on other sites More sharing options...
tagert123 Posted October 29, 2007 Author Share Posted October 29, 2007 so does this mean instead of having $sql = "UPDATE profile SET name='$name' I need to have $sql = "UPDATE profile SET name=$_POST['name'] Quote Link to comment Share on other sites More sharing options...
iceblox Posted October 29, 2007 Share Posted October 29, 2007 Hi Tagert, I recently had the same issue. Had loads of script and no time to re write them. So i was told by my host to put a line of code into my htaccess and that overide the Register_Globals. I know its not the done thing but it saves rewriting loads of scripts. php_flag register_globals ON Quote Link to comment Share on other sites More sharing options...
tagert123 Posted October 29, 2007 Author Share Posted October 29, 2007 Thnx for the suggestion... Shoulc work as a temporary fix till i get the form redone. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted October 29, 2007 Share Posted October 29, 2007 you can use the extract command in php, I would not recommend it though, better to convert the whole code http://www.php.net/extract extract($_POST); extract($_GET); extract($_SESSION); Quote Link to comment Share on other sites More sharing options...
tagert123 Posted October 29, 2007 Author Share Posted October 29, 2007 Thnx for the advice But now if someone cold give me an example which variables i am suppossed to change with POST and GET. Thnx. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.