Most basic form question ever?


Posted on 16th Feb 2014 07:03 pm by admin

Hello,

I want to use this snippet to make sure the fields in a form are ok before processing it.

Did you know?Explore Trending and Topic pages for more stories like this.
Code: <FORM method="post">
To:


<input type="text" name="name" size="40" value="<?php if($name) { print $name; } else { print "Insert Name"; } ?>">

<input name="action" type="submit" value="Update Form">

</FORM>

It works, but I don't understand why.

The if statement is checking for the variable $name, but I haven't used the code that I would normally use.

What I see in all my tutorials would lead me to use...

$name= $_POST['name];

So, I'm confused as to where the $name variable is being found.

Thanks for your patience
No comments posted yet

Your Answer:

Login to answer
168 Like 18 Dislike
Previous forums Next forums
Other forums

some questions
Hello,

I am looking for the answers for following questions:

1) Does PHP support overl

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

Points for Wiki contribution
Hi everyone,

I want to know how long does it take for the moderator to award points for a

Typing math
I've added support for typesetting math using LaTeX on the forums.

Example:
Code: [Select]

Multiple WHILE loops help
Hi there. I'm writing an application that is pulling and displaying results for real estate listing

ob_ dynamic content
i was wondering about the potential to use ob to create a <div then remove it when the page

Selecting an "empty" date formated field
How do you select an "empty" date field? I've tried the few ways I can think.
SQL> select

Help with looping
I have a comma separated list of colors taken from a database ($ICo) and a directory of images named

HTML Viewer HIDE scrollbar
How can I disable scrollbars in a HTML Viewer control? I can't hide them. Even i have enough space b

Can't shake the "Warning: include()" error
I've just uploaded my site to a new server and where I have PHP include tags in my HTML, the browser

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash