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

mysql query with single quotes in a variable
$sitedetails = "INSERT INTO vars (address, sitename, description, ownername, theme) VALUES ('$u

How do I give a developer access to a specific directory and nothing else?
I want to give a develop access to a specific directory and nothing else

I can give them an F

dynamic table with forms
I have a table that is populated with mysql data and in teh first column there is a raido button tha

preg-match with a string and numbers
Hi, I can't get the expression to work for my preg_match, what I'd like is for it to match the strin

Help with email validation please...
Hi,
Please could you help.
I have a register.php login page where users register, the detail

default SAP userid
hi,, I just like to know if it is ok to use the default SAP user id (SAP*)?

weeks in a year
hi,

i found this snippet on php.net
QuoteFor the week number for weeks starting on Sunday:

how to remove in php string display
My code is $message="We're looking at developing our website."; $body= "My mess

PHP & MS Access - Line Break
Hey Guys!

I'm pulling records from an MS Access database and listing them using PHP and I'm r

Form File Upload
I've read through tons of resources and tutorials and as far as I can tell, my code is accurate, but

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