473,408 Members | 1,857 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,408 software developers and data experts.

problem with learning PHP

hello,

I'm trying to learn the basics of PHP, but when I try to
run a little simple script I received a error on my screen:

Notice: Undefined variable: verzenden in c:\program files\apache
group\apache\htdocs\test\formulier1.php on line 7
this is the source:

<form name="formulier1" action="formulier1.php" method="get">
Voer alstublieft uw voornaam in: <input type=text
name=voornaam><br><br>
Voer alstublieft uw achternaam in: <input type=text
name=achternaam><br><br>
<input type=submit name=verzenden>
</form>
<?php
if($verzenden){
echo "<b>Hartelijk welkom, $voornaam $achternaam.</b>";
}
?>

is my installation wrong of PHP ?

did I forget some source ?

thanks,

Jonay
Jul 17 '05 #1
4 2131
Jonay Herrera wrote:
hello,

I'm trying to learn the basics of PHP, but when I try to
run a little simple script I received a error on my screen:

Notice: Undefined variable: verzenden in c:\program files\apache
group\apache\htdocs\test\formulier1.php on line 7
this is the source:

<form name="formulier1" action="formulier1.php" method="get">
Voer alstublieft uw voornaam in: <input type=text
name=voornaam><br><br>
Voer alstublieft uw achternaam in: <input type=text
name=achternaam><br><br>
<input type=submit name=verzenden>
Better would be:
<input type=submit value="verzenden">

and check in the following PHP for the existance of some variables.
</form>
<?php
if($verzenden){
Better would be to check IF a certain variable is send to this page.
Use isset() for this.
So:

if (isset($_GET["voornaam"])
echo "<b>Hartelijk welkom, $voornaam $achternaam.</b>";
}
?>

is my installation wrong of PHP ?

did I forget some source ?

thanks,

Jonay

But more important is this: You expect PHP to create the variables you send
with your form to be automatically created, eg: you expect the variable
$voornaam to be created JUST because you send it.
This used to be true for older versions of PHP, but (luckily) they changed
the default behaviour of PHP.
This is done in the php.ini under the name of: register_globals

here is a piece out of php.ini:

; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily
lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off

So, I guess you have register_globals set to off too, as it should be.

Just use $_GET["varnamehere"] and $_POST["varnamehere"] to retrieve the
values.

Regards,
Erwin
Jul 17 '05 #2

"Jonay Herrera" <jo***********@pandora.be> wrote in message
news:41**************************@posting.google.c om...
hello,

I'm trying to learn the basics of PHP, but when I try to
run a little simple script I received a error on my screen:

Notice: Undefined variable: verzenden in c:\program files\apache
group\apache\htdocs\test\formulier1.php on line 7
this is the source:

<form name="formulier1" action="formulier1.php" method="get">
Voer alstublieft uw voornaam in: <input type=text
name=voornaam><br><br>
Voer alstublieft uw achternaam in: <input type=text
name=achternaam><br><br>
<input type=submit name=verzenden>
</form>
<?php
if($verzenden){
echo "<b>Hartelijk welkom, $voornaam $achternaam.</b>";
}
?>

is my installation wrong of PHP ?

did I forget some source ?

thanks,

Jonay

Hi,

you can try it also with method="post" or just send verzenden as hidden
field (it must be between <form> and </form> tags):
<input type=hidden name=verzenden value=1>

It's a small workaround, but it should work

Lot of fun learning PHP.

Regards,
Damir
Jul 17 '05 #3
With total disregard for any kind of safety measures "Damir
Mehmedovic" <sr**************@gmx.net> leapt forth and uttered:
It's a small workaround


Completly wrong though.

--
There is no signature.....
Jul 17 '05 #4
Go into php.ini and turn off E_NOTICE.

Uzytkownik "Jonay Herrera" <jo***********@pandora.be> napisal w wiadomosci
news:41**************************@posting.google.c om...
hello,

I'm trying to learn the basics of PHP, but when I try to
run a little simple script I received a error on my screen:

Notice: Undefined variable: verzenden in c:\program files\apache
group\apache\htdocs\test\formulier1.php on line 7
this is the source:

<form name="formulier1" action="formulier1.php" method="get">
Voer alstublieft uw voornaam in: <input type=text
name=voornaam><br><br>
Voer alstublieft uw achternaam in: <input type=text
name=achternaam><br><br>
<input type=submit name=verzenden>
</form>
<?php
if($verzenden){
echo "<b>Hartelijk welkom, $voornaam $achternaam.</b>";
}
?>

is my installation wrong of PHP ?

did I forget some source ?

thanks,

Jonay

Jul 17 '05 #5

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

Similar topics

68
by: Marco Bubke | last post by:
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I...
5
by: Nickolay Kolev | last post by:
Hi all, I have set to implementing a few basic algorithms in Python serving a twofold purpose: learning the algorithms and learning Python a little better. I have however encountered a...
3
by: Stephen | last post by:
Hello I am using C++ 5.0 learning edition, to compile an DirectX8.0 SDK program sample included with the SDK download I keep getting a linker error --------------------Configuration: Donuts3D...
5
by: | last post by:
We have this situation: We have a unmanaged c++ executable located in a certain folder (a.exe) It loads a mixed mode managed/unmanaged dll using MFC dynamically from a completely different path...
27
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
40
by: rdemyan via AccessMonster.com | last post by:
I have two databases, db1 and db2, with the same table, TableA. I want to select the records from TableA in db1 that have a LAST_UPDATE SomeDate. Then I want to get the identical records in TableA...
5
by: Alex Mathieu | last post by:
Hi, using sscanf, I'm trying to retrieve something, but nothing seems to work. Here's the pattern: SS%*sþ0þ%6s Heres the data: SS000000395000000000DC-þ0þ799829þ1174503725þ Actually, I...
9
by: Jerim79 | last post by:
Here it is: <?php if($_SERVER=='POST'){ $Number=$_POST; $Email=$_POST; $Number2=0; $error=0;
3
by: webandwe | last post by:
Hi, I got form that let you state a folder name, on sumbit thw script creates the folder with the name you stated, the problem is I want it to upload the php file "view.php" when the folder is...
16
by: John Salerno | last post by:
Just something that crosses my mind every time I delve into "Learning Python" each night. Does anyone see any value in learning Python when you don't need to for school, work, or any other reason?...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...

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.