Page 1 of 1

problem i cant see... :-(

Posted: Fri Jun 20, 2003 1:30 am
by legaxy
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!!

Code: Select all

<?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">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    <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;
?>
?>

Posted: Fri Jun 20, 2003 2:36 am
by []InTeR[]
What's the problem....

If we don't know the problem, how are whe going to solve it?

Posted: Fri Jun 20, 2003 2:44 am
by legaxy
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.

I suspect it lies in the section

Code: Select all

<?php
$status ;
if $status === post
?>
but the main point is.. i believe my theory is correct, but something in the syntax is just not passing something through.

Posted: Fri Jun 20, 2003 5:06 am
by releasedj
I have just very quickly looked at the top of the code. The variables you're using are incorrect:

Take a look at http://php.net/variables.predefined it shows you that the predefined variables are named $_GET, $_POST ...etc. Not $GET_ and $POST_.

Posted: Fri Jun 20, 2003 5:16 am
by m3mn0n

Posted: Fri Jun 20, 2003 5:40 am
by legaxy
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.

Posted: Fri Jun 20, 2003 6:02 am
by m3mn0n
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. 8)

Posted: Fri Jun 20, 2003 6:03 am
by releasedj
look at the form action. I think those variables are accessed using $_GET.

Posted: Fri Jun 20, 2003 7:57 pm
by legaxy
sweet got it working, thanks!