rick.emmet Posted February 12, 2012 Share Posted February 12, 2012 Hi Everyone, I have an interface that users will view to see data that they are uploading to a site. I'm using echo statements to dump the form data (as $_SESSION variables) on the page, which works just fine in the “static” portion of the page. I want to allow the users to edit the data and so have a hidden form at the bottom of the page, where they can edit the form data. Again, I'm using echo statements to in the form - value=“<?php echo $_SESSION['variable'] ?>” - to dump the values the user input. This works with every type of input except with a <textarea> field (its just blank). If I view the page source, I can see all the text that was entered in the text box (and passed as a session variable to the page, but it will not display. Here's a simplified version of the code (for the form): <!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>Form Page</title> </head> <body> <form method="post" action="test_formView.php" name="form1" ID="form1" > <label>Bake style</label> <select name="Bstyle" id="Bstyle"> <option>Broil</option> <option>High Temp</option> <option>Medium Temp</option> <option>Low Temp</option> <option>Warm</option> </select><br /> <label>Oven</label> <input name="Oven" type="text" size="50" maxlength="80" /><br /> <label>Baking <br> Description</label> <textarea name="description" cols="45" rows="5" id="description" ></textarea><br /> <label></label><input type="submit" name="userfile" value="Submit Info" /> </form> </body> And here is a simplified version of the php code that processes the form: <?php // code here for header, ect. // code to filter form data // storing POST variables in the session variable array $_SESSION['Bstyle'] = $_POST['Bstyle']; $_SESSION['Oven'] = $_POST['Oven']; $_SESSION['description'] = $_POST['description']; // Show the user what the contents of the ad uploaded ?> <form method="post" action="test_formView.php" name="form1" ID="form1" > <label>Bake style</label> <select name="Bstyle" id="Bstyle"> <option><?php echo $_SESSION['Bstyle'] ?></option> <option>Broil</option> <option>High Temp</option> <option>Medium Temp</option> <option>Low Temp</option> <option>Warm</option> </select><br /> <label>Oven</label> <input name="Oven" type="text" size="50" maxlength="80" value="<?php echo $_SESSION['Oven'] ?>" /><br /> <label>Baking <br> Description</label> <textarea name="description" cols="45" rows="5" id="description" value="<?php echo $_SESSION['description'] ?>" ></textarea><br /> <label></label><input type="submit" name="userfile" value="Re-submit Info" /> </form> <?php // code here for footer ?> When I submit the form, the processing page displays the form again (this is slightly different than the original way i'm doing this) with the data dynamically placed in the form. This allows the user to edit the form. All the data is displayed except the textarea data, that text box remains empty (although the data can be seen in the page source code). Can anyone explain why this is happening and how to fix it? I'd like to know! I appreciate your time. Cheers, Rick Quote Link to comment https://forums.phpfreaks.com/topic/256968-textarea-form-data-will-not-display/ Share on other sites More sharing options...
GingerRobot Posted February 12, 2012 Share Posted February 12, 2012 The text inside a textarea goes between <textarea> and </textarea>, not set as a value of the tag. See: http://www.w3schools.com/tags/tag_textarea.asp Quote Link to comment https://forums.phpfreaks.com/topic/256968-textarea-form-data-will-not-display/#findComment-1317336 Share on other sites More sharing options...
rick.emmet Posted February 17, 2012 Author Share Posted February 17, 2012 Hi GingerRobot, Thank you for getting back to me! That was a dumb problem, I didn't even think to look for that as a solution. It worked great! Cheers, Rick Quote Link to comment https://forums.phpfreaks.com/topic/256968-textarea-form-data-will-not-display/#findComment-1318419 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.