SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot cyberian's Avatar
    Join Date
    Oct 2003
    Location
    MA
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php code causing problems

    Please view this page: http://www.cyberiansolutions.com/quickform.php

    Inserting the php code below causes everything below it to disappear and the footer does not show up as supposed to. Do you guys see anything peculiar about this php code that might be causing this? I insert the code and it messes things up, I remove it and the page looks fine structurally. This chunk of php code is inserted in the "innercontent" div:

    PHP Code:
    <?
                    $to 
    "info@cyberiansolutions.com"
                    
    $subject "quickform submission"// email subject
                    
    $message "$name has filled in your quickform.\nEmail Address: $email \nComments: $comments";
                    
                    
    $name=$_POST['name'];
                    
    $email=$_POST['email'];
                    
    $comments=$_POST['comments'];
                    
                    
                    
                    
    // verify data
                    
                    
    if((!$name) || (!$email) || (!$comments)){
                        echo 
    'Some information is missing!';
                        if(!
    $name){
                            echo 
    " - Your name is a required field. Please click BACK in your browser and try again.<br><br>";
                        }
                        if(!
    $email){
                            echo 
    " - E-mail address is a required field. Please click BACK in your browser and try again.<br><br>";
                        }
                        if(!
    $comments){
                            echo 
    " - Please click BACK in your browser and fill in the message area.<br><br>";
                        }
                    exit();
                    }
                    
    mail($to$subject$message"From: $name <$address>\nX-Mailer: PHP/" phpversion());
                    echo (
    "Success! We will respond ASAP. <br /><br />Redirecting ... please wait!"); // Text displayed while redirecting...
                    
    echo "<meta http-equiv='refresh' content='3; url=http://www.cyberiansolutions.com'>"// Page to redirect after succesfuly execution.
                    
    ?>
    CSS file is here: http://www.cyberiansolutions.com/cyberian.css

    Thanks!

    btw - this looks really bad in Mozilla, but in IE it at least fills in the background.

  2. #2
    SitePoint Guru
    Join Date
    Feb 2004
    Location
    Oregon
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well if you look at the source you can see it print some of the php code you have there.

    Code:
    <div id="innercontent">
    	Some information is missing! 
    - Your name is a required field. Please click BACK in your browser and try again.<br><br> 
    - E-mail address is a required field. Please click BACK in your browser and try again.<br><br> 
    - Please click BACK in your browser and fill in the message area.<br><br>
    and seeing how you have exit at the bottom if quits.
    success is not by chance, it is by choice.

  3. #3
    SitePoint Zealot cyberian's Avatar
    Join Date
    Oct 2003
    Location
    MA
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see what you mean about how it exits after any errors. Is there a way to change that so the functionality remains the same and still shows the page correctly?

  4. #4
    SitePoint Evangelist
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
     
                    
    // verify data 
     
                    
    if((!$name) || (!$email) || (!$comments)){ 
                        echo 
    'Some information is missing!'
                        if(!
    $name){ 
                            echo 
    " - Your name is a required field. Please click BACK in your browser and try again.<br><br>"
                        } 
                        if(!
    $email){ 
                            echo 
    " - E-mail address is a required field. Please click BACK in your browser and try again.<br><br>"
                        } 
                        if(!
    $comments){ 
                            echo 
    " - Please click BACK in your browser and fill in the message area.<br><br>"
                        } 
                    }
                    else
                    {
                        
    mail($to$subject$message"From: $name <$address>\nX-Mailer: PHP/" phpversion()); 
                        echo (
    "Success! We will respond ASAP. <br /><br />Redirecting ... please wait!"); // Text displayed while redirecting... 
                        
    echo "<meta http-equiv='refresh' content='3; url=http://www.cyberiansolutions.com'>"// Page to redirect after succesfuly execution. 
                    
    }
                    
    ?> 

  5. #5
    SitePoint Zealot cyberian's Avatar
    Join Date
    Oct 2003
    Location
    MA
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Wbmstr84
    PHP Code:
     
                    
    // verify data 
     
                    
    if((!$name) || (!$email) || (!$comments)){ 
                        echo 
    'Some information is missing!'
                        if(!
    $name){ 
                            echo 
    " - Your name is a required field. Please click BACK in your browser and try again.<br><br>"
                        } 
                        if(!
    $email){ 
                            echo 
    " - E-mail address is a required field. Please click BACK in your browser and try again.<br><br>"
                        } 
                        if(!
    $comments){ 
                            echo 
    " - Please click BACK in your browser and fill in the message area.<br><br>"
                        } 
                    }
                    else
                    {
                        
    mail($to$subject$message"From: $name <$address>\nX-Mailer: PHP/" phpversion()); 
                        echo (
    "Success! We will respond ASAP. <br /><br />Redirecting ... please wait!"); // Text displayed while redirecting... 
                        
    echo "<meta http-equiv='refresh' content='3; url=http://www.cyberiansolutions.com'>"// Page to redirect after succesfuly execution. 
                    
    }
                    
    ?> 
    Thank You!!!!! I tried the else, but put a ";" after it and it didn't work. Your way works great. Saved me.


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
  •