473,568 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1705
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**********@w ay.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($_GE T['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**********@w ay.co.nz> wrote in message news:<XG******* ***********@new s.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($_GE T['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($_G ET['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
1530
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 http://www.xenocoder.co.uk/wordpress/ If you look on the top right corner of the page there is a little window which displays his desktop and when clicked upon,...
25
6454
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 $email = $_POST // Use John Coggeshalls script to validate the email address if(!eregi("^+(\.+)*@+(\.+)*(\.{2,3})$", $email) { echo "The e-mail was...
14
1450
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
1787
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 Server). The stored procedure takes the query string as a parameter and returns the actual URL the page is going to be redirectted. I can do this using a...
12
1519
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 has it's own table and each column is named the same as it's corresponding form field. Make sense? My question is, is there a quicker way of...
22
5407
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 neither seem to work. i dont know why this is elluding me, but i'd appreciate help with the solution.
53
4637
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, and .Net2005 code. I'm developing in vb.net 2005. This test sub just reads an input text file, writing out records to another text file, eliminating...
0
5542
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 ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
5
3189
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 FormsAuthTest { class Program { static void Main(string args) { HttpWebRequest request = null;
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.