Having trouble with a simple script, if there is something wrong with it, could you please tell me... You can see an example at

http://www.blackwoodenterprises.com/form.html

My service provider is GoDaddy.com


form.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<!-- Script 2.1 - form.html -->
<form action="handle_form.php" method="post">

<fieldset><legend>Enter your information in the form below:</legend>
<p><b>Name:</b> <input type="text" name="name" size="20" maxlength="40" /></p>
<p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength="60"/> </p>
<p><b>Gender:</b> <input type="radio" name="gender" value="M"/> Male <input type="radio" name="gender" value="F"/> Female</p>
<p><b>Age:</b>
<select name="age">
<option value="0-30">Under 30</option>
<option value="30-60">Between 30 and 60</option>
<option value="60+">Over 60</option>
</select></p>

<p><b>Comments:</b> <textarea name="comments" rows="3" cols="50"></textarea></p>

</fieldset>

<div align="center"><input type="submit" name="submit" value="Submit Information"/></div>

</form>
<!-- End of Form -->

</body>
</html>


handle_form.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php # Script 2.2 - handle_form.php
$name = stripslashes($name);
$comments = stripslashes($comments);

echo "Thank you, <b> $name</b> for the following comments: <br/><tt>$comments</tt><p>We will reply to you at <i>$email</i>.</p>";

?>
</body>
</html>

    that would be really awesome if you guys could help me out, I have no clue what's wrong...

      Er, GoDaddy hosts this, you say?? They use IIS?!

      Anyway... sounds like either a permissions problem or a setup problem.

      FTP into your site, and change the permissions on the .php file. If you use IE to FTP into the site, simply right click on the file, go to properties, and in the permissions box, give all three types (Owner, Group, All users) the 'execute' permission, so check all three checkboxes in the Execute column.

      If that doesn't work, contact GoDaddy and show them the error.

      EDIT: Also, if GoDaddy is a competent host in the least, they will have turned off register_globals, meaning you can't just use $name and expect PHP to know that's coming from a POST element, or a GET/SESSION/COOKIE/etc.

      Instead, use the superglobals as defined on this manual page: [man]variables.predefined[/man]

        Posted info about your code in an EDIT to my post, make sure you read that too!

          I used the ftp client that they provide and I was unable to right click on the certain files. Could you be more specific on right clicking on the files?

            What FTP client do they provide?

            Really, I don't like IE for FTP'ing (I like to see all the server messages, plus more FTP features), but you can always use IE since it does provide the ability to change file permissions.

            If you know the address to the GoDaddy FTP server (ftp.blackwoodenterprises.com and www.blackwoodenterprises.com both seem to have an FTP server listening), then just open up IE and type in [url]ftp://ftp.blackwoodenterprises.com[/url] (or www. if that's what you're told to use).

            Login using your FTP username and password when the dialog appears (if it doesn't ask you to login and just gives you a message about no anonymous access, click File -> Login As...), and try changing file permissions.

              Uhh yeah, those instructions were for IE only. IE = Internet Explorer, not FireFox. I know, I know, MSIE over FireFox shouldn't ever be said, but... for our purposes... sigh have to break out good ol' Internet Explorer.

                Definitely time to contact GoDaddy customer support.

                Give them the address of your form and tell them to post any sample data so that they can see the IIS error. You might even copy and paste it directly into your support request so they have it right in front of them:

                HTTP Error 403.1 - Forbidden: Execute access is denied.

                Furthermore, tell them that this problem ONLY occurs if data is being POST'd to the PHP script. Accessing the PHP script directly works just fine.

                Sounds like they're not allowing the PHP ISAPI module (I'm assuming it's installed as such) to access the POST verb. You might mention this as well.

                  ok thanks for all the help, i'll contact you if I have any further questions

                    Alrighty. Just reply to this thread if you have any more questions about this same problem - I'll stay subscribed to it.

                    EDIT: Good luck! 😉

                      Try changing

                      $name = stripslashes($name);
                      $comments = stripslashes($comments);

                      To

                      $name = stripslashes($_POST['name']);
                      $comments = stripslashes($_POST['comments']);

                        EDIT: Grr! Didn't see the 2nd page w/ Houdini's response (I do this too often, lol).

                        Yes, register_globals is turned off (which is a good thing), so you have to use the superglobals such as $_POST. More info on the superglobals can be found at this man page: [man]variables.predefined[/man] .

                          🙂

                          Thanks a ton guys, thanks for all the help.

                          !!!!!!!!!!!

                            Write a Reply...