mbrown Posted February 4, 2009 Share Posted February 4, 2009 $softwareQuery = "SELECT * FROM `software` WHERE `SKU` = '$SKU'"; $softwareResult = mysql_fetch_assoc(mysql_query($softwareQuery)); [/coe] When I echo out $softwareResult[OtherInfo] it display but when i put it in something like this: [code] <textarea name='otherinfo' id='otherinfo' cols='45' rows='5' value='$softwareResult[OtherInfo]'></textarea> it does not display it in the form. any ideas why? like I said when i do the following it works echo $softwareResult[OtherInfo] Quote Link to comment Share on other sites More sharing options...
timmah1 Posted February 4, 2009 Share Posted February 4, 2009 <textarea name='otherinfo' id='otherinfo' cols='45' rows='5'><?php echo $softwareResult[OtherInfo]; ?></textarea> Quote Link to comment Share on other sites More sharing options...
mbrown Posted February 4, 2009 Author Share Posted February 4, 2009 thanks. I did it the way I posted before for something else and I thought it worked. This is a php form. So the <?php, echo and ?> are not needed. Thanks again Quote Link to comment Share on other sites More sharing options...
aschk Posted February 4, 2009 Share Posted February 4, 2009 $softwareResult[OtherInfo] will give you PHP warning error in your logs for "Invalid array index" or something simliar. You MUST use quotes for associative array indices. i.e. $softwareResult['OtherInfo'] You also haven't shown the full code for the following line: <textarea name='otherinfo' id='otherinfo' cols='45' rows='5' value='$softwareResult[OtherInfo]'></textarea> We don't know how the above is being output? By echo? By print? timmah1's solution is the correct one. So either post the full code or implement his solution. Quote Link to comment Share on other sites More sharing options...
mbrown Posted February 4, 2009 Author Share Posted February 4, 2009 <?php session_start(); if ($_SESSION['loggedIn'] == TRUE) { $username = $_SESSION['username']; echo "User Logged In: $username"; echo "<br /><a href='../administration/index1.php'>Main Admin</a>"; echo "<br />"; echo "<div align='center'><img src='../images/wasdBanner.gif' alt='header' /></div>"; //including the database connection script include("../includes/connect.php"); echo "<!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>Modify Software</title> </head> <body>"; $userquery = "SELECT * FROM users WHERE username = '$username'"; $query = mysql_fetch_assoc(mysql_query($userquery)); if($query[usergroup] != "Super Administrator") { echo "<br />You need to have administration privleges"; //meta refresh }//end of if($query[usergroup] == "Super Administrator") else { $SKU = $_POST['sku#']; $softwareQuery = "SELECT * FROM `software` WHERE `SKU` = '$SKU'"; $softwareResultNumRows = mysql_query($softwareQuery) or die (mysql_error()); $softwareResult = mysql_fetch_assoc(mysql_query($softwareQuery)); $softwareNumRows = mysql_num_rows($softwareResultNumRows); //Debuggin: echo "$SKU"; if ($softwareNumRows == 0) { if ($SKU == "") { echo "Please enter a SKU Number"; }//end of if ($SKU == "") }//end of if ($numrows == 0) else { echo "<style type='text/css'> <!-- .style1 { color: #0000FF; font-weight: bold; } .style2 {color: #0000FF} .style3 {font-size: 12px} --> </style> "; echo "<form id='software' name='software' method='post' action='softwareModifyCheck.php'> <div align='center' > <p class='style1'>Software<br /> <hr width='50%' /> <p align='left'> <label>ID: <input type='text' name='ID' id='ID' value='$softwareResult[iD]' readonly='readonly' length='4'/> </label> </p> <p align='left'> <label>Software Title: <input type='text' name='softwareTitle' id='softwareTitle' value='$softwareResult[softwareTitle]'/> </label> </p> <p align='left'> <label>SKU #: <input type='text' name='sku#' id='sku#' value='$softwareResult[sKU]'/> </label> </p> <p align='left'>Building: <select name='building' id='building'> <option value='$softwareResult[Location]'>$softwareResult[Location]</option> <option value='Summitview'>Summitview</option> <option value='WAMS'>WAMS</option> <option value='WASHS'>WASHS</option> <option value='Hooverville'>Hooverville</option> <option value='Mowery'>Mowery</option> <option value='Fairview Ave'>Fairview Ave</option> <option value='Clayton Ave'>Clayton Ave</option> </select> </p> <p align='left'>Room: <label> <input name='room' type='text' id='room' size='3' maxlength='3' value='$softwareResult[Room]'> </label> </p> <p align='left'>Grant: <label> <input type='text' name='grant' id='grant' value='$softwareResult[Grant]'/> </label> </p> <p align='left'>Other Information: <label><br /> <textarea name='otherinfo' id='otherinfo' cols='45' rows='5'>$softwareResult[OtherInfo]</textarea> </label> </p> <p align='left'> </p> <div align='center'> <input type='submit' name='submit2' id='submit2' value='Submit' /> <input type='reset' name='button' id='button2' value='Reset' /> </div> </div> </form>"; }//end of else }//end of else }//end of if ($_SESSION['loggedIn'] == TRUE) else { header('Location: ../login.php'); } echo" </body> </html>"; ?> I implemented timmah1's solution <textarea name='otherinfo' id='otherinfo' cols='45' rows='5'>$softwareResult[OtherInfo]</textarea> Quote Link to comment Share on other sites More sharing options...
gevans Posted February 4, 2009 Share Posted February 4, 2009 And is it working? Quote Link to comment Share on other sites More sharing options...
mbrown Posted February 4, 2009 Author Share Posted February 4, 2009 Now it is working. That is why I said thank you. I just included the code because aschk was saying about he didnt know how it was being outputted. thanks again! 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.