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.

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

Auto install
Hi I have a directory lets say "apps" that I then have more folders ie "email",

Echoing If Function?
A script I am using has If statements in the comments form to basically tell the form what to do. Cu

Problem with Subscreen
Dear Experts ,
I am facing a problem with the subscreens. My senario is as follows :

Reditecting pages based on logic
Newbie here, apologies in advance!

I am trying to use the header function to forward one of a

PHP and Javascript
Hello Everyone,

I have a page that needs a javascript code to be written between PHP code but

Add_Months not Easy to Understand
Oracle is number 1, very fast and very easy. But....
OK, I think but have a problem, only 1 pro

How to create a static html menu from a database
Hi,

I have built a small cms which allows me to create simple html pages and then upload them

Keeping track of php uploads
Hello all.

I was looking at the way PHP handles file uploads.
It seems that PHP uses a tem

Multi Dimensional Array Append
Hi Guys

I have a function that returns a multidimentional array eg

$result = functio

retrieving more than one max key from an array?
so i have an array of 20 numerical values (0-100) that i need to order from highest to lowest and th

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