Topic: Question

I have created a webpage that pops up a contact lightbox form. I have also created another lightbox that pops up when the user submits data from the first lightbox. My question is: how do I make the first lightbox appear when the user clicks "Contact Again" button in the second lightbox?

Here is the code for the first lightbox

<div id="shadowing"></div>
<div id="box">
  <span id="boxtitle"></span>
  <form  method="post" target="_parent"> 
      
    <p>Your Name: <br>
      <input type="text" name="yourname"  id="yourname" maxlength="100" size="40" 
      
      >
    </p>
    <p>Email address: <br> 
      <input type="text" name="email_address" id="email_address" maxlength="100" size="40">
    </p>
      
        
    <p> Message: <br>
       <textarea name="Message" rows="10" cols="40"></textarea>
        </p>
    <p> 
      
   <label for='captcha'> Just to ensure you are a genuine person, please tell me how many <b>FULL</b> bananas you can see in the image 
   below:&nbsp;</label>
   <input type="text" name="captcha" id="captcha"  maxlength="100" /><br>
   <img src="/images/captcha.jpg" style="width:300px"><br>
      <!--<button onClick="openbox('Invalid Data', 1)">Submit</button>-->
      
      <!--<button onClick="openbox('Response', 1)">Submit</button>-->
      <?php include 'contact_response.php'; ?><button onClick="openbox('Response', 1)" target="_parent">Submit</button>
      <input type="button" name="cancel" value="Cancel" onClick="closebox()">
    </p>

  </form>
 
</div>

Here is the code for the second lightbox

<div id="shadowing"></div>
<div id="seventhbox">
  <span id="seventhboxtitle"></span>
  <form method="post" target="_parent">
  
<?php
 

$errors = '';
$myemail = 'thuitamaina@thuitamaina.com';//<-----Put Your email address here.
if(empty($_POST['yourname'])  || 
   empty($_POST['email_address']) ||
   empty($_POST['Message']) || 
   empty($_POST['captcha']))
{
    $errors .= "\n Error: all fields are required";
    echo '<br>' . $errors . '<br>';
}

$yourname = $_POST['yourname']; 
$email_address = $_POST['email_address']; 
$Message = $_POST['Message'];
$captcha = $_POST['captcha']; 

if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", 
$email_address))
{
    $errors .= "\n Error: Invalid email address";
    echo '<br>' . $errors . '<br>';
}  

if ( $captcha != 2)
 {
   $errors .= "\n You inserted the wrong number of <b>FULL</b> bananas. You are not a genuine person!";
   echo '<br>' . $errors . '<br>';
 }

if( empty($errors))

{

// Include database connection settings
include('clinton.php');

$yourname = $_POST['yourname']; 
$email_address = $_POST['email_address']; 
$Message = $_POST['Message']; 

mysql_query("INSERT INTO `thuitam_myDatabase`.`Contact_info` (
`Index` ,
`Name` ,
`Email Address` ,
`Message`
)
VALUES (
NULL, '$yourname', '$email_address','$Message')
");

//close connection                          
mysql_close();

$to = $myemail;

$email_subject = "Contact form submission: $yourname";

$email_body = "You have received a new message. ".

" Here are the details:\n Name: $yourname \n ".

"Email: $email_address\n Message \n $Message";

$headers = "From: $myemail\n";

$headers .= "Reply-To: $email_address";

mail($to,$email_subject,$email_body,$headers);

//Say 'thank you'
//echo '<br>' . $errors . '<br>';
echo '<p>Hi' . $yourname . '!</p>

<p>Thank you for contacting me. I will try my best to get back to you as soon as possible. In case I delay in responding, feel free to call me via phone. My number is +254725-509941.</p>

<p>Wishing You Every Joy,</p>

<p>Thuita J. Maina.</>
';

}

?>
<button onClick="openbox('Contact', 1)" target="_parent">Contact Again</button>
      <input type="button" name="cancel" value="Cancel" onClick="closebox()">


  </form>
 
</div>

Here is the code for the jascript that opens the lightboxes

function gradient(id, level)
{
    var box = document.getElementById(id);
    box.style.opacity = level;
    box.style.MozOpacity = level;
    box.style.KhtmlOpacity = level;
    box.style.filter = "alpha(opacity=" + level * 100 + ")";
    box.style.display="blocketurn;
}


function fadein(id) 
{
    var level = 0;
    while(level <= 1)
    {
        setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10);
        level += 0.01;
    }
}

// Open the lightbox

function openbox(formtitle, fadin)
{
  

 switch (formtitle) 
   {
    case "Contact":
        var box = document.getElementById('box'); 
        document.getElementById('box').style.width = "400px";
        document.getElementById('box').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var btitle = document.getElementById('boxtitle');
        btitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("box", 0);
     fadein("box");
         gradient("box", 0);
     fadein("box");
       }
  else
       {     
    box.style.display='block   
       }      
    
    break;
    case "Feedback":
        //var box = document.getElementById('secondbox'); 
        var secondbox = document.getElementById('secondbox');
        document.getElementById('shadowing').style.display='block';

        var secondbtitle = document.getElementById('secondboxtitle');
        secondbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("secondbox", 0);
     fadein("secondbox");
         gradient("secondbox", 0);
     fadein("secondbox");
       }
  else
       {     
    secondbox.style.display='block   
       } 
     
    break;
    case "Search Results":
        //var box = document.getElementById('thirdbox'); 
        var thirdbox = document.getElementById('thirdbox');
        document.getElementById('shadowing').style.display='block';

        var thirdbtitle = document.getElementById('thirdboxtitle');
        thirdbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("thirdbox", 0);
     fadein("thirdbox");
         gradient("thirdbox", 0);
     fadein("thirdbox");
       }
  else
       {     
    thirdbox.style.display='block   
       } 
     
    break;
   
    case "Subscription":
        var fourthbox = document.getElementById('fourthbox'); 
        document.getElementById('fourthbox').style.width = "300px";
        document.getElementById('fourthbox').style.height = "400px";
        //var fourthbox2 = document.getElementById('fourthbox');
        document.getElementById('shadowing').style.display='block';

        var fourthbtitle = document.getElementById('fourthboxtitle');
        fourthbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("fourthbox", 0);
     fadein("fourthbox");
         gradient("fourthbox", 0);
     fadein("fourthbox");
       }
  else
       {     
    fourthbox.style.display='block   
       }      
    
    break;

    case "Advertize on this Website":
        var fifthbox = document.getElementById('fifthbox'); 
        document.getElementById('fifthbox').style.width = "300px";
        document.getElementById('fifthbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var fifthbtitle = document.getElementById('fifthboxtitle');
        fifthbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("fifthbox", 0);
     fadein("fifthbox");
         gradient("fifthbox", 0);
     fadein("fifthbox");
       }
  else
       {     
    fifthbox.style.display='block   
       }      
    
    break;
    case "Learn Piano":
        var seventhbox = document.getElementById('sixthbox'); 
        document.getElementById('sixthbox').style.width = "300px";
        document.getElementById('sixthbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var sixthbtitle = document.getElementById('sixthboxtitle');
        sixthbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("sixthbox", 0);
     fadein("sixthbox");
         gradient("sixthbox", 0);
     fadein("sixthbox");
       }
  else
       {     
    sixthbox.style.display='block   
       }      
    
    break;

   case "Response":
        var seventhbox = document.getElementById('seventhbox'); 
        document.getElementById('seventhbox').style.width = "400px";
        document.getElementById('seventhbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var seventhbtitle = document.getElementById('seventhboxtitle');
        seventhbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("seventhbox", 0);
     fadein("seventhbox");
         gradient("seventhbox", 0);
     fadein("seventhbox");
       }
  else
       {     
    seventhbox.style.display='block   
       }      
    
    break;
    /*
   case "Contact Submitted":
        var eighthbox = document.getElementById('eighthbox'); 
        document.getElementById('eighthbox').style.width = "400px";
        document.getElementById('eighthbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var eighthbtitle = document.getElementById('eighthboxtitle');
        eighthbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("eighthbox", 0);
     fadein("eighthbox");
         gradient("eighthbox", 0);
     fadein("eighthbox");
       }
  else
       {     
    eighthbox.style.display='block   
       }      
    
    break;
  */
    /*
    case 6:
        day = "Saturday";
        break;
     */
      }
} 



// Open the lightbox

/*
function openbox(formtitle, fadin)
{
  
 if (formtitle"Contact") 
   {
    
        var box = document.getElementById('box'); 
        document.getElementById('box').style.width = "400px";
        document.getElementById('box').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var btitle = document.getElementById('boxtitle');
        btitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("box", 0);
     fadein("box");
         gradient("box", 0);
     fadein("box");
       }
  else
       {     
    box.style.display='block   
       }  
   }    
    
   if (formtitle= "Feedback")
       {
        var secondbox = document.getElementById('secondbox'); 
        document.getElementById('secondbox').style.width = "400px";
        document.getElementById('secondbox').style.height = "400px";
        //var box2 = document.getElementById('secondbox2');
        document.getElementById('shadowing').style.display='block';

        var secondbtitle = document.getElementById('boxtitle');
        secondbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("secondbox", 0);
     fadein("secondbox");
         gradient("secondbox", 0);
     fadein("secondbox");
       }
  else
       {     
    secondbox.style.display='block   
       }      
    }
    
   if (formtitle="Search Results":
       {
        var thirdbox = document.getElementById('thirdbox'); 
        document.getElementById('thirdbox').style.width = "400px";
        document.getElementById('thirdbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var thirdbtitle = document.getElementById('thirdboxtitle');
        thirdbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("thirdbox", 0);
     fadein("thirdbox");
         gradient("thirdbox", 0);
     fadein("thirdbox");
       }
  else
       {     
    thirdbox.style.display='block   
       }      
    }
  
    if (formtitle="Subscription")
        {
        var fourthbox = document.getElementById('fourthbox'); 
        document.getElementById('fourthbox').style.width = "400px";
        document.getElementById('fourthbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var fourthbtitle = document.getElementById('fourthboxtitle');
        fourthbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("fourthbox", 0);
     fadein("fourthbox");
         gradient("fourthbox", 0);
     fadein("fourthbox");
       }
  else
       {     
    fourthbox.style.display='block   
       }      
    }
    if (formtitle="Advertize on this Website")
       {
        var fifthbox = document.getElementById('fifthbox'); 
        document.getElementById('fifthbox').style.width = "400px";
        document.getElementById('fifthbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var fifthbtitle = document.getElementById('fifthboxtitle');
        fifthbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("fifthbox", 0);
     fadein("fifthbox");
         gradient("fifthbox", 0);
     fadein("fifthbox");
       }
  else
       {     
    fifthbox.style.display='block   
       }      
    }
    if (formtitle="Learn Piano")
       {
        var sixthbox = document.getElementById('sixthbox'); 
        document.getElementById('sixthbox').style.width = "400px";
        document.getElementById('sixthbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var sixthbtitle = document.getElementById('sixthboxtitle');
        sixthbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("sixthbox", 0);
     fadein("sixthbox");
         gradient("sixthbox", 0);
     fadein("sixthbox");
       }
  else
       {     
    sixthbox.style.display='block   
       }      
    }
    if (formtitle="Contact Feedback")
       {
        var seventhbox = document.getElementById('seventhbox'); 
        document.getElementById('seventhbox').style.width = "400px";
        document.getElementById('seventhbox').style.height = "400px";
        //var box2 = document.getElementById('box2');
        document.getElementById('shadowing').style.display='block';

        var seventhbtitle = document.getElementById('seventhboxtitle');
        seventhbtitle.innerHTML = formtitle;

  if(fadin)
       {
     gradient("seventhbox", 0);
     fadein("seventhbox");
         gradient("seventhbox", 0);
     fadein("seventhbox");
       }
  else
       {     
    seventhbox.style.display='block   
       }      
    }

}
*/

// Close the lightbox

function closebox()
{
   document.getElementById('box').style.display='none';
   document.getElementById('secondbox').style.display='none';
   document.getElementById('thirdbox').style.display='none';
   document.getElementById('fourthbox').style.display='none';
   document.getElementById('fifthbox').style.display='none';
    document.getElementById('sixthbox').style.display='none';
   //document.getElementById('seventhbox').style.display='none';
   //document.getElementById('eighthbox').style.display='none';
   document.getElementById('shadowing').style.display='none';
}

Re: Question

Unfortunately, we can only offer limited assistance when it comes to website development or optimization, which is what your request is relating to, because we are not a web development company and furthermore we do not know how your scripts work.

Searching for problem solutions that relate to web development on Google.com is a good idea. Stackoverflow.com is another great site that has many web development issues resolved and allows you to submit your own.