Here is my php code
<?php
include "conn.php";
if(isset($_POST['submit'])){
$id_guru=htmlentities($_POST['id_guru']);
$id_pelajaran=htmlentities($_POST['id_pelajaran']);
$id_kelas=htmlentities($_POST['id_kelas']);
$query=mysql_query("insert into tbl_jadwal values('','$id_guru','$id_pelajaran','$id_kelas')");
if($query){
?><script language="javascript">document.location.href="?page=jadwal_pengajaran&status=1";</script><?php
}else{
?><script language="javascript">document.location.href="?page=jadwal_pengajaran&status=2";</script><?php
}
}else{
unset($_POST['submit']);
}
?>
<!-- start page-heading --><title>Sistem Informasi SMP YPPI</title>
<div id="page-heading">
<h1>Jadwal Pengajaran</h1>
</div>
<!-- end page-heading -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
<th class="topleft"></th>
<td id="tbl-border-top"> </td>
<th class="topright"></th>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
<td id="tbl-border-left"></td>
<td>
<!-- start content-table-inner ...................................................................... START -->
<div id="content-table-inner">
<?php
if($_GET['status']=='1'){
?>
<div id="message-green">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="green-left">Data Tersimpan</td>
<td class="green-right"><a class="close-green"><img src="images/table/icon_close_green.gif" alt="" /></a></td>
</tr>
</table>
</div>
<?php
}
if($_GET['status']=='0'){
?>
<div id="message-red">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="red-left">Gagal Menyimpan</td>
<td class="red-right"><a class="close-red"><img src="images/table/icon_close_red.gif" alt="" /></a></td>
</tr>
</table>
</div>
<?php
}
?>
<form action="?page=jadwal_pengajaran" method="post">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td><!-- start step-holder -->
<!-- end step-holder -->
<!-- start id-form -->
<table border="0" cellpadding="0" cellspacing="0" id="id-form">
<tr>
<th valign="top">Guru</th>
<td><select name="id_guru" class="styledselect_form_1">
<?php
$guru=mysql_query("select * from data_guru order by nama_guru asc");
while($row1=mysql_fetch_array($guru)){
?>
<option value="<?php echo $row1['id_guru'];?>"><?php echo $row1['nama_guru'];?> [ <?php echo $row1['nip'];?> ] <option>
<?php
}
?>
</select>
</td>
<td></td>
</tr>
<tr>
<th valign="top">Pelajaran</th>
<td><select name="id_pelajaran" class="styledselect_form_1">
<?php
$pelajaran=mysql_query("select * from setup_pelajaran order by nama_pelajaran asc");
while($row2=mysql_fetch_array($pelajaran)){
?>
<option value="<?php echo $row2['id_pelajaran'];?>"><?php echo $row2['nama_pelajaran'];?></option>
<?php
}
?>
</select>
</td>
<td></td>
</tr>
<tr>
<th valign="top">Kelas</th>
<td><select name="id_kelas" class="styledselect_form_1">
<?php
$kelas=mysql_query("select * from setup_kelas order by nama_kelas asc");
while($row3=mysql_fetch_array($kelas)){
?>
<option value="<?php echo $row3['id_kelas'];?>"><?php echo $row3['nama_kelas'];?></option>
<?php
}
?>
</select>
</td>
<td></td>
</tr>
<tr>
<th> </th>
<td valign="top"><input type="submit" name="submit" class="form-submit" />
<input type="reset" class="form-reset" />
</td>
<td></td>
</tr>
</table>
<!-- end id-form -->
</td>
<td><!-- start related-activities -->
</td>
</tr>
<tr>
<td><img src="images/shared/blank.gif" width="695" height="1" alt="blank" /></td>
<td></td>
</tr>
</table>
</form>
<p><em>*Tidak boleh 1 Kelas, 1 Pelajaran di ajarkan oleh 2 Guru atau lebih<br /></em> </p>
<p> </p>
<!-- start product-table ..................................................................................... -->
<form id="mainform" action="">
<table border="0" width="71%" cellpadding="0" cellspacing="0" id="product-table">
<tr>
<th width="13%" class="table-header-repeat line-left minwidth-1">Nomor </th>
<th width="24%" class="table-header-repeat line-left minwidth-1">Nama Guru</th>
<th width="26%" class="table-header-repeat line-left minwidth-1">NIP</th>
<th width="24%" class="table-header-repeat line-left minwidth-1">Mata Pelajaran</th>
<th width="24%" class="table-header-repeat line-left minwidth-1">Kelas</th>
<th width="13%" class="table-header-options line-left">Aksi</th>
</tr>
**<?php
$view=mysql_query("*SELECT* FROM tbl_jadwal jadwal, setup_kelas kelas, setup_pelajaran pelajaran, data_guru guru where jadwal.id_kelas=kelas.id_kelas and jadwal.id_pelajaran=pelajaran.id_pelajaran and jadwal.id_guru=guru.id_guru order by id_jadwal asc");
$no=0;
while($row=mysql_fetch_array($view)){
?>
<tr>
<td><?php echo $no=$no+1;?></td>
<td><?php echo $row['nama_guru'];?></td>
<td><?php echo $row['nip'];?></td>
<td><?php echo $row['nama_pelajaran'];?></td>
<td><?php echo $row['nama_kelas'];?></td>
<td class="options-width">
</td>
</tr>
<?php
}
?>
</table>
<!-- end product-table................................... -->
</form>
<div class="clear"></div>
</div>
<!-- end content-table-inner ............................................END -->
</td>
<td id="tbl-border-right"></td>
</tr>
<tr>
<th class="sized bottomleft"></th>
<td id="tbl-border-bottom"> </td>
<th class="sized bottomright"></th>
</tr>
</table>**
When i test the code on browser, there's nothing displayed, only empty table, but there is saved data on the database.
I believe the problem came from
**<?php
$view=mysql_query("*SELECT* FROM tbl_jadwal jadwal, setup_kelas kelas, setup_pelajaran pelajaran, data_guru guru where jadwal.id_kelas=kelas.id_kelas and jadwal.id_pelajaran=pelajaran.id_pelajaran and jadwal.id_guru=guru.id_guru order by id_jadwal asc");
$no=0;
while($row=mysql_fetch_array($view)){
?>
<tr>
<td><?php echo $no=$no+1;?></td>
<td><?php echo $row['nama_guru'];?></td>
<td><?php echo $row['nip'];?></td>
<td><?php echo $row['nama_pelajaran'];?></td>
<td><?php echo $row['nama_kelas'];?></td>
<td class="options-width">
</td>
</tr>
<?php
}
?>
But still I can't figure out what the problem is.
is that
$view=mysql_query("*SELECT* FROM ...
from the paste, it should look like this:
$view=mysql_query("SELECT * FROM ...
and
while($row=mysql_fetch_array($view)){
will give you a numbered array, not an associative array. Thus you need to EITHER access fields in their order:
<td><?php echo $row[0];?></td>
<td><?php echo $row[1];?></td> ...
or use assoc (NOT BOTH):
while($row=mysql_fetch_assoc($view)){
Related
I want to generate HTML table into PDF.
But I'm having trouble for gridding the table. I want to generate table like this:
I have this table from database:
Which is should fill this column:
and I have a second table from database like this:
which is should fill the rest of the columns except keterangan column.
I tried this code :
<table class="tbl" border="1" style="margin: 0 auto;">
<tr style="height: 50px;">
<th rowspan="2" style="width: 50%">Nomor</th>
<th colspan="4">Pemberian entertaiment dan sejenisnya</th>
<th colspan="4">Relasi usaha yang diberikan entertainment dan sejenisnya</th>
<th rowspan="2">Keterangan</th>
</tr>
<tr>
<th>Tanggal</th>
<th>Alamat</th>
<th>Jenis</th>
<th>Jumlah</th>
<th>Nama</th>
<th>Posisi</th>
<th>Nama Perusahaan</th>
<th>Jenis Usaha</th>
</tr>
<tr>
<td>
<?PHP echo $row->nomor?>
</td>
<td>
<?PHP echo $row->tanggal?>
</td>
<td>
<?php echo $row->alamat?>
</td>
<td>
<?PHP echo $row->jenis?>
</td>
<td>
<?PHP echo $row->jumlah?>
</td>
<?php
foreach ($list->result() as $data){
?>
<tr>
<td>
<?PHP echo $data->nama?>
</td>
<td>
<?PHP echo $data->posisi?>
</td>
<td>
<?PHP echo $data->nama_perusahan?>
</td>
<td>
<?PHP echo $data->jenis_usaha?>
</td>
</tr>
<?php
}
?>
<td>
<?PHP echo $row->keterangan?>
</td>
</tr>
but this is the result :
Try this:
<table class="tbl" border="1" style="margin: 0 auto;">
<tr style="height: 50px;">
<th rowspan="2" style="width: 50%">Nomor</th>
<th colspan="4">Pemberian entertaiment dan sejenisnya</th>
<th colspan="4">Relasi usaha yang diberikan entertainment dan sejenisnya</th>
<th rowspan="2">Keterangan</th>
</tr>
<tr>
<th>Tanggal</th>
<th>Alamat</th>
<th>Jenis</th>
<th>Jumlah</th>
<th>Nama</th>
<th>Posisi</th>
<th>Nama Perusahaan</th>
<th>Jenis Usaha</th>
</tr>
<tr>
<td>
<?PHP echo $row->nomor?>
</td>
<td>
<?PHP echo $row->tanggal?>
</td>
<td>
<?php echo $row->alamat?>
</td>
<td>
<?PHP echo $row->jenis?>
</td>
<td>
<?PHP echo $row->jumlah?>
</td>
<?php
foreach ($list->result() as $data){
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>
<?PHP echo $data->nama?>
</td>
<td>
<?PHP echo $data->posisi?>
</td>
<td>
<?PHP echo $data->nama_perusahan?>
</td>
<td>
<?PHP echo $data->jenis_usaha?>
</td>
</tr>
<?php
}
?>
<td>
<?PHP echo $row->keterangan?>
</td>
</tr>
Note the extra columns are added inside the loop to enable it to line up with you headers.
I am having a nested table with a while loop, I want to add one more nested table in the same row:
Now I want to add one more nested table as each cd contains more than one data like below:
My code is as follows
<?php
if(isset($_POST['viewcd'])){
$queryw = "select * from lib_cd where id=".$_POST['idd'];
$resultw = $mysqli->query($queryw);
?>
<div>
<table border="1">
<thead>
<tr ><th >Select</th>
<th>Well_Number</th>
<th>Well_Name</th>
<th>CD No:</th>
<th >Logs</th>
</tr>
</thead>
<?php
while($rowcd = $resultw->fetch_assoc()){
?>
<tr>
<td><?php echo $rowcd['id'] ?> </td>
<td><?php echo $rowcd['well_no'] ?></td>
<td><?php echo $rowcd['well_name'] ?></td>
<td>
<table border="1" width="100%">
<?php
$querycd = "select * from cd where pidd=".$rowcd['id'];
$resultcd = $mysqli->query($querycd);
while($rowcd = $resultcd->fetch_assoc()){
?>
<tr>
<td ><?php echo $rowcd['cd_no'] ?></td>
/* I want to add one more nested table here*/
</tr>
<?php
}
?>
</table>
</td>
</tr>
<?php
}
}
?>
</table>
</div>
I tried some thing like this,after my second while loop
while($rowcd = $resultcd->fetch_assoc()){
?>
<tr>
<td ><?php echo $rowcd['cd_no'] ?></td>
<td>
<table>
<?php
$queryl = "select * from lib_cd_logs where pid=".$rowcd['cd_no'];
$resultl = $mysqli->query($queryl);
while($rowl = $resultl->fetch_assoc()){
?>
<tr>
<td><?php echo $rowl['logs'] ?></td>
</tr>
<?php
}
?>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<?php
}
}
?>
</table>
</div>
but the result was messed up. I am confused, where I want to end my while loop, I think.
Finally i got as i wish, and i am sharing the code as below
<?php
if(isset($_POST['viewcd'])){
$queryw = "select * from lib_cd where id=".$_POST['idd'];
$resultw = $mysqli->query($queryw);
?>
<div class="container">
<table border="1" align="center" border-collapse="collapse">
<thead>
<tr >
<th >Select</th>
<th>Well_Number</th>
<th>Well_Name</th>
<th width="100">CD No:</th>
<th width="150">Logs</th>
<th width="100">Bottom Depth</th>
<th width="100">Top Depth</th>
<th width="100">Date of Log</th>
</tr>
</thead>
<?php
while($rowcd = $resultw->fetch_assoc()){
?>
<tr>
<td><?php echo $rowcd['id'] ?> </td>
<td align="center"><?php echo $rowcd['well_no'] ?></td>
<td align="center"><?php echo $rowcd['well_name'] ?></td>
<td colspan="5">
<table rules="all">
<tr>
<?php
$querycd = "select * from cd where pidd=".$rowcd['id'];
$resultcd = $mysqli->query($querycd);
while($rowcd = $resultcd->fetch_assoc()){
?>
<td width="100" align="center"><?php echo $rowcd['cd_no'] ?></td>
<td colspan="4">
<table rules="all">
<tr>
<?php
$queryl = "select * from lib_cd_logs where pid=".$rowcd['cd_no'];
$resultl = $mysqli->query($queryl);
while($rowl = $resultl->fetch_assoc()){
?>
<td width="155"><?php echo $rowl['logs'] ?></td>
<td width="105" align="center"><?php echo $rowl['bottom'] ?></td>
<td width="100" align="center"><?php echo $rowl['top'] ?></td>
<td width="100" align="right"><?php echo $rowl['date'] ?></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<?php
}
?>
</table>
</td>
<?php
}
}
?>
</tr>
</table>
I hope this is what you meant as per your data table shown above
<div>
<table border="1">
<thead>
<tr ><th >Select</th>
<th>Well_Number</th>
<th>Well_Name</th>
<th>CD No:</th>
<th >Logs</th>
</tr>
</thead>
<tr>
<td>id</td>
<td>well</td>
<td>name</td>
<td>
<table border="1" width="100%">
<tr>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
</table>
</td>
<td>
<table border="1" width="100%">
<tr>
<td>Log1</td>
</tr>
<tr>
<td>Log2</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
I have web page look like this
<td valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="1" class="main_tb3">
<tr>
<td colspan="2">
<div align="center">
<a href="/title/name.php" target="_blank">
<img src="./movie/image.jpg" alt="TitleName" border="0" height="100" width="225" />
</a>
</div>
</td>
</tr>
<tr>
<td colspan="2"><h1 align="center">Title - secondname</h1></td>
</tr>
<tr>
<td><span class="style10">Cat1 :</span></td>
<td>1st name</td>
</tr>
<tr>
<td width="32%"><span class="style10">Cat2 :</span></td>
<td width="68%"><b><i>secondname</i></b></td>
</tr>
<tr>
<td><span class="style10">cat4 :</span></td>
<td>Bla bla</td>
</tr>
<tr>
<td><span class="style10">Cat3 :</span></td>
<td>thirdName2</td>
</tr>
</table>
</td>
<td valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="1" class="main_tb3">
<tr>
<td colspan="2">
<div align="center">
<a href="/title/name.php" target="_blank">
<img src="./movie/image.jpg" alt="TitleName" border="0" height="100" width="225" />
</a>
</div>
</td>
</tr>
<tr>
<td colspan="2"><h1 align="center">Title - secondname</h1></td>
</tr>
<tr>
<td><span class="style10">Cat1 :</span></td>
<td>1st name</td>
</tr>
<tr>
<td width="32%"><span class="style10">Cat2 :</span></td>
<td width="68%"><b><i>secondname</i></b></td>
</tr>
<tr>
<td><span class="style10">cat4 :</span></td>
<td>Bla bla</td>
</tr>
<tr>
<td><span class="style10">Cat3 :</span></td>
<td>thirdName2</td>
</tr>
</table>
</td>
I would like to get certain values from this site using python regex.
After <div align="center"> I like to get href value: "/title/name.php" and img src: "./movie/image.jpg" and Title - secondname from <h1 align="center">Title - secondname</h1>
i have tried this:
regex = 'class="main_tb3"*\n<a href="(.+?)" target="_blank">\n<img src="(.+?)"'
please help me
you can use below regex
For href value: <a href="(.*?)"
For Image src: <img src="(.*?)"
For Title: titleid=12">(.*?)<
You will find it a lot simpler to install something like BeautifulSoup to do this:
from bs4 import BeautifulSoup
html = """
<td valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="1" class="main_tb3">
<tr>
<td colspan="2">
<div align="center">
<a href="/title/name.php" target="_blank">
<img src="./movie/image.jpg" alt="TitleName" border="0" height="100" width="225" />
</a>
</div>
</td>
</tr>
<tr>
<td colspan="2"><h1 align="center">Title - secondname</h1></td>
</tr>
<tr>
<td><span class="style10">Cat1 :</span></td>
<td>1st name</td>
</tr>
<tr>
<td width="32%"><span class="style10">Cat2 :</span></td>
<td width="68%"><b><i>secondname</i></b></td>
</tr>
<tr>
<td><span class="style10">cat4 :</span></td>
<td>Bla bla</td>
</tr>
<tr>
<td><span class="style10">Cat3 :</span></td>
<td>thirdName2</td>
</tr>
</table>
</td>
<td valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="1" class="main_tb3">
<tr>
<td colspan="2">
<div align="center">
<a href="/title/name.php" target="_blank">
<img src="./movie/image.jpg" alt="TitleName" border="0" height="100" width="225" />
</a>
</div>
</td>
</tr>
<tr>
<td colspan="2"><h1 align="center">Title - secondname</h1></td>
</tr>
<tr>
<td><span class="style10">Cat1 :</span></td>
<td>1st name</td>
</tr>
<tr>
<td width="32%"><span class="style10">Cat2 :</span></td>
<td width="68%"><b><i>secondname</i></b></td>
</tr>
<tr>
<td><span class="style10">cat4 :</span></td>
<td>Bla bla</td>
</tr>
<tr>
<td><span class="style10">Cat3 :</span></td>
<td>thirdName2</td>
</tr>
</table>
</td>"""
soup = BeautifulSoup(html)
for table in soup.find_all("table", class_="main_tb3"):
print table.find('a').get('href')
print table.find('h1').text
For the HTML you have given, this will print the following:
/title/name.php
Title - secondname
/title/name.php
Title - secondname
i'm trying to get next rows in my multiple table using ajax and php. my concept is that on changing my year and type selection, table has to re_appears.
if i change type as year third table hides and if semester third table appears. it works fine,. but if i change no of year table rows also have to added according to that.
for example if no of years 4 means then i have to get fou rows in each table.
i dono where i struck here?
my code:
<table>
<tr><td><label><span class="required">*</span>No of Year</label></td>
<td>
<select name="no_of_year" id="no_no_year" onchange="change_row()">
<option value="">--Year--</option>
<?php for($i=1;$i<=$year;$i++) { ?>
<option value="<?php echo $i; ?>" <?php if($_POST['no_of_year']==$i) { echo "selected"; } ?>><?php echo $i; ?></option>
<?php } ?>
</select> <span class="required"><?php echo $msg_year;?></span>
</td>
</tr>
<tr> <td><label><span class="required">*</span>Type</label> </td>
<td><select name="type" onchange="change_col(this.value);"><option value="">--Type--</option> <option value="2" <?php if($_POST['type']=='2') { echo "selected"; } ?>>Semester</option> <option value="1" <?php if($_POST['type']== '1') { echo "selected"; } ?>> Year </option> </select>
<span class="required"><?php echo $msg_type;?></span></td></tr>
<tr> <td><label><span class="required">*</span>Fees Per Year/Semester:</label> </td> </tr>
<tr>
<table class="fees_dets" border="1px solid" cellpadding="1" cellspacing="1">
<tr>
<td>
<table id="year_tab" cellpadding="1" cellspacing="1">
<tr style="height:37px;"> <th > Year </th> </tr>
<tr> <td align="center"> <input type="text" name="year1" value="1" /> </td> </tr>
</table>
</td>
<td>
<table id="sem1_tab" cellpadding="1" cellspacing="1">
<tr> <th colspan="2"> Semester-1 </th> </tr>
<tr> <th> Due date</th> <th > Fees</th> </tr>
<tr> <td > <input type="text" name="y1_fees1" /> </td><td> <input type="text" name="y1_due1" /> </td> </tr>
</table>
</td>
<td id="donshow">
<table id="sem2_tab" cellpadding="1" cellspacing="1">
<tr> <th colspan="2" > Semester-2</th> </tr>
<tr> <th> Due date</th> <th > Fees</th> </tr>
<tr> <td > <input type="text" name="y1_fees2" /> </td><td > <input type="text" name="y1_due2" /> </td> </tr>
</table>
</td>
</tr>
</table>
</tr>
</table>
script:
<script type="text/javascript">
function change_col(type)
{
if(type == 1 ) {
document.getElementById("donshow").style.display = 'none';
}
else if(type == 2 ) {
document.getElementById("donshow").style.display = 'block';
}
}
function change_row(year)
{
$.ajax({
type: 'POST',
url: 'ajax_redirect.php',
data:{
type : 'year_tab',
year : year
},
success: function(msg){
//alert(msg);
document.getElementByClassName('fees_dets').innerHTML = msg;
}
});
}
</script>
ajax_redirect.php
<?
$n= $_POST['year'];
if($_POST['type'] == 'year_tab')
{
for($i=2;$i<=$n;$i++)
{
?>
<table class="fees_dets" border="1px solid" cellpadding="1" cellspacing="1">
<tr>
<td>
<table id="year_tab" cellpadding="1" cellspacing="1">
<tr style="height:37px;"> <th > Year </th> </tr>
<tr> <td align="center"> <input type="text" name="year<?=$i?>" value="<?=$i?>" /> </td> </tr>
</table>
</td>
<td>
<table id="sem1_tab" cellpadding="1" cellspacing="1">
<tr> <th colspan="2"> Semester-1 </th> </tr>
<tr> <th> Due date</th> <th > Fees</th> </tr>
<tr> <td > <input type="text" name="y<?=$i?>_fees1" /> </td><td> <input type="text" name="y<?=$i?>_due1" /> </td> </tr>
</table>
</td>
<td id="donshow">
<table id="sem2_tab" cellpadding="1" cellspacing="1">
<tr> <th colspan="2" > Semester-2</th> </tr>
<tr> <th> Due date</th> <th > Fees</th> </tr>
<tr> <td > <input type="text" name="y<?=$i?>_fees2" /> </td><td > <input type="text" name="y<?=$i?>_due2" /> </td> </tr>
</table>
</td>
</tr>
</table>
<? }
}
?>
can anyone help?
You need to hit the ajax_redirect.php every time you change the 'no. of years', your ajax_redirect.php must execute the select query to associated table with changing where clause. Whatever HTML element you are using, must be replaced with new value(s) accordingly.
NOTE: Here I assume you are fetching data from DB thats why I have
asked you to use select query on asssociated table with changing where
clause.
UPDATE: Your Problem is with document.getElementByClassName('fees_dets') because there no such function as getElementByClassName... you should your table in a DIV with a attribute ID and use getElementById
below is the given div having id "panel" and links in the same page but outside this div, when I click on the link this div should be open. there are several links so jquery does not work and my button is created dynamically through php while loop hence i cannot put unique id in my hyperlink
<div id="panel">
<form name="userloginform" action="xxx.php" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="tb">
<tr>
<td align="left" valign="middle" height="80">User Name</td>
<td align="left" valign="middle">: </td>
<td align="left" valign="middle"><input name="user" type="text" class="log"/></td>
</tr>
<tr>
<td align="left" valign="middle">Password</td>
<td align="left" valign="middle">: </td>
<td align="left" valign="middle"><input name="pass" type="password" class="log"/></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="3"><input name="submit1" type="submit" value="Login" class="login_btn"/></td>
</tr>
</table>
</form>
</div>
and my link is
<a href="#" id="flip" >Launch Now</a>
<a href="#" id="" >Launch Now</a>
If I am not clear please reply which part is not clear so that I can edit and provide useful information clearly
ok here is where link is coming from, a CMS is used here.
<?php
$sql=mysql_query("SELECT * FROM heading ORDER BY id DESC");
while($r=mysql_fetch_array($sql))
{
$ii=$r['id'];
?>
<h3><?php echo $r['heading'];?></h3>
<div>
<div class="content">
<div class="main_table_wrapper">
<table width="1030" border="0" cellspacing="0" cellpadding="0" align="left">
<?php
$sql2=mysql_query("SELECT * FROM inner_table WHERE head='$ii'") ;
while($rows=mysql_fetch_array($sql2))
{
$abc=str_replace($rows['url'],'XXXXXXXXXXXXXXX',$rows['url']);
?>
<tr>
<th align="left" valign="middle" width="350"><?php echo $rows['inner_names'];?></th>
<th align="left" valign="middle" width="250"><?php echo $abc;?></th>
<th align="left" valign="middle" width="200"><?php echo $rows['author'];?></th>
<th align="center" valign="middle" width="100"><?php echo $rows['doe'];?></th>
<th align="right" valign="middle" width="130"><span class="lunch">Launch Now</span></th>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
<?php } ?>
</div>
You can't have multiple elements with the same id.
Since you didn't show any JS code so far, the only advice I can give is to use a class as the identifier for the action link.
From the look of your markup you could also use something along
$('span.lunch').on('click', 'a', function(e) { //do stuff } );