Jump to content

Reload outside page onClick of submit button


tcarpenter9

Recommended Posts

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.