Using PHP on iWeb V2.0 on Leopard 10.5

Discussion in 'Web Design and Development' started by JelvisChan, Jan 10, 2009.

  1. JelvisChan macrumors member

    Jan 9, 2009
    PHP on iWeb '08​

    Does anyone know a way to use php on iWeb '08?

    Here are the codes I am trying to process:

    <form method="post" action="contact.php">
    Email: <input name="email" type="text"><br>
    <textarea name="message" rows="15" cols="40"></textarea><br>
    <input type="submit">

    $subject "Join Us";
    $email $_REQUEST['email'] ;
    $message $_REQUEST['message'] ;
    $headers "From: $email";
    $sent mail($to$subject$message$headers) ;
    "Your mail was sent successfully"; }
    "We encountered an error sending your mail"; }

    How, on iWeb, is there a way so that I can put the HTML inside a snippet, and when you click submit query, it redirects to the thank you, good job, or whatever page? This would be EXTREMELY helpful!

    Help if you can! Thanks.
  2. mikes63737 macrumors 65816

    Jul 26, 2005
    Where are you going to be hosting this?

    If you're using MobileMe, it can't be done because it doesn't support PHP.

    If you're using another web host, FTP in to the server and add the file (contact.php) to the same directory as the file with the form. iWeb isn't made to support PHP so it requires some work.

    Also, I'm not sure, but I think you should change the $_REQUEST's to $_POST
  3. SrWebDeveloper macrumors 68000


    Dec 7, 2007
    Alexandria, VA, USA
    Yes, it is always "best practice" to use $_POST if form method=post or $_GET if form method=get in PHP. If you're wondering $_REQUEST has been around since PHP 4.1.0 and is a superglobal like the other two discussed here, meaning its value is available in all memory scopes and you don't need to import it via the "global" command in functions/classes. It also contains $_POST, $_GET and $COOKIE superglobals as well. Developers using PHP4 often got lazy and used this convenient superglobal for obvious reasons since in most php.ini default configurations it was enabled. It's still available in PHP5 but usually disabled in the config for security reasons. And of course its use in the OP's code is very insecure - vulnerabilities include XSS (cross site scripting) and injection, for the record.

  4. angelwatt Moderator emeritus


    Aug 16, 2005

Share This Page