problem i cant see... :-(

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!

Moderator: General Moderators

Post Reply
legaxy
Forum Newbie
Posts: 19
Joined: Thu Mar 20, 2003 3:26 am
Location: Auckland, New Zealand
Contact:

problem i cant see... :-(

Post 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;
?>
?>
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

What's the problem....

If we don't know the problem, how are whe going to solve it?
legaxy
Forum Newbie
Posts: 19
Joined: Thu Mar 20, 2003 3:26 am
Location: Auckland, New Zealand
Contact:

Post 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.
User avatar
releasedj
Forum Contributor
Posts: 105
Joined: Tue Jun 17, 2003 6:35 am

Post 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_.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

legaxy
Forum Newbie
Posts: 19
Joined: Thu Mar 20, 2003 3:26 am
Location: Auckland, New Zealand
Contact:

Post 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.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post 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)
Last edited by m3mn0n on Fri Jun 20, 2003 6:04 am, edited 1 time in total.
User avatar
releasedj
Forum Contributor
Posts: 105
Joined: Tue Jun 17, 2003 6:35 am

Post by releasedj »

look at the form action. I think those variables are accessed using $_GET.
legaxy
Forum Newbie
Posts: 19
Joined: Thu Mar 20, 2003 3:26 am
Location: Auckland, New Zealand
Contact:

Post by legaxy »

sweet got it working, thanks!
Post Reply