Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-21-2005, 05:03 AM   #1
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Rep: Reputation: 15
how to redirect PHP code to another page

ok here is the problem i am making a website. have a look at this place

u will be asked for a password and user name


password = rosebud

ok now when u open the page u will see one link. press it and a table will open up in the same frame where the link was.

all i want is that instead of this table being displayed in the same frame it should be displayed into the frame where i have written

" This portion will contain the listing of the selected items and there details"

when u click on the link it invokes a PHP script on the server. that PHP script is supposed to fetch all the listings in the product table from a database.

and by default it returns every thing back to the same frame or to the same page from where the user clicked on the link.

the name of the page which loads into the desired frame is upper.html

so how the hell do i make the PHP script to deliver the damn thing to the upper.html instead of the main.html page.

my php script is like this

<html xmlns= "">
<title> Assignment # 1: Online Groccery Store </title>

//build the select query

$query = "select * from products";


if ( !($link = mysql_connect('charlie', 'potiro', 'wR3VAT4h')))
die( " Could not connect to database" );

//open products database

if ( !mysql_select_db( "poti", $link) )
die( " Could not open prodcuts database" );

//query products database

if ( !( $result = mysql_query( $query, $link)))
{ print ( "Could not execute query!
" );
die( mysql_error() );}


<h3 style = "color:blue">Search Results</h3>

<table border = "1" cellpadding = "3" cellspacing = "2" style = "background-color: #ADD8E6">


//fetch each record in result set
for ( $counter = 0;$row = mysql_fetch_row( $result ); $counter++)
//build the table to display the items
print( "<tr>");
foreach ( $row as $key => $value )
print( "<td>$value</td>" );
print( "</tr>" );

mysql_close( $link );



Old 03-21-2005, 05:44 AM   #2
Senior Member
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
You should be able to simply add a target attribute to that "Show all the databases" link, but first you should remove all the leading spaces you have in your html attributes, coz that's not valid html.
Old 03-21-2005, 05:47 AM   #3
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Original Poster
Rep: Reputation: 15
using the target another window will open. i dont want that.

i want every thing to be opened in the same page but on the other frame.

can u plz tell me whats wrong with the HTML code u are talking about?

which spaces are not valid?

Edit: I just tried it. it opened another web browser window.

thats not what i want. my web page has three frames. all three frames have different web pages loaded into them.

the frame into which i want to load the result of the PHP script is upper.html that is the upper frame.

how do i do that?

Last edited by bahadur; 03-21-2005 at 05:54 AM.
Old 03-21-2005, 05:59 AM   #4
Registered: Apr 2004
Distribution: Linux Red Hat
Posts: 141

Original Poster
Rep: Reputation: 15
oh ok i did it.

i had to use the target attribute but instead of naming a webpage i directed it to the name of the frame i had declared earlier.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Php redirect script newuser455 Programming 2 08-03-2005 07:23 PM
Coding a redirect function in php mrobertson Programming 2 06-22-2005 08:40 AM
page redirect after selecting option in html juanbobo Programming 1 05-13-2005 07:05 AM
mod_python: Sending data to a redirect page nko Programming 1 04-12-2005 05:23 PM
PHP Redirect Elijah Programming 2 09-09-2004 09:56 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration