查找标签错误(分组标签)


Finding a tag error(grouping tags)

我认为我有一个标签错误,因为当我在"Coda 2"中分组代码时,它可以工作,但当我分组<html><body>时,它会产生一个错误。我把代码放在这里是为了让你帮我找出错误。

当我尝试运行它时,似乎代码在第97行有一个错误,就是它说的' }else {

echo "<p id='result_fail'>No puede exceder la cantidad especificada de caracteres.</p>";'
<html>
    <body>
<?php
        include('conexion.php'); 
                //CONDICION PARA LOS ERRORES
        if(isset($_POST['boton'])){
            }else if($_POST['date'] == ''){
                $error2 = '<span class="error">Ingrese la fecha</span>';
            }else if($_POST['subtitle'] == ''){
                $error3 = '<span class="error">Ingrese un subtitle</span>';
            }else if($_POST['image'] == ''){
                $error4 = '<span class="error">Ingrese la imagen</span>';
            }else if ($_POST['text'] == ''){
                $error5 = '<span class="error">Ingrese el texto</span>';
            }else{
                //DECLARAMOS VARIABLES
                $titulo = $_POST['title'];
                $fecha = $_POST['date'];
                $subtitulo = $_POST['subtitle']; //subtitle
                $imagen = $_POST['image']; //imagen
                $texto = $_POST['text'];
                $tiponot = $_POST['type'];
                //CHEQUEAMOS QUE LOS CONTENIDOS SEAN APROPIADOS
                    if ( (strlen($subtitle) <= 75) && (strlen($subtitulo) <= 75) && (strlen($texto) <= 5000) ) {
                        $titulo = trim($titulo);//ELIMINA ESPACIOS EN BLANCO
                        $temptitle = trim($titulo);//ELIMINA ESPACIOS EN BLANCO
                        $temptitle = strtolower($temptitle);//CONVIERTE TODO A MINUSCULA
                        //REEMPLAZA LOS CARACTERES CON SIGNOS, TILDES O COMAS, ETC POR CARACTERES LIMPIOS Y LOS ESPACIOS POR RAYAS PARA QUE SEA MEJOR ALMACENADO
                        $b = array("á","é","í","ó","ú","ä","ë","ï","ö","ü","à","è","ì","ò","ù","ñ"," ",",",".",";",":","¡","!","¿","?","/","*","+","´","{","}","¨","â","ê","î","ô","û", "^","#","|","°","=","[","]","&lt;","&gt;","`","(",")","&amp;","%","$","¬", "@","Á","É","Í","Ó","Ú","Ä","Ë","Ï","Ö","Ü","Â","Ê","Î","Ô","Û","~","À", "È","Ì","Ò","Ù","_","''","'"","'"");
                        $c = array("a","e","i","o","u","a","e","i","o","u","a","e","i","o","u","n","-","","", "","","","","","","","","","","","","","a","e","i","o","u","","","","","", "","","","","","","","","","","","","a","e","i","o","u","a","e","i","o", "u","a","e","i","o","u","","a","e","i","o","u","-","","","");
                        $temptitle = str_replace($b,$c,$temptitle);//TODO CARACTER DE $B QUE APAREZCA ES REMPLAZADO POR $C Y PUESTO EN $TEMPTITLE
                        $nombrearchivo .= rand(0,9) . rand(0,9) . rand(0,9). rand(0,9) . rand(0,9); //CONCATENA AL FINAL DEL ARCHIVO UN RANDOMIZE DE 5 DIGITOS DIFERENTES PARA DARLES UNA ID A CADA ARCHIVO Y QUE NO SE PISEN 
                        $titulo =    stripslashes($titulo); //ELIMINAMOS SLASHES
                        $nombrearchivo = $temptitle. '-';// PONE UNA BARRA MEDIA LUEGO DE TODA EL TITULO
                        $ext = '.php';//PONE TERMINACIÓN ".PHP" EN EL NOMBRE DEL ARCHIVO
                        $nombrearchivoext = $nombrearchivo . $ext;
                        //CREAMOS EL ARCHIVO
                        if (fopen($nombrearchivoext, 'w') == true ) {
                            echo '<p id="exito">Se ha creado <b>'.$nombrearchivoext.'</b> Correctamente</p>';
                            //ABRIMOS EL ARCHIVO Y LE METEMOS CONTENIDO
                            $fh = fopen($nombrearchivoext, 'w') or die("can't open file");
                            $content = '
                            <html>
                            <head>
                            <meta http-equiv="content-type" content="text/html" />
                                <meta name="author" content="www.visualsac.net" />
                                <link rel="stylesheet" type="text/css" href="style.css" />
                                <title>'.$titulo.'</title>
                            </head>
                            <div class="body">
                            <div class="global"> 
                                <h1>Global</h1>
                                <h2>HOME</h2>
                                     <? include("menubar.html")?>
                                     <div>'.$titulo.'</div>
                                     <p style="font-weight: bold ">'.$subtitle.'</p>
                                     <p style="font-family:Seogue UI;">'.$texto.'</p>
                                     </html>
           ';
                        fwrite($fh,$content);// ESCRIBIMOS LOS DATOS EN EL ARCHIVO. PONEMOS LAS DOS CONDICIONES QUE PIDE
                        $user = 'localhost';
                        $usuario = 'root';
                        $pass = '';
                        $tablename = 'noticias';
                        $connect = mysql_connect($user, $root, $pass)or die(mysql_error());
                            mysql_query("INSERT INTO $tablename values ('text','date','title','subtitle','image','type')") or die (mysql_error());   

                }else {
                        $result = '<div class="result_fail">No se pudo crear el archivo <img src="http://web.tursos.com/wp-includes/                        images/smilies/icon_sad.gif" alt=":(" class="wp-smiley"> </div>';
                        }else   {
                            echo"<p id='result_fail'>No puede exceder la cantidad especificada de caracteres. </p>";
                                }                       
                ?>
                <form class='contacto' method='POST' action=''>
                    <div><label>Tipo de nota</label><select type=checkbox name='type' value='<?php $_POST['type'];?>'>                                  <option>Business<option>lifestyle<option>technology</select></div>
                    <div><label>Date:</label><input type=date class='date' name='date' value='<?php echo $_POST['date']; ?>'><?php echo                     $error2 ?></div>
                    <div><label>subtitle:</label><input type='text' class='subtitle' name='subtitle' value='<?php echo                                  $_POST['subtitle']; ?>'><?php echo $error3 ?></div>
                    <div><label>Imagen:</label><input type='text' class='image' name='image' value='<?php echo $_POST['image']; ?>'>
                    <?php echo $error4 ?></div>
                    <div><label>Text:</label><textarea rows='6' class='text' name='text' value='<?php echo $_POST['text'];?>'><?php                     echo $_POST['text']; ?></textarea><?php echo $error5 ?></div>
                    <div><input type='submit' value='Envia Mensaje' class='boton' name='boton'></div>
                    <?php echo $result; ?>
               </form>
    </body>
    </html>

1个"if"有2个"else"语句

}else {
$result = '<div class="result_fail">No se pudo crear el archivo <img src="http://web.tursos.com/wp-includes/                        images/smilies/icon_sad.gif" alt=":(" class="wp-smiley"> </div>';
}else   {
echo"<p id='result_fail'>No puede exceder la cantidad especificada de caracteres. </p>";
}

如果您不显示消息"没有超过指定字符的队列"。If ((strlen($subtitle) <= 75) &&(strlen($subtitulo) <= 75) &&(strlen($texto) <= 5000) == false,然后在你的代码中添加";"

}else {
$result = '<div class="result_fail">No se pudo crear el archivo <img src="http://web.tursos.com/wp-includes/                        images/smilies/icon_sad.gif" alt=":(" class="wp-smiley"> </div>';
}**;**
else   {
echo"<p id='result_fail'>No puede exceder la cantidad especificada de caracteres. </p>";
}