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

Procedural to OOP
ohn Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO pri

rand() function
just a general question guys a girls, is the rand() function 100% random or is it based on time?

Standard DES encryption script?
Can anybody point me to a tutorial or a short script that shows how to encrypt some text with salt i

checkbox update
I am having a brain fart right now and i cant remember how to do this. if anyone could help that wou

help with multi-update
Now sure how to ask this really....
10g database if that matters.

I have a customer

url- go to webpage
i have an input text field and submit button.

how do i make the url entered into the textfiel

php + mysql count consecutive data
I have a database of values and I want to work out how to display them if the values match a consecu

Log $_POST
How would i log submits on a form, by everyone? I want to then echo the number of submissions.

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

convert static html data into dynamic
hi all

i need to convert a website which has static above 2000 articles into dynamic and add

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