Computer problems,Computer help
*AX SOFT>>>Programming & Design

Whats wrong with this php code?


i need people to post comment on my site, i dont know whats wrong with this

<?php
$name = $_POST['name'];
$comments = $_POST['comments'];
# $fp = fopen($_SERVER['DOCUMENT_ROOT']."/youtub...
if (!$fp)
{
echo " there was an error! try again later!";
exit;
}
else
{
$outputstring = "name; ".$name."<br> comments:<br>" .$comments."<br>";
fwrite($fp, $outputstring, strlen($outputstring));
fclose($fp);
echo "your post was posted successfully. Click <a href='us08.html'()> here </a> to continue";
}

?>

Take out the # before $fp

You need to escape those single quotes in the 'echo' at the end, also I don't know what the () is for.....try this:

echo "your post was posted successfully. Click <a href=\"us08.html\"> here </a> to continue";

Also after $ouputstring you would need to escape the ; character and I don't think you need the extra "...it should be like this:

$outputstring = "name\; $name<br> comments:<br>$comments<br>";

Finally the output line should read:

fwrite($fp, $outputstring);

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • How can I learn how to build wire frames?

    For anything you want to know about 'how to', just type the question into your Google slot - how to make wire frames : - how to make wireframes & schematics - Scifi-Meshes.com Hi...

  • How do I use footnotes on microsoft word?

    Word has a very good footnote system that will automatically maintain the numbering sequence no matter what you do to the footnotes. It will also do its darnedest to keep the footnotes on the page...

  • Hai guys i'm doing a project in C++.i want to know how to update the contents of a file in c++.?

    If you mean updating the data that is already in the file (for instance, changing a word in the file to another word), then you'll need to open the file for reading, read the whole file into a...

  • How to smooth this 3ds max model?!?

    Usually you get the best results from NURMS ("non-unified rational meshsmooth") Apply the Meshsmooth modifier and under 'method' choose 'NURMS'. You can increase the...

  • Anyone know anything about this company?

    Not much to do with programming :S

    ...
  • What is the purpose of the val( ) function in visual basic?

    a. Fo-rizzle

    ...
  • Alternative dedicated server to godaddy please?

    i personally use 3ix this company is awesome and i have never had any problems with them. for 拢50 a year you can get 500 gigabytes webspace,99 uptime,unlimited bandwith,unlimited mysql databases...

  • What are the types of Assembly Language? Give the sample of each.?

    Assembly languages are usually specified by the CPU that runs them, so some examples are: 8080, 8086, 6502, Z80, 8051, 68K, and so on. Different vendors use different "styles" for the...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster