I want to display data from database into modal. I have a table, has 12 fields. One of them is titled articles that have many characters. So it will take up much space if shown in the table. So, I want to display the record from the article field into modal. This is my code:
<?php
error_reporting(0);
mysql_connect("localhost","root","");
mysql_select_db("hellomedan");
$que = "SELECT * FROM `wisata`";
$q = mysql_query($que);
$no = 1;
while ($qq = mysql_fetch_array($q)) {
?>
<tr style="background:#D79407;">
<td style="text-align:center; border:1px solid #999;padding:4px 8px;"><?php echo $no ?></td>
<td style="border:1px solid #999;padding:4px 8px;"><?php echo $qq['nama'] ?></td>
<td style="text-align:center; border:1px solid #999;padding:4px 8px;"><img src="img/ic_search_white_24dp_1x.png"></td>
<td style="text-align:center; border:1px solid #999;padding:4px 8px;"><?php echo $qq['rating'] ?></td>
<td style="text-align:center; border:1px solid #999;padding:4px 8px;"><?php echo $qq['jenis'] ?></td>
<td style="border:1px solid #999;padding:4px 8px;"><?php echo $qq['alamat'] ?></td>
<td style="text-align:center; border:1px solid #999;padding:4px 8px;"><?php echo $qq['telepon'] ?></td>
<td style="text-align:center; border:1px solid #999;padding:4px 8px;"><?php echo $qq['jambuka'] ?></td>
<td style="text-align:center; border:1px solid #999;padding:4px 8px;"><?php echo $qq['jamtutup'] ?></td>
<td style='text-align:center; border:1px solid #999;padding:4px 8px; cursor:pointer;' data-id=".$qq['id'].">
<div id="id01" class="modal">
<div class="container" style="background-color:#FFBD30">
<button style="margin-top: 0px; margin-left:0px; width:100px; float:right;" type="button" onclick="document.getElementById('id01').style.display='none'" class="tombol_wisata">Tutup</button>
<p style="text-align: justify;padding-top:70px"><?php echo $qq['artikel'] ?></p>
</div>
</div>
<img onclick="document.getElementById('id01').style.display='block'" src="img/ic_search_white_24dp_1x.png">
</td>
<td style="text-align:center; border:1px solid #999;padding:4px 8px;"><img src="img/ic_place_white_24dp_1x.png"></td>
<td style="text-align:center; border:1px solid #999;padding:4px 8px;">
<a style="text-decoration:none;" href="edit_wisata.php?id=<?php echo $qq['id']; ?>"><img src="img/ic_mode_edit_white_24dp_1x.png"></a>
<a style="text-decoration:none;" href="php/proses_delete_wisata.php?id=<?php echo $qq['id']; ?>"><img src="img/ic_delete_white_24dp_1x.png"></a>
</td>
</tr>
<?php $no++; } ?>
The problem is, when I click the magnifying glass button, modal displays the same file. Modal displays data from the first field on all the magnifying glass buttons. How to solve it? Is my code correct? Because I made up my own code :(
Related
<div id="page-details">
<table style="page-break-inside: avoid !important;" width="1280px" cellspacing="0" cellpadding="0">
<tr style="page-break-inside: avoid !important; ">
<td width="1280px">
<table autosize="1" cellspacing="0" cellpadding="0" width="1280px">
<tr>
<td style="border-right:1px solid; height:25px; text-align:center;" width="40px">No</td>
<td width="320px" style="border-right:1px solid; text-align:center; height:25px;">Typology</td>
<td width="415px" style="border-right:1px solid; text-align:center; height:25px;">Description of Goods</td>
<td width="100px" style="border-right:1px solid; text-align:center; height:25px;">Width</td>
<td width="100px" style="border-right:1px solid; text-align:center; height:25px;">Height</td>
<td width="80px" style="border-right:1px solid; text-align:center; height:25px;">Qty</td>
<td width="100px" style="border-right:1px solid; text-align:center; height:40px;">Sq Feet
</td>
<td width="125px" style="text-align:center; height:40px;">Total
</td>
</tr>
</table>
</td>
</tr>
<!-- for loop start -->
<?php
if($quotation->items != null && count($quotation->items) > 0) {
$index = 1;
for ($i=0; $i < count($quotation->items); $i++) {
?>
<tr style="page-break-inside: avoid !important;">
<td width="1280px">
<table cellspacing="0" cellpadding="0" width="1280px" style="overflow-wrap: break-word; page-break-inside: avoid !important; ">
<tr>
<td style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; height:75px; text-align:center;" width="40px">
<?php echo $index++; ?>
</td>
<td width="320px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; height:275px;">
<?php
if ($quotation->items[$i]->seriesType == 7 ||
$quotation->items[$i]->seriesType == 8) {
?>
<img src="<?php echo $quotation->items[$i]->url;?>" style="max-height: 320px; max-width: 275px; padding: 5px;">
<?php
} else {
?>
<img src="<?php echo $quotation->items[$i]->url;?>" style="max-height: 320px; max-width: 275px; padding: 5px;">
<?php
}
?>
</td>
<td width="415px" style="word-wrap: break-word; border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; overflow-wrap: break-word; padding: 5px;">
<?php
echo "Pattern: <b>" . $quotation->items[$i]->patternName . "</b>";
?>
<br>
<p style="font-size: 20px;">
<?php
echo "Series: <b>" . $quotation->items[$i]->seriesName . "</b>";
?>
<br>
<?php
echo "Section Company: <b>" . $quotation->items[$i]->companyName . "</b>";
?>
<br>
<?php
echo "Glass: <b>" . $quotation->items[$i]->type . "</b>";
?>
<br>
<?php
echo "Color: <b>" . $quotation->items[$i]->colorType . "</b>";
?>
</p>
<br>
<?php
if (isset($quotation->items[$i]->location)) {
?>
<p style="font-size: 20px; font-weight: bold;">
<?php
echo "Location: " . $quotation->items[$i]->location;
?>
</p>
<?php
}
?>
<br>
<p style="font-size: 20px;">
<?php
if ($quotation->items[$i]->lockId > 0) {
echo "Lock - <b>" . $quotation->items[$i]->lockName . "</b>";
?>
</p>
<?php
}
?>
<?php
if (!empty($quotation->items[$i]->lockDescription)) {
?>
<p style="font-size: 20px; margin-left: 20px;">
<?php
echo "Description - <b>" . $quotation->items[$i]->lockDescription . "</b>";
?>
</p>
<?php
}
?>
<?php
if (!empty($quotation->items[$i]->make)) {
?>
<p style="font-size: 20px; margin-left: 20px;">
<?php
echo "Make - <b>" . $quotation->items[$i]->make . "</b>";
?>
</p>
<?php
}
?>
<?php
if (!empty($quotation->items[$i]->model)) {
?>
<p style="font-size: 20px; margin-left: 20px;">
<?php
echo "Model - <b>" . $quotation->items[$i]->model . "</b>";
?>
</p>
<?php
}
?>
<?php
if (!empty($quotation->items[$i]->brand)) {
?>
<p style="font-size: 20px; margin-left: 20px;">
<?php
echo "Brand - <b>" . $quotation->items[$i]->brand . "</b>";
?>
</p>
<br>
<?php
}
?>
</td>
<td width="100px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; text-align:center; height:75px;">
<?php echo number_format($quotation->items[$i]->totalWidth, 2); ?>
</td>
<td width="100px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; text-align:center; height:75px;">
<?php echo number_format($quotation->items[$i]->totalHeight, 2); ?>
</td>
<td width="80px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; text-align:center; height:75px;">
<?php echo $quotation->items[$i]->qty; ?>
</td>
<td width="100px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; text-align:center; height:75px;">
<?php
$totalSqFeet = $quotation->items[$i]->totalFoot * $quotation->items[$i]->qty;
echo number_format($totalSqFeet, 2);
?>
</td>
<td width="125px" style="border-top:1px solid; border-bottom: 1px solid;text-align:center; height:75px;">
<?php echo number_format($quotation->items[$i]->total, 2); ?>
</td>
</tr>
</table>
</td>
</tr>
<?php
}
}
?>
<!-- for loop end -->
</table>
</div>
Following is the Image of the issue I am facing in PDF for the reference.
I have placed page-break-inside: avoid !important; code inside table and tr both.
Also set $mpdf->shrink_tables_to_fit = 1; in MPDF object but still I am getting extra borders.
This is the main table which shows all the data from database, when I click the print it should only print the that row but it does not show up I get "Undefined variable: row" and im starting to think this has to do with this here the code for the table:
<div class="container" >
<div class="well" ">
<span class="pull-right"><a data-toggle="modal" data-target="#myModal" href="#myModal" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> Enroll Pupil</a></span>
<div>
</div>
<table class="table table-striped table-bordered table-hover" >
<thead>
<th >Moble Number</th>
<th >First Name</th>
<th>Last Name</th>
<th>Section</th>
<th>Grade</th>
<th>Action</th>
</thead>
<tbody>
<?php
include('conn.php');
$query=mysqli_query($conn,"select * from `tbl_students`");
while($row=mysqli_fetch_array($query)){
?>
<tr s>
<td><?php echo $row['LRN']; ?></td>
<td><?php echo $row['FirstName']; ?></td>
<td><?php echo $row['LastName']; ?></td>
<td><?php echo $row['Section']; ?></td>
<td><?php echo $row['GradeLevel']; ?></td>
<td >
<span class="glyphicon glyphicon-edit"></span> Edit | |
<span class="glyphicon glyphicon-trash"></span> Delete | |
<span class="glyphicon glyphicon-edit"></span> Add Subject | |
<a class="btn btn-success" onclick="window.open('IndivPrintTableStudent.php').print();">Print</a>
<?php include('buttonstudent.php'); ?>
</td>
</tr>
<?php
}
?>
</tbody>
here is my database
<?php include"includes/config.php" ?>
<link rel="stylesheet" type="text/css" href="Print.css" media="print"></link>
<div class="container" >
<table>
<thead>
<th style="border: 3px solid #2F323A; text-align: center; padding-bottom: 8px;">Moble Number</th>
<th style="border: 3px solid #2F323A; text-align: center; width: 14%;">First Name</th>
<th style="border: 3px solid #2F323A; text-align: center; width: 14%;">Last Name</th>
<th style="border: 3px solid #2F323A; text-align: center; padding-bottom: 9px;">Section</th>
<th style="border: 3px solid #2F323A; text-align: center; width: 10%;">Grade</th>
</thead>
<tbody>
<?php
$query=mysqli_query($con,"SELECT * FROM tbl_students WHERE LRN='".$row['LRN']."'");
while($row=mysqli_fetch_array($query)){
?>
<tr style="background-color: #f0f8ff; border: 3px solid #2F323A;">
<td style="border: 3px solid #2F323A; padding-top: 15px; color: #2F323A;"><?php echo $row['LRN']; ?></td>
<td style="border: 3px solid #2F323A; padding-top: 15px; color: #2F323A;"><?php echo $row['FirstName']; ?></td>
<td style="border: 3px solid #2F323A; padding-top: 15px; color: #2F323A;"><?php echo $row['LastName']; ?></td>
<td style="border: 3px solid #2F323A; padding-top: 15px; color: #2F323A;"><?php echo $row['Section']; ?></td>
<td style="border: 3px solid #2F323A; padding-top: 15px; color: #2F323A;"><?php echo $row['GradeLevel']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
how do I get single data in individual manner? the error that I get s "Undefined variable: row" which you can see on the query. i dont know why it says that I only made this is table form just to see if i can get the actual data from a single student. I hope my question can be understandable.
Your button is linking to IndivPrintTableStudent.php but you aren't passing the ID of the clicked row in the URL, so that script doesn't know which row you wanted to display. $row['LRN'] in the second script isn't going to exist because it's part of a different script, variables are not carried across automatically from one script to another. You have to pass them in the URL.
You'd have something like
onclick="window.open('IndivPrintTableStudent.php?LRN=<?php echo $row["LRN"]; ?>').print();
in the print button on the first table.
And then the second script would use $_GET["LRN"] to retrieve that value from the URL and use it in the sql query.
(Beware of SQL injection though, learn how to use parameters and prepared statements to protect your database - see https://phpdelusions.net/mysqli for examples.)
I am trying to put all these three data side by side. Like the second row last column. but after the first column (within php loop) 3rd and 4th elements get to lower line.
screenshot
here is what I have tried (included style in line.
<?php while ($each_row = mysqli_fetch_assoc($table_data)){ ?>
<tr style="border: 1px solid black; ">
<td style="border: 1px solid black;"><?php echo $i; ?></td>
<td style="border: 1px solid black;"><?php echo $each_row["roll"]; ?></td>
<td style="border: 1px solid black;"><?php echo $each_row["name"]; ?></td>
<td style="border: 1px solid black; text-align:center;"><?php echo $each_row["present"]; ?></td>
<td style="border: 1px solid black; width: 300px;">
<a href="attendence.php?change=present&date=<?php echo $today; ?>&class=<?php echo $class; ?>&batch=<?php echo $batch; ?>&roll=<?php echo $each_row["roll"]; ?>">
<button type="button" name="button">Present</button></a>
<a href="attendence.php?change=absent&date=<?php echo $today; ?>&class=<?php echo $class; ?>&batch=<?php echo $batch; ?>&roll=<?php echo $each_row["roll"]; ?>">
<button type="button" name="button">Absent</button></a>
<form class="" style="width: 100px;" action="attendence.php?change=absent&date=<?php echo $today; ?>&class=<?php echo $class; ?>&batch=<?php echo $batch; ?>&roll=<?php echo $each_row["roll"]; ?>" method="post">
<input style="width: 50px;" type="text" name="late" value="0">
<input style="width: 50px;" type="submit" name="" value="Late">
</form>
</td>
</tr>
<?php } ?>
I have a different view for your design, it might be little difficult for you to digest but you can go for BOOTSTRAP framework and use simple grid to design the same thing using <div> or <span> tags in the tabular view (which will be responsive too) and will make you form look even better.
For Reference : Bootstrap Grid System
You may want to try the following structure. Consider using single <form> tag outside the main <table> and also consider not using the <a> anchor around the <button>.
<form method="post">
<table style="width: 100%">
<?php while ($each_row = mysqli_fetch_assoc($table_data)){ ?>
<tr style="border: 1px solid black;">
<td style="border: 1px solid black;">1</td>
<td style="border: 1px solid black;">2</td>
<td style="border: 1px solid black;">3</td>
<td style="border: 1px solid black; text-align:center;">4</td>
<td style="border: 1px solid black; width: 300px;">
<a href="#YourUrlHere"><!--CONSIDER REMOVING THIS ANCHOR-->
<button type="button" name="button">Present</button>
</a><!--CONSIDER REMOVING THIS ANCHOR-->
<a href="#YourUrlHere"><!--CONSIDER REMOVING THIS ANCHOR-->
<button type="button" name="button">Absent</button>
</a><!--CONSIDER REMOVING THIS ANCHOR-->
<input style="width: 50px;" type="text" name="late" value="0">
<input style="width: 50px;" type="submit" name="" value="Late">
</td>
</tr>
<?php } ?>
</table>
</form>
https://jsfiddle.net/ksrgnmcm/#&togetherjs=Nl81IM2PG7
Hope it helps somehow.
I have made separate html file and using file_get_content i am using it to include it in my content part but when i recieve email html code is displayed as a text rather than what the ouptut of html file should be
<html>
<head>
</head>
<body>
<div>
<div class="popup-logo" style="width: 100px;">
<img src="logo.png" alt="jk" style="margin-left: 45%;width: 200px;height: 50px;"></div>
</div>
<div id="popup" style="width: 100%;margin-left: auto;margin-right: auto;background: #FFFFFF;-moz-box-shadow: #64686e 0px 0px 3px 3px;-webkit-box-shadow: #64686e 0px 0px 3px 3px;margin-top: 1%;">
<div class="search-col" style="border-bottom: 1px solid #e5e5e5;float: left;margin-bottom: 5px;padding: .2px;width: 100%;table, th, td {
border: .5px solid silver;border-collapse: collapse;">
<div class="select-style">
<div class="select-style-text" style="width: 100%;height: 67px;float: left;padding-left: 10px;">
<p style="color: #840107;font-family: Hind;font-size: 25px;font-weight: 600;text-align: left;margin-left: 40%;text-overflow: none;text-indent: 2em;">Dispatched Details</p>
</div>
<div class="da" style="color:green;margin-left:85%;">
<?php
$date = date('d-M-Y H:i:s');
echo "Date"." ". $date;
?>
</div>
</div>
</div>
<div>
<div id="wer">
<h3 style="padding: 0.5px;padding-left: 5px;">Order Number:<?php echo $_SESSION['id'];?></h3>
<h3 style="padding: 0.5px;padding-left: 5px;">Vendor details:</h3>
<div id="wer" style="margin-left:0%;">
<table style="width: 100%;border: 1px solid silver;border-collapse: collapse;text-align: center;">
<tr>
<th style="border: 1px solid silver;border-collapse: collapse;text-align: center;">VendorName</th>
<th style="border: 1px solid silver;border-collapse: collapse;text-align: center;">Code</th>
<th style="border: 1px solid silver;border-collapse: collapse;text-align: center;">Email</th>
<th style="border: 1px solid silver;border-collapse: collapse;text-align: center;">Contact</th>
</tr>
<tr>
<td style="border: 1px solid silver;border-collapse: collapse;text-align: center;"><?php echo $_SESSION['vnm']?></td>
<td style="border: 1px solid silver;border-collapse: collapse;text-align: center;"><?php echo $_SESSION['vcd']?></td>
<td style="border: 1px solid silver;border-collapse: collapse;text-align: center;"><?php echo $_SESSION['vem']?></td>
<td style="border: 1px solid silver;border-collapse: collapse;text-align: center;"><?php echo $_SESSION['vcn']?></td>
</tr>
</table>
</div>
<div id="wer" style="margin-top:3%;">
<h3 style="padding: 0.5px;padding-left: 5px;">Other Details:</h3>
<style>
</style>
<table style="width: 100%;border: 1px solid silver;border-collapse: collapse;text-align: center;">
<tr>
<th style="border: 1px solid silver;border-collapse: collapse;text-align: center;">Driver name</th>
<th style="border: 1px solid silver;border-collapse: collapse;text-align: center;">Driver contact </th>
<th style="border: 1px solid silver;border-collapse: collapse;text-align: center;">Vehicle Number</th>
</tr>
<tr>
<td style="border: 1px solid silver;border-collapse: collapse;text-align: center;"><?php echo $_SESSION['drivname']?></td>
<td style="border: 1px solid silver;border-collapse: collapse;text-align: center;"><?php echo $_SESSION['dcontact']?></td>
<td style="border: 1px solid silver;border-collapse: collapse;text-align: center;"><?php echo $_SESSION['vnumber']?></td>
</tr>
</table>
</div>
<?php session_destroy();?>
</div></div></div></body>
</html>
<?php
require '/sendgrid-php/vendor/autoload.php';
if(require("sendgrid-php/vendor/autoload.php"))
{echo "path found";}
$from = new SendGrid\Email(null, 'k1#gmail.com');
$subject ='Order number is';
$to = new SendGrid\Email(null, 'k2#gmail.com');
$r=file_get_contents('ret.html');
$content = new SendGrid\Content("text/plain",$r);
$mail = new SendGrid\Mail($from, $subject, $to, $content);
$apiKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$sg = new \SendGrid($apiKey);
$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
echo $response->headers();
echo $response->body();
?>
You have to include that file, evaluate it as PHP and capture it inside a variable instead of storing the unevaluated content in a string:
ob_start();
include("ret.html");
$r = ob_get_clean();
$content = new SendGrid\Content("text/html",$r);
By the way, you should consider using a templating engine for that job.
From what I can understand, your email is sent as plain text instead of an html. That's because you have the email type set as text/plain when creating the SendGrid object. Changing it to text/html should do it. Replace this line
$content = new SendGrid\Content("text/plain",$r);
with
$content = new SendGrid\Content("text/html",$r);
I wasn't sure if anyone has already posted this kind of problem before. I am having an issue trying to check whether a submit button has been clicked and that the elements within the associated form have been stored in a variable.
I have a calculator form which displays the results when it is submitted; another form is then displayed dynamically. When the second form is submitted, the results are emailed to me along with person's name and email from the second form. I have to use all PHP as HTML elements and javascript elements will not work without using a PHP variable. Here is a sample of the code:
else {
$message0 = "<table style='margin-bottom: 10px; width: 505px;' align='center' border='0' cellpadding='0' cellspacing='0'>
<tbody>
<tr valign='top'>
<td>
<div style='padding: 0px; margin: 0px; width: 245px; height: 58px;'><a href='http://www.manticoretechnology.com/'><img alt='' src='http://stats.manticoretechnology.com/ImgHost/668/20746/logo.png' border='0' height='52' width='379' /></a>
</div>
</td>
<td align='right' valign='bottom'>
<div style='font-weight: bold; font-size: 9pt; padding-bottom: 5px; text-transform: uppercase; width: 200px; color: #ef762d; font-family: Arial, Helvetica, sans-serif; text-align: right;'>telecom audit <br />challenge</div>
</td>
</tr>
<tr valign='top'>
<td colspan='2'>
<div style='margin: 0px; width: 505px; height: 32px; padding: 0px;'><img alt='' src='http://stats.ManticoreTechnology.com/ImgHost/header.gif' height='32' width='505' />
</div>
</td>
</tr>
<tr valign='top'>
<td style='border-right: #e9e9e9 1px solid; border-left: #e9e9e9 1px solid;' colspan='2'>
<div style='font-size: 8pt; background: #ffffff; width: 503px; color: #666666; line-height: 16px; font-family: Arial, Helvetica, sans-serif;'>
<p style='padding-right: 30px; padding-left: 30px; padding-bottom: 20px; margin: 0px; padding-top: 0px;'>This email has been sent to you because someone has filled out the telecom audit calculator. Details of the activity are as follows:</p>
<h2 style='padding-right: 0px; padding-left: 0px; font-weight: bold; font-size: 9pt; padding-bottom: 4px; margin: 0px 0px 20px 30px; text-transform: uppercase; width: 75%; color: #14508e; padding-top: 0px; border-bottom: #e9e9e9 1px solid; font-family: Arial, Helvetica, sans-serif;'>Contact Details</h2>
<div style='padding-right: 30px; padding-left: 30px; padding-bottom: 20px; margin: 0px; padding-top: 0px;'>
<table style='font-size: 8pt; background: #ffffff; color: #666666; line-height: 16px; font-family: Arial, Helvetica, sans-serif;'>
<tbody>
<tr>
<td style='font-weight: bold;' width='73'>First Name:</td>
<td width='15'></td>
<td width='111'>$fname</td>
</tr>
<tr>
<td style='font-weight: bold;'>Last Name:</td>
<td></td>
<td>$lname</td>
</tr>
<tr>
<td style='font-weight: bold;'>Email:</td>
<td></td>
<td>$email</td>
</tr>
<tr>
<td style='font-weight: bold;'></td>
<td></td>
<td></td>
</tr>
<tr>
<td style='font-weight: bold;'>Landline:</td>
<td></td>
<td>\$ $landline</td>
</tr>
<tr>
<td style='font-weight: bold;'>Long Distance:</td>
<td></td>
<td>\$ $longdist</td>
</tr>
<tr>
<td style='font-weight: bold;'>Wireless:</td>
<td></td>
<td>\$ $wireless</td>
</tr>
<tr>
<td style='font-weight: bold;'>Data:</td>
<td></td>
<td>\$ $data</td>
</tr>
<tr>
<td style='font-weight: bold;'>Conferencing:</td>
<td></td>
<td>\$ $conference</td>
</tr>
<tr>
<td style='font-weight: bold;'></td>
<td></td>
<td></td>
</tr>
<tr>
<td style='font-weight: bold;'></td>
<td></td>
<td></td>
</tr>
<tr>
<td style='font-weight: bold;'><strong>Total Telecom Expense Per Month:</strong>
</td>
<td></td>
<td>\$ $results</td>
</tr>
<tr>
<td style='font-weight: bold;'><strong>Total Telecom Expense Per Year:</strong>
</td>
<td></td>
<td>\$ $yresults</td>
</tr>
<tr>
<td style='font-weight: bold;'><strong>Estimated Savings:</strong>
</td>
<td></td>
<td>\$ $sevenpercent</td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
<tr valign='top'>
<td colspan='2'>
<div style='margin: 0px; width: 505px; height: 32px; padding: 0px;'><img alt='' src='http://stats.ManticoreTechnology.com/ImgHost/footer.gif' height='30' width='505' />
</div>
</td>
</tr>
</tbody>
</table>
<center>
<div style='margin: 0px auto; width: 504px; text-align: left;'>
<p style='padding-right: 15px; padding-left: 15px; font-size: 7pt; padding-bottom: 20px; margin: 0px; color: #999999; padding-top: 0px; font-family: Arial, Helvetica, sans-serif;'>ISI Telemanagement Solutions, Inc., 1051 Perimeter Drive, Suite 200., Schaumburg, IL, 60173, 847-995-0002<br /> This email has been sent to you as part of your Manticore Technology account. Please see your account administrator if you have any questions, or contact your Manticore account representative.</p>
</div>
</center>";
$formoutput = "<form id='$adminform' class='form-validate' enctype='multipart/form-data' onsubmit='return true' name='$adminform' method='post' action='#' novalidate='novalidate'>
<table width='250px' align='center'>
<tr>
<td class='firstrow_dti' width='39%' align='left'>First Name</td><td class='firstrow_dti' width='14%' align='left'></td>
<td class='firstrow_dti' width='35%' align='left'>Last Name</td>
</tr>
<tr>
<td class='firstrow_dti' width='4%' align='left'>
<input id='fld_18' class='elem18 ' type='text' placeholder='' mask='' value='' name='fld_18' fldname='fname'>
</td>
<td class='firstrow_dti' width='39%' align='left'></td>
<td class='firstrow_dti' width='14%' align='left'>
<input id='fld_19' class='elem19 ' type='text' placeholder='' mask='' value='' name='fld_19' fldname='lname'>
</td>
</tr>
<tr>
<td class='firstrow_dti' width='4%' align='left'></td>
<td class='firstrow_dti' width='39%' height='5' align='left'></td>
<td class='firstrow_dti' width='14%' align='left'></td>
</tr>
<tr>
<td class='firstrow_dti' align='left'>Email</td>
<td class='firstrow_dti' width='39%' align='left'></td>
<td class='firstrow_dti' width='14%' align='left'></td>
</tr>
<tr>
<td class='firstrow_dti' width='4%' align='left'>
<input id='fld_16' class='required elem16 valid' type='text' placeholder='' mask='' value='' name='fld_16' fldname='email'>
</td>
<td class='firstrow_dti' width='39%' align='left'></td>
<td class='firstrow_dti' width='14%' align='left'></td>
</tr>
</table>
<div class='row-fluid2' align='center'>
<div class='btcalctoolbar span12'>
<input id='$submitbutton' class='btn btn-primary' type='button' value='Submit' name='submit'>
<input type='hidden' value='1' name='submitted' />
<input type='hidden' value='' name='postSection'>
<input type='hidden' value='' name='postSection2'>
<input class='btn' type='reset' value='Reset' onclick='javascript:reset$resetbutton;return true;'>
</div>
</div>
</form>";
$qualify = "<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='30%' valign='top' align='center'><img width='150' height='150' alt='' style='padding-top:100px;' src='/images/badge/congrats-badge.png'></td>
<td width='70%' valign='top' mc:edit='small-image-left-text'>
<p style='font-family:Arial, Helvetica, sans-serif; color:#284C85; font-size:16px; line-height:18px; padding-top:35px;margin-right:45px;'>Congratulations!</p>
<p style='font-family:Arial, Helvetica, sans-serif; color:#333; font-size:12px;color:#333;line-height:18px;margin-right:45px;'>After calculating your telecom needs, we are happy to say that you qualify for our Telecom Savings Challenge.</p>
<p style='font-family:Arial, Helvetica, sans-serif; color:#333; font-size:12px;color:#333;line-height:18px;margin-right:45px;'>If we can't save you <strong style='font-size:13px;'>" . "$" . $sevenpercent . "</strong>, then you'll get a <strong style='font-size:13px;'>$100 gift card</strong>. No Strings attached.</p>
<p><!-- START MODULE - 3 columns -->
<table width='530' border='0' cellpadding='0' cellspacing='0' align='center'>
<tr>
<td width='160' valign='top' align='center'><img src='http://www.isi-info.com/m/campaign/telecom-savings/telecom-challenge-accepted/images/Number-icon-set-1.png' width='32' height='32' /><br><p style='font-family:Arial, Helvetica, sans-serif; color:#333; font-size:12px;color:#333;line-height:18px'>Download and sign <br/>the attached NDA</p><img src='http://www.isi-info.com/m/campaign/telecom-savings/telecom-challenge-accepted/images/download-button.png' width='89' height='23' /></td>
<td width='25' align='center' valign='top'><img src='http://www.isi-info.com/m/assets/divider/content-divider-normal-90-grey.jpg' width='10' height='115'/></td>
<td width='160' valign='top' align='center'><img src='http://www.isi-info.com/m/campaign/telecom-savings/telecom-challenge-accepted/images/Number-icon-set-2.png' width='32' height='32' /><br><p style='font-family:Arial, Helvetica, sans-serif;color:#333;font-size:12px;color:#000000;line-height:18px'>Send us your <br/>telecom invoices</p><img src='http://www.isi-info.com/m/campaign/telecom-savings/telecom-challenge-accepted/images/email-button.png' width='89' height='23' /></td>
<td width='25' align='center' valign='top'><img src='http://www.isi-info.com/m/assets/divider/content-divider-normal-90-grey.jpg' width='10' height='115'/></td>
<td width='160' valign='top' align='center'><img src='http://www.isi-info.com/m/campaign/telecom-savings/telecom-challenge-accepted/images/Number-icon-set-3.png' width='32' height='32' /><br><p style='color:#333; font-family:Arial, Helvetica, sans-serif;font-size:12px;color:#000000;line-height:18px'>We'll review your invoices and provide you with a report</p></td>
</tr>
</table>
<!-- END MODULE - 3 columns --></p>
<p style='font-family:Arial, Helvetica, sans-serif; color:#333; font-size:12px;color:#333;line-height:18px;margin-right:45px;'>So what happens next? Check your registered email for an update on the next step. Basically, after signing a mutual NDA, we will need to review invoices from your most recent full month of billing.</p>
</td>
</tr>
</table>
$formoutput
<div>
</div>
";
if(isset($_POST['submit'])) {
$to2 = "email#email.com";
$subject2 = "subject";
mail($to2, $subject2, $message0, $headers);
}
else {
echo "<script language='javascript' type='text/javascript'>
alert('email failed');
</script>";
}
If I understand you correctly, you need to have code to receive the form input - which I see you are sending via POST.
Once the form is submitted, all the details entered in the form fields will be in POST variables (i.e. anything entered in the fld_18 input will be found in $_POST['fld_18'].)
Are you looking for the page to reload? Or are you sending the user to another page after form submission?
If you want to display the second form without reload or sending the user to another page, utilizing JQuery may be more helpful to you.