ok, so i kinda found this script online.this is for a personal site, just for fun. now, everything works, but how do i get the comment to show up on the website "something.php"? i can get up to when i click submit it will goto the website but then it will not show any comments.i am using dreamweaver. i figured that i had to make a .php page so the comments can goto that.help with a n000b<h2 id="respond">Leave a Comment</h2> <form action="something.php" method="post" id="commentform"> <p> <input type="text" name="author" id="author" value="" size="30" tabindex="1" /> <label for="author">Name</label> </p> <p> <input type="text" name="email" id="email" value="" size="30" tabindex="2" /> <label for="email">E-mail</label> </p> <label for="email">Comment</label><br /><textarea name="comment" id="comment" cols="70" rows="10" tabindex="4"></textarea> </p> <p> <input name="submit" type="submit" id="submit" tabindex="5" value="Submit" /> </p> </form>[Edited on May 15, 2008 at 11:19 AM. Reason : ]
5/15/2008 11:18:43 AM
is there something i have to do to the "something.php" page? to make it accept the comments?
5/15/2008 11:25:03 AM
php code in something.php needs to get the post variables.so to display a page that just says whatever was put in the "Name" text field:<?phpecho $_POST['author'];?>where inside the brackets is the value of the name tag in the input. $_POST is an array of values passed by a form that uses method="post"[Edited on May 15, 2008 at 11:27 AM. Reason : note: this data won't be saved unless you write to a file or saved to a db]
5/15/2008 11:26:31 AM
hah, cool. ok so i kinda got the idea.now i just gotta find out how it saves so it doesnt get re-written each time someone leaves a comment.so when i find a way to save, that will give me the chance to also go into the .php file and erase test comments and stuff?
5/15/2008 11:45:49 AM
in order to save anything submitted (to pull back up later), you're going to need a database of some sort...the easiest thing to do in this case might be a flat XML file or something
5/15/2008 12:01:35 PM
5/15/2008 12:10:44 PM
time to read some online tutorials!
5/15/2008 12:18:59 PM
ok. so i get that i need to make a database to save the info.dreamweaver has an XML file i can make.but i dont know where to start with it. and the net isnt really helping. well im sure it is, but im not understanding a lot of it. when i click new file->XMLits blank. what do i put.
5/15/2008 2:49:21 PM
ok so godaddy.com can create me SQL database.thats sounds easy enough. now i dont know how to incorporate that into the webpage comment code and the something.php code.
5/15/2008 3:41:31 PM
http://www.php-mysql-tutorial.com/
5/16/2008 12:45:14 AM
i think this is a lot more complex than you're thinking it's going to be...it's not HARD, but there is a bit of a learning curvethe first thing you're going to want to do (IMO) is create your form with all the fields you're going to want...second, create your database with those fields as your columns...i don't know what database tool you're using or what kind of SQL database you're using, so you're going to have to be more specific or figure that out on your ownmy suggestion, for now, is to not use "something.php" but instead put <?php $PHP_SELF ?> in there (so it will refer to itself once your submit your form instead of looking for another document)...this might help you learn a little more quicklymy suggestion would also be to create something like a "connect.php" page that will have your user name, password, database connection information, table name, and the actual connection script in it, so that you can just include it into any other pageon that form page (which will be a .php page), you're going to want something like this (though anyone feel free to correct me, i'm doing this just before i have a day of boring meetings ):
<?phpinclude("connect.php");if(isset($_POST['submit'])) { $author = $_POST['author']; $email = $_POST['email']; $comment = $_POST['comment']; $query = "INSERT INTO $table (ID, AUTHOR, EMAIL, COMMENT) VALUES (SEQ_COMMENTS_DB.nextval, '$author', '$email', '$comment')"; $statement = oci_parse($connect, $query); oci_execute($statement); oci_free_statement($statement);?>
5/16/2008 9:38:40 AM
good deal. yeah. that link above your post has also helped. im using godaddy hosting and they have 1 free SQL database i can make. so it asks for a new table, i named it comment and "number of fields" is 3 ( Name, Email, Comment )so then on this page i insert the fields. do i do anything to the other spaces?im actually starting to get the hang of this. i think i can do most of it except setup the database with different variables here and there.[Edited on May 16, 2008 at 10:08 AM. Reason : ]
5/16/2008 10:06:04 AM
welcome to the web. It only gets easier from here
5/16/2008 1:44:12 PM