Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > PHP
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 05-04-2005, 03:50 AM   #1 (permalink)
GameOn
Registered User
 
Join Date: May 2005
Posts: 4
GameOn is on a distinguished road
Dreamweaver button link to include file

Hi
Couple of small questions...

1.
I have about six buttons but I need one to link to a php include file... how do i do this???

I tried
<td align="left" valign="top" ><a href="<? include 'about.inc.php' ?>" target="_self"><img src="aboutus.gif" alt="Click here to view" width="143" height="35" border="0"></a></td>

But it just showed the contents of the include file underneath the previous button in the table...

Any ideas?
Also any ideas to my other hyperlink query post?


2.
Also, say a php file carries out a action like updating the database, you have a echo at the end once the update has occured confirming that it was successful.
I want to put it into another php file, eg. a successful comment in index, how do I do this?

I tried the echo before the include statement, but it put the comment above the page information rather then in the middle of it.

eg.
<?PHP
echo "<br>Update complete.\n
<br><br>
Here are the products.<br><br>";
include 'products.php';
?>

How do I get it to go to another page after its processed the info of the inc file, and put the confirm message (echo code in inc file) to another page.

At the moment I basically have to put the entire contents of the site on the processing page so that its not just a blank page with a confirmation message.
__________________
GameOn is offline   Reply With Quote
Old 05-04-2005, 08:27 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,398
sde is on a distinguished road
1. why do you need the about us button to link to an include file?

the function include() will make it as if the page that you are including is in the same script that you are calling the function. it would be like copying the contents of about.inc.php and pasting it in the href tag where you did.

it seems like you just need an aboutus.php page and just link to it normally like you would any other html file.

<a href=aboutus.php><img src=aboutus.gif></a>

#2 sorta goes along with the same logic. reasons for using includes are usually so you don't have to maintain the same code in various parts of the site. for example, i might make a database connection include file. i use a database connection on every page, but i make it an include so if i ever need to change my connection information, it updates on every page that it was included in.

for question2, you could go about it a couple different ways. the easiest is probably to do the processing on the same page and submit the form to itself. see the example below:
PHP Code:
<?
if($_POST){
  
// do the processing code here
}
?>
<form method=post action=<?=$_SERVER['PHP_SELF']?>>
<input type=text name=somefield> <input type=button name=submit value=submit>
</form>
in the processing area of that code, you could do whatever you want .. and you could even do an if/else to determine if you want to show that form or not.

alternatively, you could make the action of the form submit to a seperate page. in that case, your processing logic would be in that target page.
__________________
testing 1 2 3
sde is online now   Reply With Quote
Reply


Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
.h files needed Maani Standard C, C++ 7 02-02-2005 04:59 AM
.htaccess -- Image Hotlinking Prevention DavH27 HTML / CSS 0 08-27-2004 03:43 AM
.htaccess -- Custom Error Pages v1.1 DavH27 HTML / CSS 0 08-26-2004 04:40 PM
Static Link Library's Travis Dane C++ 0 03-19-2003 03:40 AM
Dynamic File Includes Sarlok ASP Classic 0 02-24-2003 12:49 PM


All times are GMT -8. The time now is 11:46 AM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle