LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 03-21-2005, 05:03 AM   #1
bahadur
Member
 
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

http://charlie.it.uts.edu.au/~jnsahibz/

u will be asked for a password and user name

USERNAME = www

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= "http://www.w3.org/1999/xhtml">
<head>
<title> Assignment # 1: Online Groccery Store </title>
</head>

<?php
//build the select query

$query = "select * from products";

// CONNECT TO MY SQL

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">

<?php

//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 );

?>
</table>

</body>

</html>
 
Old 03-21-2005, 05:44 AM   #2
Proud
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
bahadur
Member
 
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
bahadur
Member
 
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.

thanks
 
  


Reply


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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

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