Jump to content

segyn

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

segyn's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. My drop down menu works fine but what I want is one of the options in the database for Status is Good. I want that to be the default option. If i enter selected in the option value such as selected="good" it just defaults to putting obsolete as the default value. Any Ideas on how to get this to work will be greatly appreciated. I am currently running php ver. 4.2.3 The site i'm working on is just to keep track of all the tools we have at the company I work for. So i have a lot of drop down boxes i made like this so i could just include them into each page. <?php echo"<tr bgcolor='Black'> <td bgcolor='silver'> Status: <td bgcolor='silver'>"; include("conn.php"); $sql = mysql_query("SELECT * FROM Tools.Status"); echo "<select name ='Status'>"; while($row = mysql_fetch_array($sql)) { echo "<option>" . $row['G_Status'] ."</option>"; } echo "</select>"; echo "</tr>"; mysql_close($con); ?>
  2. I can't get the info from table departments to show up in the drop down menu. Pls. help. here is code odbc.php <?php $odbc = odbc_connect ('Tools', '', '') or die('Could Not Connect to ODBC Database!'); ?> <? if(!function_exists('odbc_fetch_array')) { function odbc_fetch_array($result, $rownumber=-1) { if (PHP_VERSION > '4.2') { if ($rownumber < 0) { odbc_fetch_into($result, $rs); } else { odbc_fetch_into($result, $rs, $rownumber); } } else { odbc_fetch_into($result, $rownumber, $rs); } $rs_assoc = Array(); foreach ($rs as $key => $value) { $rs_assoc[odbc_field_name($result, $key+1)] = $value; } return $rs_assoc; } } ?> new iron.php <?php require_once('odbc.php'); $result = odbc_exec($odbc,"SELECT * FROM Departments") or die (odbc_errormsg()); $pulldown = '<option value =$row[D_department]'; while($row = odbc_fetch_array($result)) { $pulldown .='<option value= $row[D_department]></option>'; } odbc_close($odbc);?> <html> <head> <title>New Irons</title> <link rel=stylesheet type="text/css" href="http://192.168.1.56/wod.css"> </head> <body vlink="blue" alink="blue" bgcolor="silver"> <table border="1" bgcolor="silver" align="center"> <tr> <td rowspan="20" valign = "top"><img src="http://192.168.1.56/logo_sm.gif" align="left"/></td> <td colspan="2" class=titleline valign="top">Add New Iron</td> </tr> <tr> <form action="NewIron.php" method="post"> <td>SI No:<td> <input type="text" name="SiNo" > </tr><br> <tr> <td>Watts: <td> <input type="text" name="Watts"> </tr><br> <tr> <td>Department: <td><select name="Dept"> <?php echo $row ; ?> </select> </tr><br> <tr> <td>Status: <td> <input type="text" name="Status" > </tr><br> <tr> <td>Notes: <td> <input type="text" name="Notes" > </tr><br> <tr align="center"> <td><input type=submit Name=submit Value="Submit"> <td><INPUT TYPE=RESET NAME=RESET VALUE="Reset" ></tr></table> </form> </body> </html> to post to table <?php require_once('odbc.php'); $insert = odbc_exec($odbc, "INSERT INTO Irons2 (I_SiNo, I_Watts, I_Department, I_Status, I_Notes) VALUES ('$_POST[siNo]','$_POST[Watts]','$_POST[Dept]','$_POST[status]','$_POST[Notes]')"); echo "record added"; odbc_close($odbc); ?>
  3. just wanted to add keep in mind i am using a dsn name with odbc not a mysql server. Thanks
  4. Okay i'm using access and php and apache I have to use access because that is what the company has been using and they won't switch to an sql server. Any way I have to use an odbc connection I have created my form to input into a table. My database is being used for keeping track of all the production tools. I have made A department table in the database. I guess what i am asking is I have to use Department table in multiple forms. Can any one help me on how to get a drop down menu from the table departments into a form i'm creating for new tools. I hope this makes sense. ??? this is my form but for departments i want it to be a drop down menu from the table Departments in my database. Pls help. <form action="NewIron.php" method="post"> <td>SI No:<td> <input type="text" name="SiNo" > </tr><br> <tr> <td>Watts: <td> <input type="text" name="Watts"> </tr><br> <tr> <td>Department: <td> <input type="text" name="Dept" > </tr><br> <tr> <td>Status: <td> <input type="text" name="Status" > </tr><br> <tr> <td>Notes: <td> <input type="text" name="Notes" > </tr><br> <tr align="center"> <td><input type=submit Name=submit Value="Submit"> <td><INPUT TYPE=RESET NAME=RESET VALUE="Reset" ></tr></table> </form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.