Jump to content

alan_k

Members
  • Posts

    45
  • Joined

  • Last visited

Posts posted by alan_k

  1. I'm sorry but I'm a little lost. I thought I was giving list of variables then values. You're saying I should just do:

    INSERT INTO TT_Form (id, Date_Entered, FName, LName, Dept, Rch_Num, Rm_Number, E_Mail, Prob_Cat,             Rm_Avail, Problem, Tkt_Status, Assgnd_Tech, TT_Num) VALUES ('', '$Date_Entered', '$FName', '$LName',            '$Dept', '$Rch_Num', '$Rm_Number', '$E_Mail', '$Prob_Cat', '$Rm_Avail', '$Problem', '$Tkt_Status', '$Assgnd_Tech', '$TT_Num')";

    without the "$query =". And I am using UPDATE with SET so please forgive a relative newcomer,I am a bit confused with what needs correcting.

  2. Here is the code:

    <?phpinclude 'dbinfo.inc.php';$Date_Entered=$_POST['Date_val'];$FName=$_POST['FName_val'];$LName=$_POST['LName_val'];$Dept=$_POST['q4_department'];$Rch_Num=$_POST['q15_reach'];$Rm_Number=$_POST['q5_roomNumber'];$E_Mail=$_POST['q6_email6'];$Prob_Cat=$_POST['q11_problemCatregory'];$Rm_Avail=implode(", ",$_POST['q12_pleaseSpecify12']);$Problem=$_POST['q8_explainProblem'];$Tkt_Status=$_POST['Tkt_Status_val'];$Assgnd_Tech="Unassigned";$TT_Num=0;//Clean input to make sure it is formatted with a leading Capital letter.$FName=ucfirst($FName);$LName=ucfirst($LName);$Eqpmnt_Brwd=ucfirst($Eqpmnt_Brwd);try    {    $link=new PDO($dsn, $username,$password);    }catch (PDOException $e)    {    $error_message=$e->getMessage();    echo "<h1>Resource Unavailable. Please Contact the System Administrator</h1>";    }/*$query = "INSERT INTO TT_Form VALUES('', '$Date_Entered', '$FName', '$LName','$Dept','$Rch_Num', '$Rm_Number', '$E_Mail', '$Prob_Cat', '$Rm_Avail', '$Problem', '', '$Tkt_Status', '$Assgnd_Tech', '$TT_Num')";$result = $link->query($query);*/$stmt = $link->prepare("INSERT INTO TT_Form SET Date_Entered = :Date_Entered, FName = :FName, LName = :LName, Dept =:Dept , Rch_Num = :Rch_Num,                                   Rm_Number = :Rm_Number, E_Mail = :E_Mail, Prob_Cat = :Prob_Cat, Rm_Avail = :Rm_Avail, Problem = :Problem, Tkt_Status = :Tkt_Status, Assgnd_Tech = :Assgnd_Tech, TT_Num = :TT_Num");$stmt->execute(array(            ':Date_Entered' => $Date_Entered,            ':FName' => $FName,            ':LName' => $LName,            ':Dept' => $Dept,            ':Rch_Num' => $Rch_Num,            ':Rm_Number' => $Rm_Number,            ':E_Mail' => $E_Mail,            ':Prob_Cat' => $Prob_Cat,            ':Rm_Avail' => $Rm_Avail,            ':Problem' => $Problem,            ':Tkt_Status' => $Tkt_Status,            ':Assgnd_Tech' => $Assgnd_Tech,            ':TT_Num' => $TT_Num ));           $query = "INSERT INTO TT_Form (id, Date_Entered, FName, LName, Dept, Rch_Num, Rm_Number, E_Mail, Prob_Cat,             Rm_Avail, Problem, Tkt_Status, Assgnd_Tech, TT_Num) VALUES ('', '$Date_Entered', '$FName', '$LName',            '$Dept', '$Rch_Num', '$Rm_Number', '$E_Mail', '$Prob_Cat', '$Rm_Avail', '$Problem', '$Tkt_Status', '$Assgnd_Tech', '$TT_Num')";//We use the insertId function to get the last row inserted id and add 100.$insertId = $link->lastInsertId();echo $insertId;// Simple error check to see if row got added from above INSERT statement.if ($insertId == 0) {     echo "<h2>Error in Adding Trouble Ticket. Please Contact the System Administrator.</h2>";     exit;   }else  {        $insertId = $insertId + 100;   }   $count=$link->prepare("UPDATE TT_Form SET TT_Num = id + 100 Where LName = '$LName'");$count->execute();echo '<br /n>';echo '<br /n>';echo  '<h2>Your Trouble Ticket Number Is: ' . $insertId .'</h2>'; ?>

    It works except when I have an apostrophe in the name. Then the TT_Num field gets assigned a value of zero??? And the weird part is the last line $insertId prints out the correct TT_Num value? My guess is that last UPDATE staement is failing but only when an apostrophe is present.

  3. Update Found one error. This is wrong "INSERT INTO TT_Form VALUES SET". Deleted the VALUES out of statement. Now I can add a record but it is being assigned a TT# of 0 if person has an apostrophe???? And yet the $insertid variable prints out the correct TT#. But when I look in phpMyadmin the TT# is a 0. Any help appreciatedAny help appreciated

  4. Hello,

    This has me stumped. I've looked here to see how to insert names into mysql and take into account apostrophe's in names. I've tried this:

    $stmt = $link->prepare("INSERT INTO TT_Form VALUES SET Date_Entered = :Date_Entered, FName = :FName, LName = :LName, Dept =:Dept , Rch_Num = :Rch_Num,                                   Rm_Number = :Rm_Number, E_Mail = :E_Mail, Prob_Cat = :Prob_Cat, Rm_Avail = :Rm_Avail, Problem = :Problem, Tkt_Status = :Tkt_Status, Assgnd_Tech = :Assgnd_Tech, TT_Num = :TT_Num");$stmt->execute(array(            ':Date_Entered' => $Date_Entered,            ':FName' => $FName,            ':LName' => $LName,            ':Dept' => $Dept,            ':Rch_Num' => $Rch_Num,            ':Rm_Number' => $Rm_Number,            ':E_Mail' => $E_Mail,            ':Prob_Cat' => $Prob_Cat,            ':Rm_Avail' => $Rm_Avail,            ':Problem' => $Problem,            ':Tkt_Status' => $Tkt_Status,            ':Assgnd_Tech' => $Assgnd_Tech,            ':TT_Num' => $TT_Num ));           $query = "INSERT INTO TT_Form (id, Date_Entered, FName, LName, Dept, Rch_Num, Rm_Number, E_Mail, Prob_Cat,             Rm_Avail, Problem, Tkt_Status, Assgnd_Tech, TT_Num) VALUES ('', '$Date_Entered', '$FName', '$LName',            '$Dept', '$Rch_Num', '$Rm_Number', '$E_Mail', '$Prob_Cat', '$Rm_Avail', '$Problem', '$Tkt_Status', '$Assgnd_Tech', '$TT_Num')";$result = $link->query($query);

    But I still cant insert a name with an apostrophe in it into MySQL table.. Everything else is ok. I understood that pdo would take care of the apostrophe problem. I have php error checking on and have no errors displaying. Does anyone see what I might be missing. Yet this code from another form works fine.

    if ($FName !='' && $LName !='' && $Eqpmnt_Brwd !='') { $stmt = $link->prepare("INSERT INTO Inventory SET FName = :FName, LName = :LName, Eqpmnt_Brwd = :Eqpmnt_Brwd,                        Service_Tag = :Service_Tag, Brwd_Rsn = :Brwd_Rsn, Date_Taken = :Date_Taken, Exp_Return = :Exp_Return,  Comments = :Comments");                             $stmt->execute(array(            ':FName' => $FName,            ':LName' => $LName,            ':Eqpmnt_Brwd' => $Eqpmnt_Brwd,            ':Service_Tag' => $Service_Tag,            ':Brwd_Rsn' => $Brwd_Rsn,            ':Date_Taken' => $Date_Taken,            ':Exp_Return' => $Exp_Return,            ':Comments' => $Comments));            $query = "INSERT INTO Inventory (FName, LName, Eqpmnt_Brwd, Service_Tag, Brwd_Rsn, Date_Taken, Exp_Return, Comments, id)          VALUES('$FName','$LName','$Eqpmnt_Brwd','$Service_Tag','$Brwd_Rsn', '$Date_Taken', '$Exp_Return',  '$Comments', '')";$result=$link->query($query);

    Thanks. Here is the whole file if needed..insert.php

  5. Further Research and found this answer which works pretty good.....

    <table class="table table-striped table-bordered table-hover" cellpadding="10" cellmargin="5" border="3">    <tr>        <th id="table_header">First Name</th>        <th id="table_header">Last Name</th>        <th id="table_header">Reach #</th>        <th id="table_header">Room Number</th>        <th id="table_header">Type of Trouble</th>        <th id="table_header">Room Availability</th>        <th id="table_header">Trouble Report</th>        <th id="table_header">Ticket Status</th>        <th id="table_header">Assignment</th>        <th id="table_header">TT Number</th>        <th id="table_header"></th>    </tr>    <?php    foreach($model as $row)    {        echo "<tr class='success'>";        echo '<td>'. $row['FName'] .'</td>';        echo '<td>'. $row['LName'] .'</td>';        echo '<td>'. $row['Rch_Num'] .'</td>';        echo '<td>'. $row['Rm_Number'] .'</td>';        echo '<td>'. $row['Prob_Cat'] .'</td>';        echo '<td>'. $row['Rm_Avail'] .'</td>';        echo '<td width="50" height="30">' . '<div style="width:550px; Height:55px; overflow: auto">' . $row['Problem'] . '</div>' . '</td>';        echo '<td><i>'. $row['Tkt_Status'] . '</i></td>';        echo '<td>'. $row['Assgnd_Tech'] .'</td>';        echo '<td>' . $row['TT_Num'] . '</td>';        echo "<td class='info'><a class=one href='tt_record.php?id=" . $row['id'] . "'>More...</a></td>";       echo "</tr>";    }?></table>

     

  6. Hello,

    I have been researching a question I have but cant seem to find an answer for my situation. I have a simple html form that in a couple of fields may require user to write a longer then usual response on the trouble she is experiencing. What I would like is for that table cell to abbreviate the text and I have a link (called More) to the full page for that indivual row which can display the whole trouble report. Right now the whole text appears in the table cell and distorts the display. Is there a way to do this. Thanks. Here is the code for the table. It is the row with 'Problem' variable I would like to abbreviate.

    <table  class="table table-striped table-bordered table-hover" cellpadding="10" cellmargin="5" border="3">    <tr>        <th id="table_header">First Name</th>        <th id="table_header">Last Name</th>        <th id="table_header">Reach #</th>        <th id="table_header">Room Number</th>        <th id="table_header">Type of Trouble</th>        <th id="table_header">Room Availability</th>        <th id="table_header">Trouble Report</th>        <th id="table_header">Ticket Status</th>        <th id="table_header">Assignment</th>        <th id="table_header">TT Number</th>        <th id="table_header"></th>    </tr>    <?php    foreach($model as $row)    {        echo "<tr class='success'>";        echo '<td>'. $row['FName'] .'</td>';        echo '<td>'. $row['LName'] .'</td>';        echo '<td>'. $row['Rch_Num'] .'</td>';        echo '<td>'. $row['Rm_Number'] .'</td>';        echo '<td>'. $row['Prob_Cat'] .'</td>';        echo '<td>'. $row['Rm_Avail'] .'</td>';        echo '<td>'. $row['Problem'] .'</td>';        echo '<td><i>'. $row['Tkt_Status'] . '</i></td>';        echo '<td>'. $row['Assgnd_Tech'] .'</td>';        echo '<td>' . $row['TT_Num'] . '</td>';        echo "<td class='info'><a class=one href='tt_record.php?id=" . $row['id'] . "'>More...</a></td>";       echo "</tr>";    }?></table>

     

     

     

  7. Here's the code that worked for me:

    <li>         <input type="hidden" id="date" name="Date_val" value="date">           <script src="jscripts/jquery.min.js" type="text/javascript"></script>           <script type="text/javascript">              date_tda = new Date().toISOString().slice(0, 19).replace('T', ' ');              document.getElementById('date').value = date_tda;           </script>                   </li>  

    Thanks for everyone's input. You guys are very helpful. Is there a way to mark a question answered?

  8. Thanks for the reply but I'm not quite following you when you say "Use an INT field and store a UNIX timestamp". I am not familiar with how you would go about doing this. Is there no way to convert the Date() function output to a YYYY-MM-DD format that MySQL will understand? Seems like something there would be a lot of demand for?

  9. Hello,

    I am writing a page that will except some info from user and and get submitted as form. I wanted the date included in the form data so I

    wrote this little snippet to insert the current date when form is submitted:

          <li>         <input type="hidden" id="date" name="Date_val" value="date">           <script type="text/javascript">              document.getElementById('date').value = Date();           </script>                   </li>  

    Now when I print out my form All I get is a nonsense date 11--00-01 printed in my table. Looking at the

    _POST info this is what is getting sent to MySQL:

     

    Array ( [formID] => 42796558181164 [Date_val] => Wed Oct 22 2014 17:50:43 GMT-0400 (Eastern Standard Time) [FName_val] => xvxc [LName_val] => xcvxc [q4_department] => Art [q15_reach] => x [q5_roomNumber] => [q6_email6] => [q12_pleaseSpecify12] => Array ( [0] => HR ) [q8_explainProblem] => [Tkt_Status_val] => Open )

    I'm assuming that is why I get gibberish as my output. I have the MySql object defined as a simple date format. Can anyone tell me how I should format the date so it will output correctly?

    Thanks...

  10. Got it. Used this code

    <?phpinclude 'dbinfo.inc.php';$FName=$_POST['FName_val'];$LName=$_POST['LName_val'];$Dept=$_POST['q4_department'];$Rm_Number=$_POST['q5_roomNumber'];$Prob_Cat=$_POST['q11_problemCatregory'];$Rm_Avail=implode(",",$_POST['q12_pleaseSpecify12']);$Problem=$_POST['q8_explainProblem'];$Tkt_Status=$_POST['Tkt_Status_val'];print "$Rm_Avail";print_r ($_POST);try    {    $link=new PDO($dsn, $username,$password);    }catch (PDOException $e)    {    $error_message=$e->getMessage();    echo "<h1>Resource Unavailable. Please Contact the System Administrator</h1>";    }$query = "INSERT INTO TT_Form VALUES('', '$FName','$LName','$Dept','$Rm_Number','$Prob_Cat', '$Rm_Avail', '$Problem', '$Tkt_Status', '$TT')";$result = $link->query($query);

    And now works ok. Thanks for everyone's input

  11. Exactly what I was doing. I used

    <?phpinclude 'dbinfo.inc.php';$FName=$_POST['FName_val'];$LName=$_POST['LName_val'];$Dept=$_POST['q4_department'];$Rm_Number=$_POST['q5_roomNumber'];$Prob_Cat=$_POST['q11_problemCatregory'];$Rm_Avail=$_POST['q12_pleaseSpecify12'];$Problem=$_POST['q8_explainProblem'];$Tkt_Status=$_POST['Tkt_Status_val'];print "$Rm_Avail";print_r ($_POST);try    {    $link=new PDO($dsn, $username,$password);    }catch (PDOException $e)    {    $error_message=$e->getMessage();    echo "<h1>Resource Unavailable. Please Contact the System Administrator</h1>";    }$query = "INSERT INTO TT_Form VALUES('', '$FName','$LName','$Dept','$Rm_Number','$Prob_Cat', '$Rm_Avail', '$Problem', '$Tkt_Status', '$TT')";$result = $link->query($query);

    But nothing prints out for $Rm_Avail on my insert.php page. Do I have to some how convert the $_POST['q12_pleaseSpecify12'] into a string so $Rm_Avail can handle it by using that implode function or something similar?

  12. Yes you are right. Testing it on my development server I get:

    Array ( [formID] => 42796558181164 [FName_val] => aaa [LName_val] => asaa [q4_department] => Math [q5_roomNumber] => 223 [q6_email6] => [q11_problemCatregory] => Software [q12_pleaseSpecify12] => Array ( [0] => Period 2 [1] => HR [2] => Period 4 ) [q8_explainProblem] => [Tkt_Status_val] => Open )

    But now I have the problem of the table is printing out the word Array in the cell where I want the periods a classroom are available should be. Looking in MySQL I see that is the value stored in Rm_Avail.My insert looks like:

    try    {    $link=new PDO($dsn, $username,$password);    }catch (PDOException $e)    {    $error_message=$e->getMessage();    echo "<h1>Resource Unavailable. Please Contact the System Administrator</h1>";    }$query = "INSERT INTO TT_Form VALUES('', '$FName','$LName','$Dept','$Rm_Number','$Prob_Cat', '$Rm_Avail', '$Problem', '$Tkt_Status', '$TT')";$result = $link->query($query);

    I'm guessing I have to now do something with implode which I tried earlier but did not work. Any suggestions on how to store the multiple values in mysql field much appreciated.

  13. I'm sorry when I change to:

    $FName=$_POST['FName_val'];$LName=$_POST['LName_val'];$Dept=$_POST['q4_department'];$Rm_Number=$_POST['q5_roomNumber'];$Prob_Cat=$_POST['q11_problemCatregory'];$Rm_Avail=$_POST['q12_pleaseSpecify12'];$Problem=$_POST['q8_explainProblem'];$Tkt_Status=$_POST['Tkt_Status_val'];print_r ($_POST);

    Iget on Insert.php:

    Array ( [formID] => 42796558181164 [FName_val] => aa [LName_val] => aassaaa [q4_department] => sss [q5_roomNumber] => [q6_email6] => [q12_pleaseSpecify12] => Period 6th [q8_explainProblem] => [Tkt_Status_val] => Open )

     

    As you can see I'm only getting last selected value.

  14. I have a web page I'm building that at one point has a drop down list that the user can select multiple choices. I have looked online and seen several examples of this but in trying none have succeeded in storing them in a mysql key that I put in a table. I use the select tag to start the array and then use _POST method to store array in variable. The two files are as follows:Gather info in a form with this: <

    li class="form-line" data-type="control_dropdown" id="id_12">            <label class="form-label form-label-left form-label-auto" id="label_12" for="input_12"> Please Specify One or More Periods When the Classroom is Available if Applicable </label>            <div id="cid_12" class="form-input">              <select class="form-dropdown" style="width:150px" id="input_12" name="q12_pleaseSpecify12[]" multiple="multiple">                <option value="">  </option>                <option selected="selected" value="Period 1"> Period 1 </option>                <option value="Period 2"> Period 2 </option>                <option value="HR"> HR </option>                <option value="Period 3"> Period 3 </option>                <option value="Period 4"> Period 4 </option>                <option value="1st 5th (11:50-12:39)"> 1st 5th (11:50-12:39) </option>                <option value="2nd 5th (12:19-1:07)"> 2nd 5th (12:19-1:07) </option>                <option value="Period 6th"> Period 6th </option>                <option value="Period 7th"> Period 7th </option>              </select>            </div>          </li>

    and then _POST with this in second page Insert.php:

        $FName=$_POST['FName_val'];    $LName=$_POST['LName_val'];    $Dept=$_POST['q4_department'];    $Rm_Number=$_POST['q5_roomNumber'];    $Prob_Cat=$_POST['q11_problemCatregory'];    $Rm_Avail=implode(',', $_POST['q12_pleaseSpecify12']);    $Problem=$_POST['q8_explainProblem'];    $Tkt_Status=$_POST['Tkt_Status_val'];
            print_r ($Rm_Avail);

    Then Insert it with:

       $query = "INSERT INTO TT_Form VALUES('', '$FName','$LName',    '$Dept','$Rm_Number','$Prob_Cat', '$Rm_Avail', '$Problem', '$Tkt_Status', '$TT')";

    I am getting no output from the print_r statement. Any suggestions welcome.

  15. Here is the code that I got it to work with:

    Equipment Status:<?php    $option_to_preselect = $rsn_brwd;$ddown_options = array(    'Borrowed',    'In for Repair',    'Replacement',    'Returned',    'Other');$arrlength=count($ddown_options);print '<select name="ud_Borrwd_Rsn" id="input_select">';for ($x=0;$x<$arrlength;$x++){           if ($ddown_options[$x] == $option_to_preselect)    {        print '    <option value="' . $ddown_options[$x] . '"' . ' selected="selected">' . $ddown_options[$x] . '</option>';    }        else {            print '    <option value="' . $ddown_options[$x] . '">' . $ddown_options[$x] . '</option>';          }}print '</select>';?>

    Thanks to everyone for their input. The only small thing I have to complain about if you view the source code the select statement prints out as such :

    <select name="ud_Borrwd_Rsn" id="input_select"> <option value="Borrowed">Borrowed</option> <option value="In for Repair">In for Repair</option> <option value="Replacement">Replacement</option> <option value="Returned">Returned</option> <option value="Other">Other</option>

    all in one line. Just from a readability standpoint is there anyway to have the source code print on seperate line like it does when I use the select statement with pure html and indents and line breaks are preserved in source code. Also do you think it even warrants any error checking because it is a drop down list and always has a predefined value stored in it. Great forum I'm sure I will be returning. How do I mark thread as solved.

  16. Yes I am using PDO. And I am storing the values for the drop down list in an array in the page not a seperate database table. The logic is to compare the values in the array with retrieved database value (which is the current drop down selection) and construct the select tag using php. At least that is how it should work on paper. Unfortunately I always get the default value and when I try to update via _POST the value is not getting updated. Once again see my link above for full code of the page....

  17. Here is link to my code for page on Pastebin: http://pastebin.com/QhAccb1k

    And here is the MySQL export file:

     

    -- phpMyAdmin SQL Dump-- version 4.0.10deb1-- http://www.phpmyadmin.net---- Host: localhost-- Generation Time: Sep 22, 2014 at 01:46 PM-- Server version: 5.5.38-0ubuntu0.14.04.1-- PHP Version: 5.5.9-1ubuntu4.4SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";SET time_zone = "+00:00";/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;/*!40101 SET NAMES utf8 */;---- Database: `inventory_form`---- ------------------------------------------------------------ Table structure for table `Inventory`--CREATE TABLE IF NOT EXISTS `Inventory` ( `FName` varchar(12) NOT NULL, `LName` varchar(15) NOT NULL, `Eqpmnt_Brwd` varchar(25) NOT NULL, `Service_Tag` text NOT NULL, `Brwd_Rsn` varchar(15) NOT NULL, `Date_Taken` date NOT NULL, `Exp_Return` date NOT NULL DEFAULT '2014-09-01', `Comments` varchar(150) NOT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2105 ;---- Dumping data for table `Inventory`--INSERT INTO `Inventory` (`FName`, `LName`, `Eqpmnt_Brwd`, `Service_Tag`, `Brwd_Rsn`, `Date_Taken`, `Exp_Return`, `Comments`, `id`) VALUES('aasass', 'sddssddss', 'Laptop', '455444', 'Returned', '2014-09-20', '2014-10-05', 'Testing', 2101);/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

    I also notice that when I modify the drop list value on the modify page it is not being written to MySQL.

  18. I'm sorry I should have been more specific. Here is the PHP I'm using:

    Equipment Status:<?php    $option_to_preselect = $rsn_brwd;echo $option_to_preselect;$options = array(    1 => 'Borrowed',    2 => 'In for Repair',    3 => 'Replacement',    4 => 'Returned',    5 => 'Other');print '<select name="Borrwd_Rsn_val" id="input_select">';foreach ($options as $index => $value){    print '    <option value="' . $index . '"';        if ($index == $option_to_preselect)    {        print ' selected ';    }        print '>' . $value . '</option>';}print '</select>';?>

    This generates the select tag fine but again the default selected option is being generated by the php not the choice in the drop list being stored in MySQL. I dont want users to have to reselect the objects

    drop down value I want it prechoosen so if that is not what they want to modify they can leave the field alone. Like I said I am new to php so if anyone has a more elegant solution please advise. ThanksP.S.- Using MySQL 5.5 on a LAMP server running Ubuntu 14.4

  19. Hello,

    New to PHP and am stuck on one aspect.I have a simple equipment tracking form and in my edit table page I fill in the existing text values using `value="<?php echo $svc_tag;` for example. I have recently added a select tag but am stuck on how I can have the select box have the current value I am retrieving from MySQL chosen in the select box. Thru research I see the value attribute is not applicable here. Does anyone know of a way for me to have the select box populated with the current value from MySQL. I'm thinking along the lines I need some PHP code to generate the select tag code on the fly. My select statement statement on the add table entry page is this: Equipment Status:<select name="ud_Borrwd_Rsn" <option value="Borrowed" selected="selected">Borrowed</option> <option value="Repair">Repair</option> <option value="Replacement" >Replacement</option> <option value="Other">Other</option> </select><br />

×
×
  • Create New...