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

Could Someone Please Debug This?
I was wondering if someone could debug this script for me. I realize it's not the tidest script (and

max() problem
I have a while loop to get image names.
Code: $imagequery = mysql_query("SELECT * FROM ad_i

Is STL important?
I'm just starting programming and I've made it until the Standart Template Library. But the chapter

Mail form doesn't send Russian/Cyrillic characters correctly?
When someone enters foreign characters (like Cyrillic text, and Japanese/Chinese probably gives the

Array help
Hello i got this code to fetch data from database but it is not working it displays
7
Array

Product categories for registration
Dear all,

We are going live with the Supplier registered next week. At standard, the 'sel

Creating web pages by php
Hello again,
I was just wondering us there a way to use a php script to create a new web page. I

Show specific day of the week
I have been racking my brain trying to get this function to work properly and it is doing so for eve

Passing JS to PHP
So I have the following
Code: <?php
getdetails(?><script type="text/

DateObject and Nulls
Hi all,

I have an array mapped to a value object. One of the items in the array is a PHP Date

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