Page not sending POST data

Hi,

I have this problem with my web host. I created a script that handles a form on my website and tried it out on my local host (my computer); it works fine. When I put it online, it didn’t work. I used a simple troubleshooting method to see if any data was present in the $_POST variable on the live site…it wasn’t. I have contacted my web host (hostmonster) 3 times and they have replied saying, “although we don’t have support for scripting problems…” I don’t need scripting support. lol It works, just not on their server! Any advice?

Thanks,

Paul

Can you post the code you’re using?

class Request {
		
		public $out;
		
		public function contact() {
			
			if ($_POST) {
				extract($_POST);
				if (!empty($name) && !empty($email) && !empty($message)) {
					if (!mail("MY_EMAIL", "New message from {$name} (BDi)", $message, "From: {$email}")) {
						$this->out = "Unable to send message at the moment; please try again later.";
					} else {
						$this->out = "Success! We'll get back to you as soon as possible!";
					}
				} else {
					$this->out = "Please fill in ALL fields";
				}
			} else {
				$this->out = "Please fill out the form to contact us";
			}
			
		}
		
	}

And I’m echoing out Request::$out from an object.

It works on my local server, but just won’t work online!!! :sick:

Before diving into a class, I’d suggest making a simple form with a var_dump($_POST) and start there.

<?php var_dump($_POST); ?>

<form action="" method="POST">
<input type="text" name="test" value="" />
<input type="submit" name="submit" value="POST" />
</form>

Let us know the results to make sure data is being POSTed properly.

Hey,

I got it sorted thanks. I took your advice and var_dump()'d the $_POST array and to my surprise, it was because of a .htaccess rule that it wasn’t working. Thanks a lot! :slight_smile:

Glad to help :slight_smile: