What's wrong with this PHP Twitter API POST?

Whats wrong with these php scripts?

  • I have made two scripts and they both come up with errors. I can't seem to find anything wrong with them... Script 1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled</title> </head> <body> <a href="login.php">Admin Login</a> <?php $blogentry = $_POST['blog']; if ($blogentry != "") { echo = "/n"; echo = $blogentry; echo = "/n"; } else { echo = "empty"; } ?> </body> </html> ERROR = Parse error: syntax error, unexpected T_VARIABLE in /home/a2476846/public_html/blog.php on line 1 Script 2: <html> <body> <? $amount = "1"; $x = "1"; while ($x == $amount); { echo = "<script type=\"text/javascript\">"; echo = "alert (\'hi!\');"; echo = "</script>"; ++$x; } ?> </body> </html> ERROR = Parse error: syntax error, unexpected '=' in /home/a2476846/public_html/lolphp.php on line Thanks for all help

  • Answer:

    echo = "string"; is an error: echo "string"; is the right one. the /n should be \n (this is not an error raising problem, but you want a newline i supposed) fix them and it shoudl go by the way, you can write $x = 1;

Steve at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

In the scripts, you have a = after echo. You typed echo = "Hi!"; It should be echo "Hi!"; There were also some minor errors So your final scripts: ONE: <html> <head> <title>Untitled</title> </head> <body> <a href="login.php">Admin Login</a> <?php $blogentry = $_POST["blog"]; if ($blogentry != "") { echo "<br>"; echo $blogentry; echo "<br>"; } else { echo "Empty"; } ?> </body> </html> Two: Script 2: <html> <body> <? $amount = "1"; $x = "1"; while ($x == $amount) { echo "<script type=\"text/javascript\">"; echo "alert (\'hi!\');"; echo "</script>"; ++$x; } ?> </body> </html>

the semicolon after the while() will kill the while right there. There should be nothing but white space between the right paren ) and the { I have no idea why you are getting the parse error on the updated script. I pasted into a fresh php script, and it works for me. I might try making sure there's no white space before the first line. Also try taking out that whole Doctype line and see if your problem goes away.

Script ones errors suggests that there's something not closed properly above it, but I can't see anything in the script itself. Double check your quotations marks, brackets, and semi-colons. Script two has an extra semi colon on this line: echo = "alert (\'hi!\');"; Remove the semi colon after alert(\'hi!\') and the error should be resolved.

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.