07-7-2007, 04:52 PM | #1 |
FFR Player
|
Kind of... template
So I'm just asking here since I don't know where to look for one of these:
I want to have comments after a certain article that users can write and have it right under the article when they submit. This involves some CSS/Javascript I assume but I'm almost positive there has to be a template somewhere. To be clearer, imagine an article, followed with a link to a window where they type their name, e-mail, and the actual comment, after which they'll hit submit and be redirected back to the article. Then, they'll be able to see their comment sitting right under the article, as will every other reader. Please reply if I'm being unclear or if you could aid me... something of that nature |
07-13-2007, 08:26 AM | #3 |
FFR Player
|
Re: Kind of... template
Here's a page for reference
http://sing365.com/music/lyric.nsf/I...2572D7001700C6 If you scroll to the bottom you'll find the Reviews. That's what I want to make. The question is: How? |
07-13-2007, 11:32 AM | #4 |
Banned
|
Re: Kind of... template
a form that feeds to a mysql database, using php i think i have like a template of something like that, i'll edit it in
|
07-15-2007, 12:49 PM | #5 |
~
Join Date: Feb 2012
Posts: 320
|
Re: Kind of... template
Here is a really simple "template" that I just wrote. I didn't test it, so I don't know if would even work. Commented most of the php...
This would require a MySQL database with a table containing the fields title, name, email, content, time. Code:
<?php //connect to MySQL server //localhost = server address //user = MySQL username //pass = MySQL password $connection = mysql_connect("localhost", "user", "pass"); //select DB to use mysql_select_db("comments_db"); //has someone submitted a comment? if(isset($_POST['submit_button'])) { //get post values from form $name = $_POST['name_value']; $email = $_POST['email_value']; $title = $_POST['title_value']; $content = $_POST['content_value']; //add the comment to the database $query = "INSERT INTO comments_table (title, name, email, content, time) VALUES('".$title."','".$name."','".$email."','".$content."', '".time()."')"; //did comment get added successfully? if(mysql_query($query)) { $submit_text = "Comment Added<br />"; //if not lets tell them it failed } else { $submit_text = "Comment Failed<br />"; } } //select all the comments from the database $query = "SLEECT * FROM comments_table ORDER BY time"; $result = mysql_query($query); //loop through all the comments and display them while($comment = mysql_fetch_array($result, MYSQL_ASSOC)) { ?> <?php print($submit_text); ?> <div style="border:1px solid #000;background:#CCC;width:200px;margin:2px;padding:2px;color:#FFF;"> <?php print($comment['title']); ?> - <?php if(!empty($comment['email'])) { ?><a href="mailto:<?php print($comment['email']); ?>"><?php print($comment['name']); ?></a><?php } else { print($comment['name']); } ?><br /><br /> <?php print($comment['content']); ?> </div> <?php } ?> <form method="post"> Name: <input name="name_value" type="text"><br /> Email: <input name="email_value" type="text"><br /> Title: <input name="title_value" type="text"><br /> <textarea name="content_value" cols="30" rows="4"></textarea><br /> <input name="submit_button" type="submit" value="Submit"> </form> Last edited by Summerschool; 07-15-2007 at 12:52 PM.. |
07-15-2007, 01:23 PM | #6 |
FFR Player
|
Re: Kind of... template
Thanks a lot, Summerschool. I'm definitely going to study that. Maybe I'll PM you later.
Again, thanks. |
07-20-2007, 01:15 PM | #7 |
Banned
|
Re: Kind of... template
Here's the simple form code:
Code:
<form id="contact" name="contact" method="post" action=""> <table width="600" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td width="110" valign="top" >Full Name:</td> <td width="470"><input name="name" type="text" id="fullname" size="30" value=""/></td> </tr> <tr> <td valign="top" >Email Address:</td> <td><input name="email" type="text" size="30" value=""/></td> </tr> <tr> <td valign="top" >Subject:</td> <td><input name="subject" type="text" size="30" value=""/></td> </tr> <tr> <td valign="top" >Message:</td> <td><textarea name="message" cols="60" rows="10" id="message"></textarea></td> </tr> </table> <p align="center"> <input name="contact" type="hidden" value="contact" /> <input type="submit" name="Submit" value="Submit" /> </p> </form> |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|