GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Feb-2003, 14:30
demtro demtro is offline
Awaiting Email Confirmation
 
Join Date: Feb 2003
Location: Florida
Posts: 28
demtro is on a distinguished road

using a button to change table contents.


In brief here is what I have. I use tables for my entire website. I hate frames to please do not reccomend them. my index page has a 3 row 1 column table in it. in the 2 outer cells I have the buttons. The inner cell will contain data. I would like to set it up so when I click on one of the buttons, it takes an include file and places it in the center cell. and removes the include file that is currently there. Basically so I have one HTML page that loads with the logo and all the buttons. and when you click on a button to view the content. it places that content in the center cell. Any help would be appreciated. the site is www.countrysmokehouse.net. so you can see the current layout. I really need to get this done so i hope somebody can help me. Thanks

i can be reached at [removed]
  #2  
Old 02-Feb-2003, 17:36
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hi demtro,

I couldn't find the 3 rows / 1 column table on the page. Instead I found a 1 row and 3 column table.

Anyway, to do what you want to do, you should use some kind of server-side scripting e.g. ASP, perl or PHP (just to name a few).

Perhaps it might be possible to achieve the effect you want just using JavaScript but I don't think that will be very scalable for the long term.

Generally, posting your email address on message boards or forum posts is one sure way to get a lot of junk in your mailbox. So I will remove it before the spam bots that 'patrol the area', find it...
  #3  
Old 02-Feb-2003, 17:51
demtro demtro is offline
Awaiting Email Confirmation
 
Join Date: Feb 2003
Location: Florida
Posts: 28
demtro is on a distinguished road
I am sorry you are correct. I fat fingered the numbers. It is a 3 column 1 row table. I am thinking about using PHP to do it. but i need some guidence. I am just moving into using an actual language other then HTML to design a website, but i am not quite there yet. Any sample code you might offer or a website that might be able to lead me in the right direction would be most appreciative. Also I am willing to link to anybodys website from that site if they help me as a thank you for the help.
  #4  
Old 02-Feb-2003, 17:56
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Sure demtro, this is why this board is up - to help anybody.

One question you're going to want to ask yourself:

Database or Flatfile?
  #5  
Old 02-Feb-2003, 17:59
demtro demtro is offline
Awaiting Email Confirmation
 
Join Date: Feb 2003
Location: Florida
Posts: 28
demtro is on a distinguished road
For Now Flatfile. I really don't want to go the database route at this time. We are only at the current host for about 1 year and then moving to somebody else. So for the first year the site is up I want to keep it as easy as possible. In fact I have been working on the actual files I want to include in the center cell. So when i get the information I need I can just insert the code and we are close to done. Thanks You are all so kind.
  #6  
Old 02-Feb-2003, 18:01
demtro demtro is offline
Awaiting Email Confirmation
 
Join Date: Feb 2003
Location: Florida
Posts: 28
demtro is on a distinguished road
Also I am using Dreameweaver MX to design the site. I thought this might be important information.
  #7  
Old 02-Feb-2003, 18:15
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Okay then, let's say you have 1 file: index.php

PHP Code:

<?php

// index.php //

if( !isset($_GET['f']) ):
  // the user is at our homepage, so show him the default page
  $file2include = 'home';
else:
  // the user has selected a sub page
  switch( $_GET['f'] ):
    case 'about':
      $file2include = 'aboutus';
      break;
    case 'privacy':
      $file2include = 'privacy';
      break;
    default:
      $file2include = 'home';
  endswitch;
endif;

// now we include the 'article' to the page
require_once( './includes/'.$file2include.'.inc.php' );
?>


something like that?

so links on your website look like:

http://www.countrysmokehouse.net/
http://www.countrysmokehouse.net/?f=about
http://www.countrysmokehouse.net/?f=privacy
or
http://www.countrysmokehouse.net/index.php
http://www.countrysmokehouse.net/index.php?f=about
http://www.countrysmokehouse.net/index.php?f=privacy
  #8  
Old 02-Feb-2003, 18:29
demtro demtro is offline
Awaiting Email Confirmation
 
Join Date: Feb 2003
Location: Florida
Posts: 28
demtro is on a distinguished road
JDS This is great It is what I was looking for. Thank you. There is one other questions I have. What is needed to get the button to execute the code and load the right include? Or am I already missing something? So far we have the code that tells it we are going to include a file and it lists the files to include within the code. I just modify it for all my buttons. But what tells the code wen the button is pressed to load that specific page? Sorry if these are really newbie questions but I really need to get this done. Thanks again. You are being most kind.
  #9  
Old 02-Feb-2003, 18:35
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Right now, one of your button is linked like this:
HTML Code:
<a href="beefjerky.htm"><img src="Images/beefjerky.jpg" width="90" height="48" border="0"></a>

to have the php+include work, you change that to:
HTML Code:
<a href="/index.php?f=beefjerky"><img src="Images/beefjerky.jpg" width="90" height="48" border="0"></a>

and you have one file in your 'includes' folder named 'beefjerky.inc.php' i.e.
Code:
/home/demtro/public_html/includes/beefjerky.inc.php
  #10  
Old 02-Feb-2003, 18:39
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Code sample correction


Quote:
Originally posted by JdS
PHP Code:

<?php
// I just changed this line from the code sample above
// to insert a missing dot
require_once( './includes/'.$file2include.'.inc.php' );
?>

 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate a data change php form mjfmn MySQL / PHP Forum 4 20-Oct-2003 10:37
radio button problem zuzupus MySQL / PHP Forum 1 08-Aug-2003 04:25
Article by the W3C - Cool URI's don't change jrobbio Web Design Forum 4 28-Apr-2003 07:40
[Tutorial] MySQL Basics nniehoff MySQL / PHP Forum 15 23-Mar-2003 20:42

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:23.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.