SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question how to crate a dialog box in php.

    i was just working email in php.Can anyone tell me the coding of- after login how i can show dialog or message box telling that "you have successfully logged in and then ok button.....

    plz reply soon......

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,600
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    You could do this either as a static page using HTML and CSS or add some JavaScript as well to make it more interactive.

    The PHP would just be used to output the HTML.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    but i don't know javascript. So please tell me the little bit coding idea in php with my sql and i wll try to work with HTML with CSS style sheet.

  4. #4
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    contact.php
    PHP Code:
    <?php
    if(isset($_POST['email'])) {
        
        
    //Email
        
    $email_to "email@email.com";
        
    $email_subject "CG Contact Form Submission";
        
        
        function 
    died($error) {
            
    // error message code 
            
    echo "We are very sorry, but there were error(s) found with the form your submitted. ";
            echo 
    "These errors appear below.<br /><br />";
            echo 
    $error."<br /><br />";
            echo 
    "Please go back and fix these errors.<br /><br />";
            die();
        }
        
        
    // validation expected data exists
        
    if(!isset($_POST['name']) ||
            !isset(
    $_POST['email']) ||
            !isset(
    $_POST['telephone']) ||
            !isset(
    $_POST['comments'])) {
            
    died('We are sorry, but there appears to be a problem with the form your submitted.');        
        }
        
        
    $name $_POST['name']; // required
        
    $email_from $_POST['email']; // required
        
    $telephone $_POST['telephone']; // not required
        
    $comments $_POST['comments']; // required
        
        
    $error_message "";
        
    $email_exp "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
      if(!
    eregi($email_exp,$email_from)) {
          
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
      }
        
    $string_exp "^[a-z .'-]+$";
      if(!
    eregi($string_exp,$name)) {
          
    $error_message .= 'The Name you entered does not appear to be valid.<br />';
      }
      
      if(
    strlen($comments) < 2) {
          
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
      }
      
    $string_exp "^[0-9 .-]+$";
      if(!
    eregi($string_exp,$telephone)) {
          
    $error_message .= 'The Telphone Number you entered does not appear to be valid.<br />';
      }
      if(
    strlen($error_message) > 0) {
          
    died($error_message);
      }
        
    $email_message "Form details below.\n\n";
        
        function 
    clean_string($string) {
          
    $bad = array("content-type","bcc:","to:","cc:","href");
          return 
    str_replace($bad,"",$string);
        }
        
        
    $email_message .= "Name: ".clean_string($name)."\n";
        
    $email_message .= "Email: ".clean_string($email_from)."\n";
        
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
        
    $email_message .= "Comments: ".clean_string($comments)."\n";
        
        
    // create email headers
    $headers 'From: '.$email_from."\r\n".
    'Reply-To: '.$email_from."\r\n" .
    'X-Mailer: PHP/' phpversion();
    @
    mail($email_to$email_subject$email_message$headers);  
    ?>
    <!-- Form submission success -->

    <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr> 
              <td valign="top" height="10"> 
                <p><font face="arial,verdana" size="3" class="page_title"><b><img src="headers/quote.gif" width="410" height="17" alt=""></b></font> 
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                  <tr> 
                    <td valign="top"> 
                      <hr noshade size="1">
                      <font face="Verdana, Arial, Helvetica, sans-serif" size="1">Thanks 
                      for visiting our website! We would love to hear from you. </font> 
                     
                      
                    </td>
                    
                  </tr>
                </table>

    <?
    }
    ?>
    Last edited by SpacePhoenix; Aug 29, 2011 at 22:56. Reason: put php tags around php code

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i understood the coding but when i run this coding on mozilla it was showing me a blank page. please help me its really urgent..

  6. #6
    SitePoint Addict goldensona's Avatar
    Join Date
    Jun 2011
    Posts
    226
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    do you want to display it in alert box ? if login success means add this script
    HTML Code:
     <script type="text/javascript">
    
                 
            alert ("successfully login");
    
          </script> 
    if you want to just display message means , in php just pass the string with the url and get that string success page then display.

    checkloginverification.php page add like below

    PHP Code:
    header("location:success.php?msg=loginsuccess"); 
    in success.php

    PHP Code:
    <?php

    echo $_GET['msg'];

    ?>

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you. my problem is solved..


Tags for this Thread

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
  •