tcarpenter9 Posted June 6, 2007 Share Posted June 6, 2007 I'm using frames to create a "bookmark-like" page. You can enter a URL and it gets added to my database. I have two frames (leftFrame - to display bookmarks entered and mainFrame to show web page). I want the leftFrame to automatically refresh when the user enters a bookmark. As of now you must physically refresh the page to see the results. Here's my code: <?php if (!empty($_POST['action'])) { include "connection.php"; $url = $_POST['url']; $category = $_POST['category']; $title = $_POST['title']; echo "$url<br/><br />"; $query = "INSERT INTO bookmarks(url, category,title) VALUES('$url', $category,'$title');"; //bookmarks is the name of the table $result = mysql_query($query); if(!$result) { echo"<h2>There was a problem inserting into the database</h2>"; } else { echo "<h2>Registration Successful</h2>"; } } else{ ?> <form action="./insert_bookmarks.php" method="POST"> <input type="hidden" name="action" value="register" /> url : <input type="text" name="url" id="url" /><br/> title: <input type="text" name="title" id="title" /><br/> category: <select name="category"> <option value="choose_one">Choose One</option> <option value="1">Art</option> <option value="2">News</option> <option value="3">Politics</option> <option value="4">Gadgetry</option> </select><br/> <input type="submit"/> </form> <?php } ?> I know frames are not ideal, but I don't know of another way to do what I'm doing without them. Thank you in advance for your comments. -TC Quote Link to comment Share on other sites More sharing options...
taith Posted June 6, 2007 Share Posted June 6, 2007 only 2 ways of loading pages within pages, without reloading the page... iframes... or ajax. and if you dont want iframes... ajax would be your best bet :-) Quote Link to comment Share on other sites More sharing options...
mpharo Posted June 6, 2007 Share Posted June 6, 2007 if the frame has a name you can refresh it with javascript using something like this... <a href="javascript:location.reload();">Refresh the page</a> Quote Link to comment Share on other sites More sharing options...
tcarpenter9 Posted June 6, 2007 Author Share Posted June 6, 2007 I wonder if there is a way to use the Javascript so by wrapping it around the "submit" button on the form so that it submits to the database...then reloads the other web page in that order. I've tried his in a few ways it it won't communicate with the database. I'm still not sure how this would work. I do understand that the previous help would add an extra button, but I would like one button to submit to the database and refresh the other web page reading the database's fields. Quote Link to comment Share on other sites More sharing options...
taith Posted June 6, 2007 Share Posted June 6, 2007 easy... you have 3 pages... you press submit, it loads the php page, add information, then redirects to the view page... Quote Link to comment Share on other sites More sharing options...
tcarpenter9 Posted June 6, 2007 Author Share Posted June 6, 2007 The bookmark submit page reloads just fine, but the separate page shown in a separate frame won't reload unless you manually refresh the page Quote Link to comment Share on other sites More sharing options...
tcarpenter9 Posted June 6, 2007 Author Share Posted June 6, 2007 Let me clarify, I'm making it more confusing than it should be. -I have two .php files loaded into a web page with two frames. one php file in each frame -the right frame is where you enter a bookmark and press submit -this only refreshes the right frame, not the ENTIRE page. -How can I make it refresh the left frame when you press the submit button in the right frame? Thank you 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.