How to embed if statement inside echo

I'm gettin' a headache on that. I need to put if statement inside an echo (this echo is in a function, it's for a form submit actually) Here is an example on a partial of my code. In this situation, how can I put theses if statement inside my echo?? <?php echo '<td><select id="depuis" name="depuis"> <option value='4' <?php if(isset($_POST['depuis']) &a

如何在回声中嵌入if语句

我对此感到头疼。 我需要把if语句放在echo中(这个echo是在一个函数中,它实际上是一个表单提交) 这是一部分我的代码的例子。 在这种情况下,我怎么能把这些if语句放在echo中? <?php echo '<td><select id="depuis" name="depuis"> <option value='4' <?php if(isset($_POST['depuis']) && $_POST['depuis'] == '4'){ echo 'selected'; } else { echo ''; } ?> ></option>

if block inside echo statement?

I suspect it's not allowable because I am getting "Parse error: syntax error, unexpected T_IF in..." error. But I couldn't find a way to accomplish my goal. Here's my code: <?php $countries = $myaddress->get_countries(); foreach($countries as $value){ echo '<option value="'.$value.'"'.if($value=='United States') echo 'selected="selected"';.'>'.$valu

如果块内部的回声陈述?

我怀疑这是不允许的,因为我得到“解析错误:语法错误,意外的T_IF在...”错误。 但是我找不到实现我的目标的方法。 这是我的代码: <?php $countries = $myaddress->get_countries(); foreach($countries as $value){ echo '<option value="'.$value.'"'.if($value=='United States') echo 'selected="selected"';.'>'.$value.'</option>'; } ?> 它所做的是显示select元素中的国家/地区

Parse error: syntax error, unexpected end of file (Registration script)

I have a problem with my script :S This is the error:Parse error: syntax error, unexpected end of file Here is the full code.I searched for not closed bracklets or something but didn't found any :S I hope some of you guys can find the problem. <?php include "header.php"; include "menu.php"; ?> <div class="wrapper"> <table width=100%> <td valign=top width=230px>

解析错误:语法错误,文件意外结束(注册脚本)

我的脚本有问题:S 这是错误:解析错误:语法错误,意外的文件结束 这里是完整的代码。我搜索没有关闭的支架或什么,但没有发现任何:S我希望你们有些人可以找到问题。 <?php include "header.php"; include "menu.php"; ?> <div class="wrapper"> <table width=100%> <td valign=top width=230px> <div class="login"> <form name="register" method="post" action="

PHP Parse error: syntax error, unexpected end of file in a CodeIgniter View

I am getting an unexpected end of file error on my CodeIgniter View. I have pasted the PHP code at http://codepad.org/S12oXE4t. This code passed various online PHP syntax tests, but I don't know why still it shows me the below error while I was trying to run in WAMP Server. Parse error: syntax error, unexpected end of file in E:wampserverwwwCodeIgniterapplicationviewslayoutsdefault.php

PHP解析错误:语法错误,CodeIgniter视图中的文件意外结束

我在CodeIgniter视图中遇到unexpected end of file错误的unexpected end of file 。 我在http://codepad.org/S12oXE4t上粘贴了PHP代码。 这段代码通过了各种在线PHP语法测试,但我不知道为什么当我尝试在WAMP服务器中运行时,它仍然显示下面的错误。 Parse error: syntax error, unexpected end of file in E:wampserverwwwCodeIgniterapplicationviewslayoutsdefault.php on line 676 作为参考, line 676行是代码中的最

Parse error syntax error unexpected end of file, using PHP

What does this mean? My page had been working fine, but I updated XAMPP to a newer version, 1.8.1. After that I receive only this error message: Parse error: syntax error, unexpected end of file in C:xamppindex.php on line 106 <?php if (isset($_POST['submit'])) { include('Mysql.php'); // Include database connection settings $username=$_POST['username'];

使用PHP解析错误语法错误意外结束文件

这是什么意思? 我的页面一直工作正常,但我更新了XAMPP到更新的版本1.8.1。 之后,我收到只有这个错误信息: 解析错误:语法错误,第106行的C: xampp index.php中的文件意外结束 <?php if (isset($_POST['submit'])) { include('Mysql.php'); // Include database connection settings $username=$_POST['username']; $password=$_POST['password']; $username = s

PHP syntax error “unexpected $end”

I have 3 files 1) show_createtable.html 2) do_showfielddef.php 3) do_showtble.php 1) First file is for creating a new table for a data base, it is a fom with 2 inputs, Table Name and Number of Fields. THIS WORKS FINE! <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</tit

PHP语法错误“意外$结束”

我有3个文件1)show_createtable.html 2)do_showfielddef.php 3)do_showtble.php 1)第一个文件用于为数据库创建一个新表,它是一个具有2个输入的表格,表名和字段数。 这工作很好! <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <h1>S

Unexpected { expected (?

Parse error: syntax error, unexpected '{', expecting '(' in /home/a7237281/public_html/include/session.php on line 313 this is the error i get, relating to this code //check the emails $field = "email"; //Use field name for email $field2 = "email2"; if(!$subemail || strlen($subemail = trim($subemail)) == 0) { $form->setError($field, "* Email not entered")

意外{预期(?

解析错误:语法错误,意想不到的'{',期待'('在/home/a7237281/public_html/include/session.php在线313 这是我得到的错误,与此代码有关 //check the emails $field = "email"; //Use field name for email $field2 = "email2"; if(!$subemail || strlen($subemail = trim($subemail)) == 0) { $form->setError($field, "* Email not entered"); } else if { /* Check if

Parse error: syntax error, unexpected '{', expecting '(' help?

I'm trying to make a photo gallery plugin for express engine, yet it's giving me this error and everything seems to close. Any help? $whats_gonna_happen=$_GET['pictures']; class upload_pictures { public function upload_pictures { if (!isset($whats_gonna_happen)) { $uploads=''; $cout=1; $stuff=$this->EE->db->query('SEL

解析错误:语法错误,意外的'{',期待'('帮助?

我正在试图制作一个快速引擎的照片库插件,但它给了我这个错误,一切似乎都结束了。 任何帮助? $whats_gonna_happen=$_GET['pictures']; class upload_pictures { public function upload_pictures { if (!isset($whats_gonna_happen)) { $uploads=''; $cout=1; $stuff=$this->EE->db->query('SELECT id, name FROM albums'); $albums_lis

php syntax error on line 9

I have been staring at this for an hour now. It says I have an Parse error: syntax error, unexpected '{' in line 9. Could someone please look at this for me. Thanks in advance. <?php if(isset($_POST['submit'])) { function foo($a, $b) { foreach(array_keys($a) as $i) { if(array_key_exists($i, $b){ $result[$i] = $a[$i]*$b[$i]; }else{ $result[$i

第9行的php语法错误

我一直盯着这里一个小时。 它说我有一个分析错误:语法错误,第9行出现意外的'{'。 有人可以为我看看这个。 提前致谢。 <?php if(isset($_POST['submit'])) { function foo($a, $b) { foreach(array_keys($a) as $i) { if(array_key_exists($i, $b){ $result[$i] = $a[$i]*$b[$i]; }else{ $result[$i] = 0; } } foreach(array_keys($b) as $i) { i

How to fix syntax error in PHP "unexpected ')'"

我在下面的代码中的Foreach循环中有错误,任何人都可以帮助我解决错误... <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <?php $dbc=mysqli_connect("localhost","root","","elvis_store") or die("Error Connecting to Mysql Database"); if(isset($_POST['submit'])){ foreach($_POST['todelete'] as delete_id){ $query="DELETE FROM email_list WHERE id=$delete_id"; mysqli_que

如何修复PHP中的语法错误“意外”)'“

我在下面的代码中的Foreach循环中有错误,任何人都可以帮助我解决错误... <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <?php $dbc=mysqli_connect("localhost","root","","elvis_store") or die("Error Connecting to Mysql Database"); if(isset($_POST['submit'])){ foreach($_POST['todelete'] as delete_id){ $query="DELETE FROM email_list WHERE id=$delete_id"; mysqli_que