Jump to content

need a php script to generate


ralphiedee

Recommended Posts

Hello php gurus, I have a client that needs a form like the one in the url below. I design web sites but don't know.php The form needs to have the following fields where visitors can enter:

 

their e mail address

their comments

 

only their comments are displayed. Please see the image.

 

All of this in one script on one page, any help? http://www.mediafire.com/imageview.php?quickkey=2nthjm19hnd&thumb=4

 

I also need a second script for a separate page were visitors can register, log in and post.

Link to comment
Share on other sites

<?php

if(isset($_POST['email']) && isset($_POST['comment'])) {

if(!empty($_POST['email'])) {
  if(  !empty($_POST['comment']) {

// do stuff with your comment and e-mail here

  } else { die("Please type a comment."); }
} else { die("Please type your e-mail."); }
} else {

echo <<<_FORM
<form action="thispage.php" method="post">
E-mail <input type="text" name="email">
Comment <textarea name="comment"></textarea>
</form>
_FORM;

}

?>

 

try that.

 

Regards ACE

Link to comment
Share on other sites

this is more HTML friendly

<html>
<head>
</head>
<body>
<?php

if(isset($_POST['email']) && isset($_POST['comment'])) {

if(!empty($_POST['email'])) {
  if(  !empty($_POST['comment']) {

// do stuff with your comment and e-mail here

  } else { die("Please type a comment."); }
} else { die("Please type your e-mail."); }
} else {
?>
<!-- HTML FORM -->
<form action="thispage.php" method="post">
E-mail <input type="text" name="email">
Comment <textarea name="comment"></textarea>
</form>
<!-- HTML FORM -->
<?php
}
?>
</body>
</html>

Link to comment
Share on other sites

Thx 4 the html version, a few things.

 

How can I make the comment box appear as a bigger size?

 

I realized client needs a log in and p word so comments can be made by members.

 

I would need to create another page with a log in and password script and just put the link to the log in on top of the add email box?

 

If you look at the image in the url provided I need an exact match.

 

thx a million this is helping me big time!

 

respect!!!!!

Link to comment
Share on other sites

You will have to do the image your self, this is not the freelance section we are here to help not to do it all for you.

For registration you will need to decide whether to have it db driven or not , and then make a script from there.

<html>
<head>
</head>
<body>
<?php
if(isset($_POST['login']))
{
$username = "username";
$password = "password";
if($username == $_POST['password'] && $password == $_POST['password'])
{
$_SESSION['login'] = true;
}
else
{
echo "Wrong username or password";
}
}
if(isset($_SESSION['login']) == true)
{
if(isset($_POST['email']) && isset($_POST['comment'])) {

if(!empty($_POST['email'])) {
  if(  !empty($_POST['comment']) {

// do stuff with your comment and e-mail here

  } else { die("Please type a comment."); }
} else { die("Please type your e-mail."); }
} else {
?>
<!-- HTML FORM -->
<form action="thispage.php" method="post">
E-mail <input type="text" name="email">
Comment <textarea name="comment" cols="50" rows="10"></textarea>
</form>
<!-- HTML FORM -->
<?php
}
}
else
{
?>
Please Login
<form method="post" action="">
<input type="text" name="uname"/>
<input type="password" name="password"/>
<input type="submit" name="login" value="Log In"/>
</form>
<?php
}
?>
</body>
</html>

Link to comment
Share on other sites

Almost, I need to speak with the client to explain this. The log in and p word script would have to be database driven can a .php database do this?  If so I know the webhosting she has allows for .php its just a matter of getting the script together, I will not have need programming like don't allow bad words, or different levels of membership. Just a straight script like in the url

http://www.mediafire.com/imageview.php?quickkey=2nthjm19hnd&thumb=4

 

thanks again as it makes me think if I should give someone else the programming and stick with what I know. Everybody has a skill mine isn't .php I'm too busy in PShop, Flash, Xml and others

Link to comment
Share on other sites

I have part of the script here.

 

<form action="http://yoursite.com/wp-comments-post.php" method="post" id="commentform" name="commentform">
<div id="comment-loggedin" width="470px" style="display: none;">
<h3 id="respond" style="color:#CC0066;">Leave your comment</h3>
<p style="float: left;"><span style="color:#CC0066;font-weight:bold;">Welcome back, <span id="posse_nickname_slot"></span>!</span></p>

<p style="float: right;"><span style="color:#CC0066;font-weight:bold;">
<span id="posse_id_slot"></span> or
<a style="text-decoration: underline;" href="" onclick="javascript: logMeOut();return false;">logout</a></span></p>
<p id="posse_emptyavatar_note" style="font-size:9px;font-style:italic;padding-left:10px;color:#CC0066;display:none;clear:both;"></p>
<p style="clear:both;font-size:9px;font-style:italic;padding-left:10px;color:#CC0066">Note: Your comment may take a few minutes to appear.</p>
</div>
<div id="comment-login" width="470px" style="display: block;">
<h3 id="respond" style="color:#CC0066;">Leave your comment, <a style="color:#CC0066;text-decoration:underline;" href="http://yoursite.com:8888/register/?came_from=http://yoursite.com/2008-07-18" target="_blank">create a nickname and avatar</a> or 
<a style="color:#CC0066;text-decoration:underline;" href="http://yoursite.com:8888/login/?came_from=http://yoursite.com/2008-07-18">login</a></h3>
<p style="font-size:9px;font-style:italic;padding-left:10px;color:#CC0066">Note: Only registered commenters can have names longer than five letters. Your comment may take a few minutes to appear.</p>

<p>
<input type="text" value="" id="author" name="author" size="22" tabindex="1" />
<label for="author"><span style="color:#CC0066;font-weight:bold;">name *</span></label></p>
<p>
<input type="text" name="email" id="email" size="22" tabindex="2" value="" />
<label for="email"><span style="color:#CC0066;font-weight:bold;">email * (will not show on comment)</span></label>
</p>
</div>
<p><textarea name="comment" id="comment" cols="100%" rows="6" tabindex="4"></textarea></p>
<p><input name="submit" type="submit" id="submit" tabindex="5" value="submit comment" />
<input type="hidden" name="comment_post_ID" value="25416" />
</p>
<iframe id='logout-frame' style="display: none;"></iframe>

</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.