You are here: Re: simple formm & $_POST « PHP Programming Language « IT news, forums, messages
Re: simple formm & $_POST

Posted by Erwin Moller on 05/29/07 16:43

vinnie wrote:

> I have this form:
>
> <form action="http://www.XXXXXXX.com/form.php" method="post"
> name="form1" target="_blank" id="form1">
> <label>Nome &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> <input name="<b>name</b>" type="text" maxlength="45" />
> </label>
> <p>
> <label>Last
> <input name="last name" type="text" dir="ltr" maxlength="45" />
> </label>
> </p>
>
> now, i have made this php script just to echo the value in "name" and
> "last" but it doesn't work:
>
> <?php
> print("$_POST['name']");

Besides the namingproblem (boldtags), another thing:
You use:
print("$_POST['name']");

Why do you use the "" around the $_POST["name"] ?
simply do:
echo $_POST['name'];

You said you are a novice. My advise would be NOT to use
variablesubstitution in strings untill you understand what is happening.

eg:
$name="vinnie";
echo "Your name is $name";

Works just fine, but it is excactly the same as:
echo "Your name is".$name;

The above example wasn't very tricky, but this one is worse:
$name[0]["firstname"] = "vinnie";
echo "Your name is $name[0]["firstname"]";

which will result in an error (because of the "" used as stringdelimmiter
and in the name-array.).

Easier is just to assemble your string using . as glue:
echo "Your name is ".$name[0]["firstname"];


Regards,
Erwin Moller

> print("thanks, see you soon");
> ?>
>
> what's the error?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация