suttercain Posted May 2, 2007 Share Posted May 2, 2007 Hi guys, I am open to new ideas, but here is what I am doing now and how I have it set up: I have a form in my custom admin panel where I can submit news articles and a picture to accompany it. The problem lies in the picture field. Right now I can select the image via a drop-down menu and select from that list of pictures that are already on the server or I can click the link, which opens a new window, and upload the picture. If I upload a picture and close that upload browser, that picture will not appear in that drop down list until I reload (or refresh) the page. If I refresh the page, I lose all the content. I have entered in the form fields. I currently have the form fields echoing sessions, which works when I need to go back to the submit_news page from the preview_news page, just doesn't work for reload. Anyone have any ideas how to fix this or any other suggestions? Thanks. SC Link to comment https://forums.phpfreaks.com/topic/49681-reloading-a-page-without-losing-the-form-input-content/ Share on other sites More sharing options...
clown[NOR] Posted May 2, 2007 Share Posted May 2, 2007 you can try to add value="<?php echo $var; ?>" inside the <input> tags where $var represents the entered value Link to comment https://forums.phpfreaks.com/topic/49681-reloading-a-page-without-losing-the-form-input-content/#findComment-243574 Share on other sites More sharing options...
pikemsu28 Posted May 2, 2007 Share Posted May 2, 2007 use this value="<?php if(isset($var)){ echo $var;}?>" adding the if(isset($var)) will keep you from getting undefind variable when the page loads and the variable isnt set. if i understand your post, you can change the $var to $_SESSION['var'] to echo the session data Link to comment https://forums.phpfreaks.com/topic/49681-reloading-a-page-without-losing-the-form-input-content/#findComment-243654 Share on other sites More sharing options...
clown[NOR] Posted May 2, 2007 Share Posted May 2, 2007 I've never had that error at all, and I've never used that if statement in there.. Link to comment https://forums.phpfreaks.com/topic/49681-reloading-a-page-without-losing-the-form-input-content/#findComment-243772 Share on other sites More sharing options...
pikemsu28 Posted May 2, 2007 Share Posted May 2, 2007 hmm......dunno i just know when i use it like that i get an undefined variable error if i dont set the variable equal to blank. EDIT: i use an error handler file that sends me an email with the undefind variable and outputs a server warning if i dont use the if statement. ] <?php $live = TRUE; $emailaddy = '[email protected]'; function my_error_handler($e_number, $e_message, $e_file, $e_line, $e_vars) { global $live, $emailaddy; $message = "An error occurred in script '$e_file' on line $e_line: $e_message\n"; $message .= print_r($e_vars, 1); if($live) { error_log($message, 1, $emailaddy); // Send email about error echo '<div class="error" align="center">A system error occurred. We appologize for the inconvenience. Please check back at a later time.</div><br />'; } else { echo '<div class="error" align="center">' . $message . '</div><br />'; } } set_error_handler('my_error_handler'); ?> Link to comment https://forums.phpfreaks.com/topic/49681-reloading-a-page-without-losing-the-form-input-content/#findComment-243778 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.