Click to See Complete Forum and Search --> : using GET command instead of POST


russellkain
01-30-2006, 09:40 AM
Apparently my sh**ty web provider doesn't allow POST commands. How would I change my files to use the GET command instead? Input file lets user input email address, posts to php file (submit.php) and then writes to subscribers.txt.

input.htm
<html>
<head>
<title>Subcribe</title>
</head>
<body>
<form name="subscribe" action="submit.php" method="POST">
Enter your email address : <input type="text" name="emailadd" /><br
/>
<input type="submit" name="submit" value="Subscribe" />
</form>
</body>
</html>

submit.php
<?php
$emailAddress = $_POST['emailadd'];
if(!$emailAddress)
{
echo "Please enter your email address.";
exit;
}
else
{
$filename = "subscribers.txt";
$content = "$emailAddress\n";
$fp = fopen($filename, "a");
$fw = fwrite( $fp, $content );
fclose( $fp );
if(!$fw) echo "Couldn't write the entry.";
else echo "Successfully wrote to the file.";
}
?>

any ideas?

regards,
Russell

LiLcRaZyFuZzY
01-30-2006, 09:43 AM
simply change the POST to GET, but ..are you sure that POST doesn't work? did you try it?

russellkain
01-30-2006, 09:47 AM
yeah possitive, i hear it has something to do with my provider as im getting this error message

http://orbitalsys.pwp.blueyonder.co.uk/TESTING/screenshot_error.jpg

so in the input.htm file i just change the line
<form name="subscribe" action="submit.php" method="POST"> to
<form name="subscribe" action="submit.php" method="GET">

and do i change submit.php like this
$emailAddress = $_POST['emailadd']; to
$emailAddress = $_GET['emailadd'];

thanks
Russell

LiLcRaZyFuZzY
01-30-2006, 10:11 AM
yep, that's it

oh, and your host probably sucks!

russellkain
01-30-2006, 10:23 AM
Yeah I guessed that, but its FREE! :)
Its the webspace my ISP game me when i signed up with them

regards,
Russell