472,989 Members | 3,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

call function in different php files

Hi, I wrote a php project 2 years ago. I am totally lost right now.
what is differnt between $userName, $_GET['userName'] and
$_REQUEST['userName']? In my past project, I remember i can use
$userName as a variable, but i dont know why I cannot use it again
because of using different version of php and apache? What is
different between "printf", "print" and "echo"? Can you guys help me
fix my a little project too? Thanks

Two files
testing1.php
<?php

require ('testing.php');

if(!$_REQUEST['submit1'])
{

MainFrame();
}
else if ($submit1 == "Receiving")
{
print $_REQUEST['username'];
}
else

print $_REQUEST['sumbit1'];

?>

testing.php
<?php

function MainFrame()
{
print ("<form action = "testing1.php" method="POST">
<input type ="text" name="username"><br>
<input type ="submit" name="submit1" value="Receiving">
<input type ="submit" name="submit1" value="Invenory">
<input type ="submit" name="submit1" value="Assembly">
<input type ="submit" name="submit1" value="Tracking">
<input type ="submit" name="submit1" value="Reports">
<input type ="submit" name="submit1" value="Setup">
</form>
")

?>

I get these errors:

Parse error: parse error, unexpected T_STRING in c:\program
files\easyphp1-7\www\testing.php on line 5

Notice: Undefined index: submit1 in c:\program
files\easyphp1-7\www\testing1.php on line 6

Fatal error: Call to undefined function: mainframe() in c:\program
files\easyphp1-7\www\testing1.php on line 9

Thanks,
Krista
Jul 17 '05 #1
6 16511
"Perhaps the most controversial change in PHP is when the default value for
the
PHP directive register_globals went from ON to OFF in PHP 4.2.0. "

http://pl2.php.net/register_globals

IMHO U have 2 ways

1. Use $_GET, $_POST, $_SERVER
or
2. Set the register_globals=on in php.ini

:) i hope this helps you out :)
Jul 17 '05 #2
Hi Krista,
what is differnt between $userName, $_GET['userName'] and
$_REQUEST['userName']?
The GET-Variables are submitted like this:
http://domain.tld/file.php?variable=value

So $_GET['variable'] contains "value".
In my past project, I remember i can use
$userName as a variable, but i dont know why I cannot use it again
because of using different version of php and apache?
If the option of register_globals is switched on in the php.ini you can
use $variable instead of $_GET['variable'], too.
If it is switched off, like the default setting in the newer php
versions, you can't.
What is different between "printf", "print" and "echo"?


Difference between echo and print:
http://www.faqts.com/knowledge_base/...l/aid/1/fid/40

printf is to print a formatted string.
http://de2.php.net/manual/en/function.printf.php

Saludo
Paul.
Jul 17 '05 #3
Krista wrote:
What is
different between "printf", "print" and "echo"?


printf is formatted print, as:
printf("Error %s occurred on line %d", $error_desc, $error_line);

print and echo are close to the same thing. IIRC, print returns but
echo doesn't.

Jul 17 '05 #4
Keith Bowes <do****@spam.me> wrote in message news:<dL*************@fe10.private.usenetserver.co m>...
Krista wrote:
What is
different between "printf", "print" and "echo"?


printf is formatted print, as:
printf("Error %s occurred on line %d", $error_desc, $error_line);

print and echo are close to the same thing. IIRC, print returns but
echo doesn't.


Hi,
I still get a problem if i set global_register to on. I cannot pass
the value to the different php files. The example as following:

Testing.php
<?php

function abc()
{
print("<form action = "testing1.php" method="GET">
<input type ="text" name="username"><br>
<input type ="submit" name="submit1" value="Receiving">
<input type ="submit" name="submit1" value="Inventory">
</form>
}
?>
Testing1.php
<?php

require ("testing.php");

if(!$sumbit1)
{
abc();
}
else if ($submit1 == "Receiving")
{
print "Receiving";
}
else if ($submit1 == "Inventory")
{
print "Inventory";
}
else
{
print "Thank";
}
?>
Then i am tring to run it in IE: http://localhost/testing1.php
but the result is nothing on the IE.
Therefore, what is the problem in my problem or my config has a
problem?
Thanks,
Krista
Jul 17 '05 #5
Krista wrote:
Testing1.php
<?php

require ("testing.php");

if(!$sumbit1)

_____ $submit1 ___

Perhaps this is better? :-)
put
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>

at the very beginning of the scripts you're writing/debugging so that
php itself will tell you about some mistakes (with its notices and
warnings).
Happy Coding
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #6
Keith Bowes <do****@spam.me> wrote in message news:<dL*************@fe10.private.usenetserver.co m>...
Krista wrote:
What is
different between "printf", "print" and "echo"?


printf is formatted print, as:
printf("Error %s occurred on line %d", $error_desc, $error_line);

print and echo are close to the same thing. IIRC, print returns but
echo doesn't.


Hi,
Even though I changed the global_register to on in php.int . I still
cannot use $username. Anybody can help?

Thanks,
Krista
Jul 17 '05 #7

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

Similar topics

7
by: Bruce W...1 | last post by:
I'm a PHP newbie coming from experience with ASP.NET. I want to have a separate PHP file to support each HTML PHP page. This would be the equivalent of an ASP.NET code-behind file but using PHP....
10
by: Carramba | last post by:
hi! I don't have eny code to chare, this is just teoretical question. usualy you have for looks like <form method="POST" action="some_php_script.php"> namn: <input type="text" name="name"...
5
by: Rob | last post by:
Help me, I'm just beginning with programming in Access 2000. I've tried the http://www.mvps.org/access/api/api0001.htm but it won't work in Access. What am i doing wrong. I don't have...
6
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
6
by: mygoogleaccount | last post by:
Hi, may be someone could help me ? i need to use cyrillic letters in a php application. I changed everything to UTF-8 and it works fine. The only problem are CYRILLIC SMALL LETTER ES...
2
by: duzhidian | last post by:
Hello all, Since I need call a function in different php files, I want to put the funcion in a seperate file instead of copying and pasting into each php file. The benefit is that when I...
9
by: Allen | last post by:
The arguments of function is variable. Given function address, argument type and data, how to dynamically call the function? The following is pseudo code. int count = 0; int offset = 0; char...
2
by: dolphin | last post by:
What is the different between c++ call convention and c call convention?Can some give some examples?
35
by: jleslie48 | last post by:
I've written a cgi program in C using the borland 5.5 free compiler, and it runs just fine on an Apache server. My only issue is if I issue some system calls the cgi suspends until the call...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.