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

jquery validation in codeIgniter
hai i need to add client side validation to my fiels which are selected in a forloop.the fields are

Gerenate tabel in Php
I whant to generate a tabel takeing data from database like this one so the results to be display on

Program with calculate Meteorologic measurements
Hello I'm a beginner and I want to make a program with calculate Meteorologic measurements:
ba

Beginner PHP code help
Hi I'm new to php but if someone could please read the question below and help it would be great.

using a loop help
Hi guys , i need some help. I have this loop :
while ($row = mysql_fetch_assoc($Result)) { ?&

Asset Transfer from One plant to another within same company code
Hi,

Please advise how to transfer one asset from one plant to another plant within same c

List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab

undefined offset help
Hi All,

I kept getting undefined offset PHP notice for a simple for loop. For eg
$va = arr

Problem with PHP code- simple contact form
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form wit

Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :

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