Jump to content

Display Form Results In Lightbox?


ek378996

Recommended Posts

Hello,

 

I am working on a website and I would like to accomplish some things before a form is submitted. Here is what I am trying to do:

 

1) User fills out form

2) User clicks submit

3) Form results show in a lightbox to ask the user if the information entered is correct

4) If yes, form is sent, if no, taken back to form.

 

I have minimal PHP and Javascript coding knowledge so I'm not totally in the dark with this but I still am not sure how to accomplish it. I have attached an image of the form to give you an idea of what I am working with.

 

post-132771-0-28913600-1350379085_thumb.png

Link to comment
Share on other sites

I am using Joomla! and have a lightbox pluggin that allows me to display html. I'm just not sure the coding it would take to accomplish the task. I haven't touched PHP or Javascript since college about 5 years ago. I can read code and see pretty much what is going on, and modify it, but I'm not sure where to start. Do you have any direction you could point me to see code similiar to what I am trying to do?

Link to comment
Share on other sites

ive never tried displaying the information in a lightbox - however my 'guess' is that you would have to get the form to submit to itself and use post to display the information inside the lightbox. I cant really give you coding because ive never tried using a lightbox for this reason before.

Link to comment
Share on other sites

Here you go then:

 


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php

/*         MAKE THIS LOOK PRETTY TO!         */

$sub = $_POST["submit"];
$name = $_POST["name"];
$phone = $_POST["phone"];
$company = $_POST["company"];
$gender = $_POST["gender"];

if($sub){
if(!empty($name)){
if(!empty($phone)){
if(!empty($company)){
if($gender){
echo '<p>Name: '.$name.'</p>';
echo '<p>Phone: '.$phone.'</p>';
echo '<p>Company: '.$company.'</p>';
echo '<p>Gender: '.$gender.'</p>';

echo '<form action="" method="POST">';
echo '<input type="submit" name="con_submit" value="Confirm" />';
echo '<a href="">Wrong</a>';
echo '</form>';
}
}else{
$msg .= "No company: ";
$link .= '<a href="">Try Again</a>';
}
}else{
$msg .= "No telephone number: ";
$link .= '<a href="">Try Again</a>';
}
}else{
$msg .= "No name: ";
$link .= '<a href="">Try Again</a>';
}

echo $msg;
echo $link;

}else{

?>
<form action="" method="POST">
<label>Name:</label>
<input type="text" name="name" /><br>
<label>Telephone:</label>
<input type="text" name="phone" /><br>
<label>Company:</label>
<input type="text" name="company" /><br>
<label>Gender:</label>
<select name="gender">
<option>Male</option>
<option>Female</option>
</select><br>

<input type="submit" name="submit" value="Submit" />
</form>

<?php

}

?>
</body>
</html>

Edited by White_Lily
Link to comment
Share on other sites

Christian,

 

I'm using Joomla! with an extension called ProForms. I'm not coding the form myself. It can be found here:

 

http://www.kellywebsitedesign.com/clients/pscb/index.php/order-form

 

I'm looking for a way to be able to grab the inputted user data and simply ask the user if they have selected the right options for their needs. If they have, hit send again and it's sent, if not they go back to the original form and start over. I'm just not sure how to accomplish it. I've writting the people who wrote the pluggin but would much rather learn how to do it myself so i can repeat it as I need to.

Link to comment
Share on other sites

Study the code I linked you to, and read up in the PHP manual if there are some functions you're not familiar with. Should there still be something that you're wondering about, feel free to ask. It's a good idea to note what you've done to figure it out on your own, as well as an clear description of what you're having trouble understanding.

Edited by Christian F.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.