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

Newbie. Just starting PHP. . . need help

pr00xysp00f3r
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>HelloForum.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="$_SERVER[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 1136
devsusen
136 100+
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>HelloForum.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="$_SERVER[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
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
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,...
3
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...
2
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...
4
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...
3
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...
6
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,...
6
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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,...

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.