| | |
Comment Box
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2008
Posts: 2
Reputation:
Solved Threads: 0
Hi Everyone,
I am very new to web design and just starting to get the basics of CSS and html. Designing is so much fun! My site includes articles and I thought it would be cool to include a comment box. Before coming here I have read many many posts about how to create this.
I am leaning towards using php and setting up a mysql database with my godaddy account. Through the forums I have read, it looks like I have to create two php pages one for adding comments and one for processing comments.
Do I use an html page with reference to the php page (comment box form is in html)?? In other words which page will be used to display the whole page.
How do you control where the comments end up displaying.
ex. above the comment box or below the comment box.
I am very new to web design and just starting to get the basics of CSS and html. Designing is so much fun! My site includes articles and I thought it would be cool to include a comment box. Before coming here I have read many many posts about how to create this.
I am leaning towards using php and setting up a mysql database with my godaddy account. Through the forums I have read, it looks like I have to create two php pages one for adding comments and one for processing comments.
Do I use an html page with reference to the php page (comment box form is in html)?? In other words which page will be used to display the whole page.
How do you control where the comments end up displaying.
ex. above the comment box or below the comment box.
If you have any <?php ?> tags in your script, you have to save it with the extension .php . If you want to save it with .html extension, then you need to modify your htaccess file. You can make use of only 1 page/script to do everything.
-- list the comments here --
...
....
Have the fields for name, comments etc, with a submit button. When the form is submitted, get the values and insert it to the table ! A small example.
This is just an example. And comments should be above the 'comment box'..
Cheers,
Naveen
-- list the comments here --
...
....
Have the fields for name, comments etc, with a submit button. When the form is submitted, get the values and insert it to the table ! A small example.
php Syntax (Toggle Plain Text)
<?php if(isset($_POST['submit'])){ $comment=$_POST['comment']; $q="insert into comments_table (comment) values ('$comment')"; mysql_query($q); } $q="select comments from comments_table"; $result=mysql_query($q); while($row=mysql_fetch_array($result)){ //list the comments echo $row['comments']."<br />"; } ?> <html> <body> <form method="Post" action="comments.php"> <textarea name="comments" rows=30 cols=10></textarea> <input type="submit" name="submit" value="submit"> </form> </body> </html>
Cheers,
Naveen
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- How to create a Comment Box/Guestbook in HTML (Site Layout and Usability)
- Adding a comment box (HTML and CSS)
- Comment BOX (HTML and CSS)
- comment box (JavaScript / DHTML / AJAX)
- Text input box alignment question (HTML and CSS)
- Isass.exe unable to initialise (Troubleshooting Dead Machines)
- A question on java script?(Please answer ASAP) (Java)
Other Threads in the PHP Forum
- Previous Thread: Change my IF statement to a loop
- Next Thread: limits
| Thread Tools | Search this Thread |
apache api array basic beginner broken cache cakephp class cms code computing confirm countingeverycharactersfromastring cron curl customizableitems database date delete dynamic echo email error fcc file filter folder form forms forum freelancing function functions gc_maxlifetime google header headmethod howtowriteathesis href htaccess html iframe image include incode ip javascript joomla limit link login malfunction match memmory memory menu method mod_rewrite multiple mysql navigation neutrality oop pagerank parsing paypal pdf php phpmysql query question random recursiveloop root script search select server sessions sms snippet soap source space sql support! system table template thesishelp trouble tutorial upload url variable video web window.onbeforeunload=closeme; youtube






