473,404 Members | 2,114 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,404 software developers and data experts.

nusphere phped: variable post

Hello,
I'm using nusphere phped to develop php files. I have written
to files named a.php and b.php.

a.php:
------
<html>
<body>
please enter two numbers in the form.<br>
<form action = "b.php" method = "post">
Wert 1: <input name = "w1"><p>
Wert 2: <input name = "w2"><p>
<input type = "submit">
<input type = "reset">
</form>
</body>
</html>

b.php:
------
<html>
<body>
<?php

$erg = $w1 + $w2;
echo "sum: $erg";
?>
</body>
</html>

If I enter numbers in the form, the result (erg) is always 0.
Is it possible that the post method doesnt't work (I have the feeling that
w1 and w2 are local variables)?
Do I have to change settings in Nuspere phped?

Thanks a lot,
Mike
Jul 17 '05 #1
2 1846
I noticed that Message-ID:
<b2**************************@posting.google.com > from mi******@gmx.de
contained the following:
If I enter numbers in the form, the result (erg) is always 0.
Is it possible that the post method doesnt't work (I have the feeling that
w1 and w2 are local variables)?
Do I have to change settings in Nuspere phped?


Nope. Do this:

$erg = $_POST['w1'] + $_POST['w2'];
echo "sum: $erg";

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
Geoff Berrow wrote:
I noticed that Message-ID:
<b2**************************@posting.google.com > from mi******@gmx.de
contained the following:

If I enter numbers in the form, the result (erg) is always 0.
Is it possible that the post method doesnt't work (I have the feeling that
w1 and w2 are local variables)?
Do I have to change settings in Nuspere phped?

Nope. Do this:

$erg = $_POST['w1'] + $_POST['w2'];
echo "sum: $erg";


In order to make sure I get all of the variables, I use something like
this at the beginning of my scripts:
<?php
if (!empty($_GET))
{
extract($_GET);
}
else if (!empty($HTTP_GET_VARS))
{
extract($HTTP_GET_VARS);
}
if (!empty($_POST))
{
extract($_POST);
}
else if (!empty($HTTP_POST_VARS))
{
extract($HTTP_POST_VARS);
}

-- yes it is overkill, but everything works all the time now... :)

Michael Austin.
Jul 17 '05 #3

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

Similar topics

3
by: Ko Ko | last post by:
Dear All, I am wondering how to pass one variable from one php file to another continuously or discontinuously. For example, variable $a is declared in file1.php. I like to use that variable in...
3
by: Thomas Hoheneder | last post by:
Hello, I use PHP 4.3.10 and want to deliver a post variable from a PHP page to itself. In my page mypage.php I have a hidden field named "dbaction" and a form button. When clicking the form...
2
by: elektrophyte | last post by:
This is for people looking for a good PHP editor. NuSphere is a prominent editor that a lot of people use. I think it's well designed, has a lot of features, and is truly a pro tool that is...
5
by: flemming eriksen | last post by:
Dear NG. IIS5 (and II6) , ASP 3.0.; W2k, WS03. A websolution has a login-page, transaction page (just reading data), and logout-page Under heavy load I get in the IIS-Log : Too many...
3
by: Geoff Winsor | last post by:
Hi, I am experiencing a problem with recalling a session variable which stores whether a person is logged in to a "members only" section of a website. This area of the site has been working...
5
by: Chuck Anderson | last post by:
I have finally started coding with register_globals off (crowd roars - yeay!). This has created a situation that I am not sure how I should handle. I have scripts (pages) that can receive an...
10
by: Mason Barge | last post by:
I have a standard POST form consisting of two types of input: text input and textarea. The form downloads current settings from a mysql database. The user can update the information by modifying...
5
by: pavloutefkros | last post by:
sorry for creating a new post but this is totally different from the previous one. Here is the problem (which is very hard to explain, so i will use a paradigm): i submit a form and the post...
5
by: Twayne | last post by:
Hi, If ever a newbie wants to know how much he has to learn yet, he only has to look here<g>!! ANYway: PHP 5.2.5; XP Pro SP2+, local Apache Server My actual question is: How do I get a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.