0

Where is a problem? Then I open .PHP on my /localhost show message "Parse error:syntax error, unexpected T_STRING in ..." maybe code is incorrect?

<?php
        if($_POST) {
            $name = $_POST['news_name'];
            $content = $_POST['news_text'];
            $handle = fopen ("z_padomi_ka_atmest_smekesanu.php","a");
            fwrite($handle,"<b>".$name."</b>:<br/>".$content."<br/>
            fclose($handle);
            }
        ?>

<script type="text/javascript">


    document.getElementById('com-form').action = "z_padomi_ka_atmest_smekesanu.php";


   </script>
    <form action = "" method="post">
    <p class="left"><label for="news_name"><b>Vārds:</b></label><br/><input type="text" name="news_name" id="news_name" value="" size="15" class="input big8"></p>
    <p class="even"><label for="news_text"><b>Pievienot atbildi:</b></label><br/><textarea name="news_text" id="news_text" cols="75" rows="3" wrap="virtual"></textarea></p>
    </p><p class="buttons right"><input id="add" type="submit" value="Pievienot" class="submit"><br>
    <li><a style="text-decoration: underline; padding-right:10px; padding-top:5px" href="pamaciba.html" target="_blank">Komentāru noteikumi</a></p>
    </form>
        <?php include "z_padomi_ka_atmest_smekesanu.php";
    </script>
1
  • Look at the end of the fwrite call, you forgot to end the function call and also the string is missing closing quotes. Commented Nov 23, 2013 at 19:16

1 Answer 1

2

You forgot to close a string.

Change this

fwrite($handle,"<b>".$name."</b>:<br/>".$content."<br/>
fclose($handle);

To this

fwrite($handle,"<b>".$name."</b>:<br/>".$content."<br/>");
fclose($handle);

EDIT

You forgot a php close tag too :

<?php include "z_padomi_ka_atmest_smekesanu.php";
    </script>

To

<?php include "z_padomi_ka_atmest_smekesanu.php"; ?>
    </script>
Sign up to request clarification or add additional context in comments.

2 Comments

and probably forgot to close the <?php tag on the bottom
Yep, I didn't see. I add it to my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.