robert.access Posted January 31, 2010 Share Posted January 31, 2010 please help me with this. On a page I have a form for user to insert a text and then another to upload image, but when images are uploaded the page it's automatcly refreshed and the text in <textarea> dissapearand and need to be entered again. How to fix this? If I move the images upload above the <textarea> for users first to upload and then enter the text it's ugly for design. Please help Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/190437-textarea-help-imput-text-to-be-saved/ Share on other sites More sharing options...
fesan Posted January 31, 2010 Share Posted January 31, 2010 Cant you do both operations in one script? So saving text and adding picture is done at the same time. Without the code and more info about the script it is hard to see how you are solving things at the moment. Quote Link to comment https://forums.phpfreaks.com/topic/190437-textarea-help-imput-text-to-be-saved/#findComment-1004553 Share on other sites More sharing options...
robert.access Posted January 31, 2010 Author Share Posted January 31, 2010 well thanks for the big help but really don't know from where to start. the code is: </tr> <tr> <td colspan="3" class="mylabelstyle"><?=MSG_ITEM_TITLE;?> <input name="name" type="text" id="name" value="<?=$item_details['name'];?>" size="60" maxlength="80" class="myinputstyle" /></td> </tr> <tr > <td colspan="3"><script language="JavaScript" type="text/javascript" src='scripts/innovaeditor.php'></script><textarea id="description_main" name="description_main" style="width: 400px; height: 200px; overflow: hidden;" ><?=$item_details['description'];?></textarea> <?=$item_description_editor;?> </td> </tr> <? echo ($setts['max_images'] > 0) ? $image_upload_manager : ''; ?> the item title it's saved on page refresh. do you need other code too??? thanks! Quote Link to comment https://forums.phpfreaks.com/topic/190437-textarea-help-imput-text-to-be-saved/#findComment-1004557 Share on other sites More sharing options...
fesan Posted January 31, 2010 Share Posted January 31, 2010 I'm not an expert, so this is not enough code for me to work with. Is this a script that you are altering or have you written the script your self? Quote Link to comment https://forums.phpfreaks.com/topic/190437-textarea-help-imput-text-to-be-saved/#findComment-1004571 Share on other sites More sharing options...
robert.access Posted January 31, 2010 Author Share Posted January 31, 2010 I am altering , mabe it's easy to have images ajax upload without refresh the page. What do you think it's easyer??? Quote Link to comment https://forums.phpfreaks.com/topic/190437-textarea-help-imput-text-to-be-saved/#findComment-1004577 Share on other sites More sharing options...
premiso Posted January 31, 2010 Share Posted January 31, 2010 You can use sessions to persist the data. Basically when the user uploads the image store the post inputs you want saved in session. On the form page in the html input value you would have something like: <input type="text" name="somename" value="<?php echo isset($_SESSION['somename'])?$_SESSION['somename']:'';?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/190437-textarea-help-imput-text-to-be-saved/#findComment-1004621 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.