Php 6.0 script error wont parse can you see error?

  • Thread starter Thread starter vill k
  • Start date Start date
V

vill k

Guest
parse error on 2nd line...
<?
if (($_POST[text1] == "") || ($_POST(func] == "")) {


header(Location: "generic_form.html");
exit;

}
$result = $_POST[func]($_POST[text1])
?>
<html>
<head>
<title>Generic input forms</title>
</head>
<body>
<?
echo "$result";
?>
<p><a href="generic_form.html">Go again!</a></p>
</body>
</html>
Please help i can be bothered to retype whole thing!!
Yeah it worked, but i cant see what you changed??!!!!
ahh yeah now i see ( to [ good spot m8 thanks
h yeah i now got error on line 6 but i cant see! i have addded a ; already
 
$result = $_POST[func]($_POST[text1])

I'm pretty much 90% sure you can't do this and you need to do

if($_POST[func] == "echo")
{
echo(text1);
}

or something similar...that is, if I've even interpreted what your intent is correctly.
 
change
if (($_POST[text1] == "") || ($_POST(func] == "")) {

to
if (($_POST[text1] == "") || ($_POST[func] == "")) {

I don't know if that fixes it, but it's a syntax error.


Hope this helps!

Abdurrahman Qadan


EDIT::

the problem here was you have
$_POST[func] written as $_POST(func]

PHP doesn't have a post written with parenthesis. It's written with [] for a reason that it's a list of arguments from the page posted. Hope this makes sense. If that wasn't the problem then edit the post and I'll take another stab at it.

Thanks!

You're welcome! Glad to help!
 
Back
Top