|
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
> <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]
|