473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Begininger to PHP, requesting a little help

I was looking through php.net's help guide and a few other documents
that I cam across on the web but I am still having trouble finding the
information I am looking for. So I came here...

Here is my question:
I was wondering if there was a way to load information into a page
without using SQL or anything fancy. Say I had a page setup with the
body of the page being pulled in with a 'require' command and a menu
bar on the left. (This page would be my index.php). I was wondering if
there was a way to make the links on the menubar pull different
information into the page where the require command is. Perhaps making
different links into variables and then calling those variables with
the menu links.

I really don't know how to explain this but I think it is rather
simple. If anyone knows how to go about this and would like to take
the time to respond to this it would be greatly appreciated. Thank
you!

Regards,

Eric Rines

Thanks in advance for any help with my issue at hand!
Jul 17 '05 #1
5 1694
Eric R. wrote:
I was looking through php.net's help guide and a few other documents
that I cam across on the web but I am still having trouble finding the
information I am looking for. So I came here...

Here is my question:
I was wondering if there was a way to load information into a page
without using SQL or anything fancy. Say I had a page setup with the
body of the page being pulled in with a 'require' command and a menu
bar on the left. (This page would be my index.php). I was wondering if
there was a way to make the links on the menubar pull different
information into the page where the require command is. Perhaps making
different links into variables and then calling those variables with
the menu links.

I really don't know how to explain this but I think it is rather
simple. If anyone knows how to go about this and would like to take
the time to respond to this it would be greatly appreciated. Thank
you!

Regards,

Eric Rines

Thanks in advance for any help with my issue at hand!


Perhaps something like:

index.php:

<html>
<head></head>
<body>

<table border=1 width=80%>
<tr>
<td width=200>
<ul>
<li><a href="index.php?t=main">Main</a></li>
<li><a href="index.php?t=news">News</a></li>
</ul>
</td>
<td>

<?php
$t=$_GET['t'];
switch($t) {
case ("main") :
require "main.php";
break;
case ("news") :
require "news.php";
break;
default:
require "home.php";
break;
}
?>

</td>
</tr>
</table>
</body>
</html>
Jul 17 '05 #2
On 18/11/04 11:15 pm, in article %1******************@news.xtra.co.nz,
"Sacs" <al**********@way.co.nz> wrote:
Eric R. wrote:
I was looking through php.net's help guide and a few other documents
that I cam across on the web but I am still having trouble finding the
information I am looking for. So I came here...

Here is my question:
I was wondering if there was a way to load information into a page
without using SQL or anything fancy. Say I had a page setup with the
body of the page being pulled in with a 'require' command and a menu
bar on the left. (This page would be my index.php). I was wondering if
there was a way to make the links on the menubar pull different
information into the page where the require command is. Perhaps making
different links into variables and then calling those variables with
the menu links.

I really don't know how to explain this but I think it is rather
simple. If anyone knows how to go about this and would like to take
the time to respond to this it would be greatly appreciated. Thank
you!

Regards,

Eric Rines

Thanks in advance for any help with my issue at hand!


Perhaps something like:

index.php:

<html>
<head></head>
<body>

<table border=1 width=80%>
<tr>
<td width=200>
<ul>
<li><a href="index.php?t=main">Main</a></li>
<li><a href="index.php?t=news">News</a></li>
</ul>
</td>
<td>

<?php
$t=$_GET['t'];


<snip>

I'm pretty new to this. Is $_GET the same as $HTTP_POST_VARS? If it is,
why are there 2 ways of doing it?

Andy

Jul 17 '05 #3
>
<snip>

I'm pretty new to this. Is $_GET the same as $HTTP_POST_VARS? If it is,
why are there 2 ways of doing it?

Andy

Hi Andy,

http://www.php.net/manual/en/reserved.variables.php

Well, $_GET uses GET variables (visible on the url), $HTTP_POST_VARS
uses POSTed variables (within a METHOD=POST form), so I think your
question is whether $_GET and $HTTP_GET_VARS are the same.

$HTTP_GET_VARS is used prior to PHP 4.1.0 and was not superglobal. Since
then it is reccomended to use $_GET and $_POST etc which are superglobals.

Apparantly... :-)

Sacs
Jul 17 '05 #4
I'm trying to pass a var called "u" in an url aka
www.mysite.com/myscript.php?text=string&u=BOOL. I need it to be read
as a bool so that a user could use 1,true,TRUE or 0,false,FALSE for
the value. how can i do this?

i have tried
if(isset($_GET['u']) && $_GET['u'] == 1)
{
$text = strtoupper($_GET['text']);
}
else
{
$text = $_GET['text'];
}
but 0,false,FALSE works and
1 works however true,and TRUE doesn't. i am somewhat new to php and am
sure it is something stupid that i have overlooked.
Sacs <al**********@way.co.nz> wrote in message news:<XG******************@news.xtra.co.nz>...

<snip>

I'm pretty new to this. Is $_GET the same as $HTTP_POST_VARS? If it is,
why are there 2 ways of doing it?

Andy

Hi Andy,

http://www.php.net/manual/en/reserved.variables.php

Well, $_GET uses GET variables (visible on the url), $HTTP_POST_VARS
uses POSTed variables (within a METHOD=POST form), so I think your
question is whether $_GET and $HTTP_GET_VARS are the same.

$HTTP_GET_VARS is used prior to PHP 4.1.0 and was not superglobal. Since
then it is reccomended to use $_GET and $_POST etc which are superglobals.

Apparantly... :-)

Sacs

Jul 17 '05 #5
Christopher A. Kelly top-posted:
I'm trying to pass a var called "u" in an url aka
www.mysite.com/myscript.php?text=string&u=BOOL. I need it to be read
as a bool so that a user could use 1,true,TRUE or 0,false,FALSE for
the value. how can i do this?

i have tried
if(isset($_GET['u']) && $_GET['u'] == 1)
{
$text = strtoupper($_GET['text']);
}
else
{
$text = $_GET['text'];
}
but 0,false,FALSE works and
1 works however true,and TRUE doesn't. i am somewhat new to php and am
sure it is something stupid that i have overlooked.


true and TRUE do not work (???) because they always go to the else part
of your if().
I'd do that somewhat differently:

if (isset($_GET['u'])) {
switch (strtolower($_GET['u'])) {
case '1':
case 'true':
case 'y':
case 'yes':
$text = 'TRUE';
break;
default:
$text = 'FALSE';
break;
}
}
--
Mail sent to my "From:" address is publicly readable at http://www.dodgeit.com/
== ** ## !! !! ## ** ==
TEXT-ONLY mail to the complete "Reply-To:" address ("My Name" <my@address>) may
bypass the spam filter. I will answer all pertinent mails from a valid address.
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DaRemedy | last post by:
Hello people, Just a quick question if you guys wouldn't mind answering or pointing me in the right direction. How would I go about creating something like the 'ScreenCam' thingy on...
25
by: Dynamo | last post by:
Hi The following script was taken from John Coggeshall's (PHP consultant) in his article on Zends site at http://www.zend.com/zend/spotlight/ev12apr.php // Get the email address to validate...
14
by: Nikola | last post by:
I need a function that reads from a txt file and randomly chooses a line from which retrieves a string (with spaces) and returns it to main function. thx
10
by: hecsan07 | last post by:
I am a novice programmer. I want to have a hyperlink that looks like so: www.mycoolsite.com?a=21132. On click I want to extract the query string and use it to query a table within a DB (SQL...
12
by: Tom | last post by:
Hi everyone, I don't know if anyone can help me, I've got roughly 25 forms in a site, with between 10 and 70 fields on each form. Now, these fields need to be inserted into a DB, each form...
22
by: pbd22 | last post by:
hi. I am having probelms with an update statement. every time i run it, "every" row updates, not just the one(s) intended. so, here is what i have. i have tried this with both AND and OR and...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
5
by: mcfly1204 | last post by:
I am attempting to use WebRequest to access a page that requires a login/password to access. My last WebRequest continues to timeout. Any help or thoughts would be appreciated. namespace...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.