SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot greeneye's Avatar
    Join Date
    Apr 2006
    Location
    London
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    redirect on form submit

    Hi all,

    I have a form that upon submit I want to user to be redirected to a thankyou.htm page......but when I hit submit it says this:

    Parse error: parse error, unexpected ';' in /home/greeneye/public_html/stoppcntax/insert2.php on line 35

    Line 35 is blank. Line 36 has this on it:
    PHP Code:
    $url 'http://' $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']; 
    Here is my script:

    PHP Code:
    <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"?>
    <!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>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>

    <body>

    <?php 
    if( isset($_POST['submit']) ) { // if the submit button has been clicked 

         
    include "connect.php"// includes connection.php 

    // get all our variables sorted 

    foreach($_POST as $var) { 

    addslashesmysql_real_escape_string($var) ); 



    $first $_POST['first']; 
    $last $_POST['last']; 
    $postc $_POST['postcode']; 
    $email $_POST['email']; 

    // do our queries 

    $query "INSERT INTO petition (first,last,postcode,email) VALUES ('".$first."', '".$last."','".$postc."','".$email."')"


    $sql mysql_query($query)or die( "Error: " mysql_error() ); 

    $url 'http://' $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'];

    if ((
    substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
        
    $url substr ($url0, -1); 
    }
    $url .= '/thankyou.htm';

    header("Location: $url");
    exit();


    ?> 
    </body> 
    </html>

    Any suggestions? Thank you!

    greeneye
    Hello

  2. #2
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    dirname($_SERVER['PHP_SELF']); // --> missing bracket added :) 

  3. #3
    SitePoint Zealot greeneye's Avatar
    Join Date
    Apr 2006
    Location
    London
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you!
    Hello


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •