解析错误:语法错误,意外的 '}' 但找不到另一个 [英] Parse error: syntax error, unexpected '}' but can not find another

查看:45
本文介绍了解析错误:语法错误,意外的 '}' 但找不到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我创建了一个表单,它有一个字段但有多个提交按钮.表格正确,没问题.编写 php 代码以根据按下的按钮执行操作时遇到问题.不断收到解析和语法错误.我尝试了使用 if/else 语句和 isset 的不同变体.仍然没有运气.而且我没有看到任何我知道的额外 }.

Ok so I created a form that has one field but multiple submit buttons. Have the form correct, no problem there. Have an issue writing the php code to perform an action depending on which button is pressed. Keep getting a parse and syntax error. I have tried different variations of using the if/else statements as well as isset. Still no luck. AND I don't see any extra } that Im aware of.

    <?php
if($_REQUEST['Gift'] == "Dish1")
{
  header("Location: url1".urlencode($_POST['uid']))
}

else if($_REQUEST['Gift'] == "Dish2")
{
  header("Location: url2".urlencode($_POST['uid']))
}

else if($_REQUEST['Gift'] == "Dish3")
{
  header("Location: url3".urlencode($_POST['uid']))

}

.....等?>

它说错误是在线 5 .... 不确定他们如何解析他们的行,因为实际的 url 地址本身很长并且都不包含 }

It says the error is online 5.... not sure how they parse their lines as the actual url addresses are quite long themselves and none contain }

推荐答案

您在标题语句的末尾缺少 ;.

You are missing a ; at the end of your header statements.

} 不是预期的,因为首先需要 ;(或其他允许的东西).

The } is not expected because a ; (or something else allowed there) is required first.

这篇关于解析错误:语法错误,意外的 '}' 但找不到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆