473,547 Members | 2,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbie. Just starting PHP. . . need help

pr00xysp00f3r
2 New Member
I am just starting to learn PHP and as I read through my textbook, I am uploading the code examples, to try them out and get hands-on experience and all have worked up until this point. I am just curious as to what I have done wrong with this code.

<html>
<head>
<title>HelloFor um.php</title>
</head>
<body>

<?
//Print a greeting if the form was submitted
if ($_POST['user'])
{
print "Hello, ";
// Print what the user submitted in the forum
print $_POST['user'];
print "!";
}
else
{
// otherwise display the forum!
print <<<_HTML_
<form method="POST" action="$_SERVE R[PHP_SELF]">
Your Name: <input type="text" name="user">
<br/>
<input type="submit" value="Say Hello">
</form>
_HTML_;
}
?>

</body>
</html>
May 1 '07 #1
2 1144
devsusen
136 New Member
Hi,

u should write

[PHP]if (isset($_POST['user']))[/PHP]

I am just starting to learn PHP and as I read through my textbook, I am uploading the code examples, to try them out and get hands-on experience and all have worked up until this point. I am just curious as to what I have done wrong with this code.

<html>
<head>
<title>HelloFor um.php</title>
</head>
<body>

<?
//Print a greeting if the form was submitted
if ($_POST['user'])
{
print "Hello, ";
// Print what the user submitted in the forum
print $_POST['user'];
print "!";
}
else
{
// otherwise display the forum!
print <<<_HTML_
<form method="POST" action="$_SERVE R[PHP_SELF]">
Your Name: <input type="text" name="user">
<br/>
<input type="submit" value="Say Hello">
</form>
_HTML_;
}
?>

</body>
</html>
susen
May 2 '07 #2
pr00xysp00f3r
2 New Member
THANK YOU :)

Hi,

u should write

[PHP]if (isset($_POST['user']))[/PHP]



susen
May 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1709
by: karokat | last post by:
Hi, I want to learn how to program and python seems to be the most intuitive language according to various internet sources - but I'm not sure if it's best for newbies... please advise.. Anyway, my first project I would like to make is a simple proggie - a simple note 'library', with basic formattable text, to store, edit and access my notes....
3
7754
Eclipse
by: Eclipse | last post by:
G'day All I am just starting to learn programming and need a bit of help with this one. I want to be able to create a list containing Path, Directory, Filename and write them out to a csv file (ie path,dir,file). This is what i have so far: import os import csv writer = csv.writer(open("C:\Documents and Settings\Smythville\My...
2
1266
by: empirion98 | last post by:
Ok....I'm looking to setup a website that has a login and my friends can have profiles...I guess sort of like myspace where you can have info on them. Let them put up pictures and maybe have a chat section within the page. Is this too lofty of a goal for someone that is new? I'm just starting computer classes but we just briefly covered HTML. ...
4
1447
by: Grayham | last post by:
Hi all I am new to this group so 'Hello All' I have a PC which is running linux and in it have installed a digital satellite card. I would like to write some software to access the card, tune it and bring back video. Basically a home brew DVB-s application. Being a non/new programmer (apart from some basic too many years ago) I decided...
3
1090
by: Harlett O'Dowd | last post by:
Please forgive this newbie question but java is new to me and I'm still trying to find a course in my area. I'm tweaking an online survey and have gotten it to display what I want but can't figure out how to *require* the surveyee to pick a choice. For each of ten questions, the surveyee is asked:
6
1391
by: damiensawyer | last post by:
Hi, Can someone please explain to me something about delegates? My understanding is as follows. A delegate is basically an object that can hold a reference to a "method" somewhere. That is, it's essentially a pointer to a piece of code somewhere else in memory. It therefore (to me anyway) makes sense to define delegates with their...
6
11472
Markus
by: Markus | last post by:
Things to discuss: Headers What are they? What does PHP have to do with headers? Why can they only be sent before any output? Common causes
0
7510
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
7437
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...
0
7703
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7463
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
6032
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
3473
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1050
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
748
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.