Jump to content

Submitting Reviews


clbembry

Recommended Posts

I'm trying to create a review system. What I want the user to be able to do is type up a review in a textarea and then submit it. The submitted review will appear on the same page.How would I do this?Would I submit the text to a database. Then receive the information from the database?Edit: I found out what I needed to do. I've tried using the code below to submit what the user types in to the database. Then it is pasted on the page. I can't get it to work and I don't know why.I've read all of the tutorials for php on the w3schools website, but I think I need a better explanation. The code I have doesn't work, it would be a great help if you could tell me why.

<html><body><?php$con = mysql_connect("localhost",*****","*****");if (!$con){die('Could not connect: ' . mysql_error());}?><form action="index.php" method="post"><textarea name="review" cols=40 rows=6></textarea><br><input type="submit"></form><?phpmysql_select_db("******_reviews", $con);$sql = "create table rw;(review varchar(5000),)";mysql_query($sql,$con);mysql_select_db("******_reviews", $con);$result = mysql_query("select * from rw");while($row = mysql_fetch_array($result)){echo $row['review']}?><br></body></html>

Note: I'm a total Newb when it comes to PHP. I hardly even understand what is going on in the code above.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...