PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm having a problem with this, I want to make it so that people will fill out a form on feedback.php (which is included into my main template) which then gets posted to feedback&status=post which takes those fields and mails them to me.
Not too sure what I am doing wrong, any advice would be good, THANKS!!
<?php
<?
$date = date("H\:i\:s d\/m\/Y");
$name = $POST_[name];
$email = $POST_[email];
$email = $POST_[comments];
$message = "$name <$email> submitted the following on $date. $comments" ;
?>
<?
$status ;
if ($GET_['status'] === post) {
if each(!$http_POST_VARS[name]){ ///trying to get rid of empty fields
echo "You haven't filled out all of the fields"
}
else {
mail("chris@southernhosting.net", "Feedback from VenturerWeb", $message,
"From: VenturerWeb\r\n"
."Reply-To: chris@southernhosting.net\r\n"
."X-Mailer: PHP/" . phpversion());
echo "<span class"bodytext">Thanks for your comments, we'll read them as soon as possible. If you need to contact the editor further please contact him at his <a href="index.php?page=profile&person=chris" class="link">profile.</a></span>";
}
}
else {
echo <<<END
<form name="feedback" method="post" action="index.php?page=feedback&status=post">
<p class="bodytext">Please let us know what you think of our website! Any thoughts,
ideas, problems just type them in the box and let us know, we will get on to
it as soon as possible! </p>
<p>
<label>
<input name="name" type="text" value="Name" class="textfield">
</label>
</p>
<p>
<label>
<input name="address" type="text" value="e-mail address" class="textfield">
</label>
<label> </label>
</p>
<p>
<label>
<textarea name="comments" class="textfield">Your comments</textarea>
</label>
</p>
<p>
<label>
<input type="hidden" name="date" value="{$date}">
</label>
<label>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="reset" value="Reset">
<br>
<span class="note">please click submit only once</span></label>
<label> </label>
</p>
<p>
<label> </label>
</p>
</form>
END;
?>
?>
opps forgot the most important part didn't I!, well the first problem is i dont get anything appear when i just go index.php?page=feedback or when i visit feedback.php either. And when i set the variables myself and then run the script from feedback&status=post i dont get any response either... In both cases I get nothing.. no errors.
Thanks Sami I actully have read that tonight already. Yes I have exploited most alternatives to doing this, so was just asking for perhaps a little advice in the correct area, sorry bout the setting of the variables... minor blonde moment, but those variables should have nothing to do with the echoing of the actual form.
anyway thanks.
sorry couldnt come up with an intelligent subject or that my particular problem doesnt seem to appear on google.
How come that one if statement is searching for a status variable with a value of post, being sent by the GET method when the entire form is being sent with the POST method?
That question came to me when looking over your source a few times. I bet that's the problem.
Suggestion: For a script like this where security isn't a big deal, i would use the $_REQUEST global array instead of POST or GET. That way no matter which method is in use, it will still function properly.
Last edited by m3mn0n on Fri Jun 20, 2003 6:04 am, edited 1 time in total.