Lissa Explains it All:  Web Design Forums  

Go Back   Lissa Explains it All: Web Design Forums > LEIA Archives > Web Site Help > Advanced Programming

Notices

 
 
Thread Tools Display Modes
  #1  
Old 03-25-2004, 10:29 PM
P.T. P.T. is offline
n00bzilla
 
Join Date: Mar 2004
Posts: 1
P.T. is an unknown quantity at this point
Need Simple PHP Script

Hi, I'm new. I have grown very desperate to find a php script that will allow users to my web page to post a reply to this web page using a form box. I want the reply to be on the same page as the form box. I don't want a blog, or a forum. Just a simple script. I have looked everywhere, HotScripts you name it. I have tried a cgi/perl script but there seems to be a problem with the server I'm on using cgi/perl. I have tried two different perl scripts and have given up on this route. I have a php script that works fine as a email responder. I need this script to be very simple, as I don't know php at all. Any help would be greatly appreciated. Thank-you in advance. :present2: :present2:
Sponsored Links
  #2  
Old 03-26-2004, 12:59 PM
PunkGo PunkGo is offline
Beta Baby
 
Join Date: Jun 2003
Location: Right Behind You
Posts: 130
PunkGo is an unknown quantity at this point
u kinda want a comment box, eh? well...ok. ull need to make a mysql table, lets call it comments then make 2 fields, IP and message ( u can add more later)
now we have that, get done to the code...heres the textarea u should have..
Code:
<form action="post.php" method="post">
<strong>Post Comment</strong><br>
<textarea cols="4" rows="30" name="message"></texarea><br>
<input type="submit" name="submit" value="Submit">
</form>
ok...u can change the look of it if ya want. then create a page called post.php then put this stuff in..
PHP Code:
//Make sure you are connected to the mysql_db...then...

$ip = getenv ("REMOTE_ADDR");
$submit = $_POST['submit'];
$message = $_POST['message'];

if((!$submit) || (!$message)){
?>
you must type in a message or access this page from the comment form.
<?php
}
else {
mysql_query("INSERT INTO comments (ip, message)
VALUES('$ip', '$message')"
);
echo 
'success';
}
then when people go back to the comments page, have something like this..
PHP Code:
$query mysql_query("SELECT * FROM comments");
while(
$q mysql_fetch_array($query)){
echo 
$q['message'];

edit it if nessecary
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:36 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.