how to create a html body basing on a php if condition - php

I want to display the body of my html page with respect to a condition being true or false in php [i.e. i use a if, else condition]...
<?php
session_start();
if(isset($_SESSION['user']))
{
echo ". Hello ".$_SESSION['user']." !";
}
else
{
header("Location: login.php");
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<link href="slims.css" rel="stylesheet" type="text/css">
<title>Enter Attendance</title>
</head>
<body >
<a id="logout" href="logout.php">Logout </a>
<div id="wrapper">
<header>
<h1>Welcome to SLIMS</h1>
<nav id="mainnav">
<ul>
<li>Home</li>
<li><a href="secselect.php" class="thispage">
attendance</a></li>
<li>marks</li>
<li>results</li>
<li>others</li>
</ul>
</nav></header>
<div id=body>
<br/>
<?php
$num=1;
mysql_connect("localhost","root","");
mysql_select_db("attendance");
$_SESSION['tablename']=$_GET['dept']."-".$_GET['year']."-".$_GET['sec']."-".$_GET['sem'];
//echo $_SESSION['tablename'];
$_SESSION['subject']=$_GET['subject'];
$_SESSION['datepicker']=$_GET['datepicker'];
$qstr2="select * from `".$_SESSION['tablename']."-total` where date='".$_GET['datepicker']."' and subject='".$_GET['subject']."';";
//echo $qstr2;
$check=mysql_query($qstr2);
if($check)
{ echo "<font color='white' align=center face='Lucida Sans Unicode'><h2 class='centered'>Attendence for the selected date was already entered</h2></font><br><br><br><br>";
}
else
{
$qstr="select * from `".$_SESSION['tablename']."`;";
$result=mysql_query($qstr);
if(!$result)
{
echo "Invalid details selected";
}
else
{
echo '<font color="white" align=center face="Lucida Sans Unicode"><h2>Enter Attendance</h2></font>
<form method="post" action="insertatt.php" ><p align="center">
<table id="box-table-a"; >
<thead>
<tr>
<th scope="col"> Sl.No </th>
<th scope="col"> JNTU No. </th>
<th scope="col"> Name </th>
<th scope="col"> Classes </th>
</tr>
</thead>
<tbody>';
$num=1;
while($row=mysql_fetch_array($result))
{
echo "<tr><td>".$row['Sl.No']."</td>
<td>".$row["JNTU No"]."</td>
<td>".$row["Name"]."</td>
<td> <input type='radio' name='rbtn".$num."' value=1 /> 1
<input type='radio' name='rbtn".$num."' value=2 /> 2</td>
</tr>";
$num=$num+1;
}
echo "
</tbody>
</table>
<input type='submit' name='submit' value='Post Attendance' />
<input type='reset' name='reset' value='Clear Form' /></p><br><br>
</form>";
}
}?>
</div>
<footer><div id="footer">© 2013 Team 17</div>
</footer>
</div>
</body>
</html>
I need to do a lot of modifications by converting " to ' and ' to " at many places inside the html tags to get the syntax correct for the echo statement... Is there any better way for doing this ??

You should close the PHP tag once a condition is written. First separate the DB logic and other stuff in another file, or at the top of the document:
<?php
$num=1;
mysql_connect("localhost","root","");
mysql_select_db("attendance");
$_SESSION['tablename']=$_GET['dept']."-".$_GET['year']."-".$_GET['sec']."-".$_GET['sem'];
//echo $_SESSION['tablename'];
$_SESSION['subject']=$_GET['subject'];
$_SESSION['datepicker']=$_GET['datepicker'];
$qstr2="select * from `".$_SESSION['tablename']."-total` where date='".$_GET['datepicker']."' and subject='".$_GET['subject']."';";
//echo $qstr2;
$check=mysql_query($qstr2);
$qstr="select * from `".$_SESSION['tablename']."`;";
$result=mysql_query($qstr);
?>
Then start with conditions:
<?php if($check): ?>
<font color='white' align=center face='Lucida Sans Unicode'><h2 class='centered'>Attendence for the selected date was already entered</h2></font><br><br><br><br>
<?php else: ?>
<?php if(!$result): ?>
<p>Invalid details selected</p>
<?php else: ?>
<font color="white" align=center face="Lucida Sans Unicode"><h2>Enter Attendance</h2></font>
<form method="post" action="insertatt.php" ><p align="center">
<table id="box-table-a"; >
<thead>
<tr>
<th scope="col"> Sl.No </th>
<th scope="col"> JNTU No. </th>
<th scope="col"> Name </th>
<th scope="col"> Classes </th>
</tr>
</thead>
<tbody>
<?php $num=1;while($row=mysql_fetch_array($result)): ?>
<tr><td><?= $row['Sl.No']; ?></td>
<td><?= $row['Name']; ?></td>
<td><input type='radio' name='rbtn<?=$num;?>' value=1 /> 1
<input type='radio' name='rbtn<?=$num;?>' value=2 /> 2</td>
</tr>
<?php $num=$num+1; ?>
<?php endwhile: ?>
</tbody>
</table>
<input type='submit' name='submit' value='Post Attendance' />
<input type='reset' name='reset' value='Clear Form' /></p><br><br>
</form>
<?php endif; ?>
<?php endif; ?>
</div>
<footer><div id="footer">© 2013 Team 17</div>
</footer>
This way the php's echo won't disturb your quotation, so you can standartize the quotes to be only double or only single (I didn't change yours)

Related

Show only relevant search results

I have created a page for search, and I'm having some problems.
The data is displayed on the page but I also use some fields on the form for a specific field, so when I enter the data in those fields and hit search, it shows the search field on the top of the display page with the rest of the data, but I want only the data which belongs to my search.
CODE:
<?php
include('connect.php');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include('include/head.php')?>
</head>
<body>
<div id="header-wrapper">
<div id="header">
<div id="menu">
<ul>
<?php include('include/menu.php') ?>
Logout
</ul>
</div>
</div>
</div>
<div id="logo">
<?php include('include/logo.php'); ?>
</div>
<div id="wrapper">
<div id="page">
<div id="page-bgtop">
<div id="content">
<div class="post">
<div class="entry-image">
<?php
$q=mysql_query("SELECT count( php ) AS ph, count( dotnet ) AS dot, count( design ) AS des FROM candidate");
while($row=mysql_fetch_array($q))
{
?>
<form name="" method="post">
<table border="1" cellpadding="10" cellspacing="1" width="280" height="200">
<th colspan="5" bgcolor="orange" >Total Number of Resume by skills</th>
<tr>
<th><B>PHP</B></th>
<th><B>DOTNET</B></th>
<th><B>DESIGN</B></th>
</tr>
<td><?php echo "$row[ph]"; ?></td>
<td><?php echo "$row[dot]"; ?></td>
<td><?php echo "$row[des]"; ?></td>
</table>
</form>
<?php
}
?>
</div>
<h2 class="title">Welcome to Resume </h2>
<div class="entry">
<p>
<form name="search" method="post" action="searchview.php">
<table>
<tr>
Id: <input type="text" name="id" /></br></br>
Name:<input type="text" name="name" /><br/></br>
Expected Salary:<input type="text" name="es" /><br/></br>
Skill Rate: <input type="text" name="sr" /><br/> </br>
Salary:<input type="text" name="cs" /></br></br>
<input type="submit" name="submit" value="seach" /><input type="reset" name="reset" value="reset" />
</tr>
</table>
</form>
</p>
</div>
</div>
<div class="post" >
<?php
$query=mysql_query("select * from candidate");
while($row=mysql_fetch_array($query))
{
$sno=$row['id'];
$image=$row['image'];
$name=$row['fname'];
$es=$row['es'];
$sr=$row['sr'];
$cs=$row['cs'];
?>
<form name="view" method="post" action="searchview.php" >
<table border="1" cellpadding="30" class="centered" width="20" >
<tr>
<th width="150">S.NO</th>
<th width="150">IMAGE</th>
<th width="150">NAME</th>
<th width="150">EXPECTED SALARY</th>
<th width="150">SKILL RATE</th>
<th width="150">SALARY</th>
<th width="150">ACTION</th>
</tr>
<td><?php echo "$row[id]"; ?></td>
<td><div class="rightdiv1a"><img src="<?php echo 'img/'.$row['image']; ?>" style="height:120px; width:145px; "></div></td>
<td><?php echo "$row[fname]"; ?></td>
<td><?php echo "$row[es]"; ?></td>
<td><?php echo "$row[sr]"; ?></td>
<td><?php echo "$row[cs]"; ?></td>
<td><img alt='view' title='view' src='images/view.png' width='15px' height='15px' hspace='20' /></td>
<td><img alt='Edit' title='Edit' src='images/edit.png' width='15px' height='15px' hspace='20' /></td>
<td><a onclick="return confirm('Would you like to delete?');" href="delete.php?id=<?php echo "$row[id]"; ?>"><img alt='delete' title='delete' src='images/delete.png' width='15px' height='15px' hspace='20' /></a></td>
</table>
</form>
<?php
}?>
</div>
</div>
</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<?php// include('include/footer.php');?>
</div>
</div>
</body>
</html>
<?php// } ?>
This code displays the data now but I want to filter the data and only show the results which belongs to my search, and have the rest disappear.
Here are some screenshots of my form:
pls help,
thanks in advance..
If I understand the question correctly, you want to display the search results, but no longer show the search form. If this is the case, then move your second "post" div to the top and wrap it in an if:
if (!empty($_POST)) {
// Process POST results here:
...
die(); // end processing so the form doesn't display again
}

Errors appear in searching if a record not found using searchtext

SearchText works if record is found but errors appear when record not found.
Here are the errors. Notice: Undefined variable: sample_list in C:\xampp\htdocs\viewsample\samplelist.php on line 166
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\ viewsample\samplelist.php on line 166
If I click the search button again, errors disappear.
Is it possible to return to home page if record not found?
I searched here a possible solution to my problem but I found none.
Please help.
Thank you and more power.
Here's the code.
Index.php
//Perform Search from our database
if(isset($_POST['action_type']))
{
echo 'Welcome';
if ($_POST['action_type'] == 'search')
{
$search = mysqli_real_escape_string($link, strip_tags($_POST['searchText']));
$sql = "select samp_id, daterecv, datecoll, modcoll, aperson, estabname, estabadd, gname, bname, prodcat, dform, dstrength, from sample
where gname like '%$search%' or bname like '%$search%' or estabname like '%$search%'";
$result = mysqli_query($link, $sql);
if(!$result)
{
echo mysqli_error($link);
exit();
}
//Loop through each row on array and store the data to $sample_list[]
while($rows = mysqli_fetch_array($result))
{
$sample_list[] = array('samp_id' => $rows['samp_id'],
'daterecv' => $rows['daterecv'],
'datecoll' => $rows['datecoll'],
'modcoll' => $rows['modcoll'],
'apers' => $rows['apers'],
'estabname' => $rows['estabname'],
'estabadd' => $rows['estabadd'],
'gname' => $rows['gname'],
'bname' => $rows['bname'],
'prodcat' => $rows['prodcat'],
'dform' => $rows['dform'],
'dstrength' => $rows['dstrength']);
}
include 'samplelist.php';
exit();
}
}
samplelist.php
<?php
session_start();
$role = $_SESSION['sess_userrole'];
if(!isset($_SESSION['sess_username']) && $role!="sampler"){
header('Location: index.php?err=2');
}
?>
<?php
include_once 'index.php';
?>
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function GotoHome(){
window.location = 'index.php';
}
{
function preventBack(){window.history.forward();}
setTimeout("preventBack()", 0);
window.onunload=function(){null};
}
</script>
</head>
<body>
<div class="wrapper">
<div class="content">
<p>Logout</p>
<p><center><b><font style="arial" color="black">SAMPLE COLLECTION</font></b></center></p>
<div style="margin-bottom: 10px;">
<form method="POST" action="index.php">
<input type="text" id="searchText" name="searchText" style="width:300px"/>
<input type="hidden" name="action_type" value="search" onfocus="Clear (this);"/>
<input type="submit" value="search"/>
</form>
</div>
<div style="max-height: 740px; overflow:auto; max-width: 1600; overflow:auto;">
<table class="pbtable">
<thead>
<tr>
<th>
Date Received
</th>
<th>
Date Collected
</th>
<th style = "display:none">
Mode of Collection
</th>
<th style = "display:none">
Assigned Personnel
</th>
<th>
Establishment Name
</th>
<th style = "display:none">
Establishment Address
</th>
<th>
Generic Name
</th>
<th>
Brand Name
</th>
<th>
Product Category
</th>
<th style = "display:none">
Dosage Form
</th>
<th style = "display:none">
Dosage Strength
</th>
</thead>
<tbody>
<?php foreach($sample_list as $collection) : ?>
<tr>
<td>
<?php echo $collection["daterecv"]; ?>
</td>
<td>
<?php echo $collection["datecoll"]; ?>
</td>
<td style = "display:none">
<?php echo $collection["modcoll"]; ?>
</td>
<td style = "display:none">
<?php echo $collection["aperson"]; ?>
</td>
<td>
<?php echo $collection["estabname"]; ?>
</td>
<td style = "display:none">
<?php echo $collection["estabadd"]; ?>
</td>
<td>
<?php echo $collection["gname"]; ?>
</td>
<td>
<?php echo $collection["bname"]; ?>
</td>
<td>
<?php echo $collection["prodcat"]; ?>
</td>
<td style = "display:none">
<?php echo $collection["dform"]; ?>
</td>
<td style = "display:none">
<?php echo $collection["dstrength"]; ?>
</td>
<form method="post" action="index.php">
<input type="hidden" name="ci"
value="<?php echo $collection["samp_id"]; ?>" />
<input type="hidden" name="action" value="edit" />
<input type="submit" value="Edit" />
</form>
<tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
If no records are found in DB the $sample_list array is empty.
So samplelist.php needs this check before foreach loop,
if (empty($sample_list))
{
header('Location: http://www.homesweet.home/');
exit;
}
foreach($sample_list as $collection) :
...
endforeach;

mysql_fetch_array(), is not work in my program

i need to fetch multiple row or single row from mysql table, but my code retrieve data from table only multiple rows as given in my where clause condition is true, not fetch single row even my condition is true. plz suggest me anyone. (i know only little bit english)
<?php
include 'connection/db_connection.php';
$sqlquery=mysql_query("select * from sadmin_invoiceno order by sno desc");
$row1=mysql_fetch_assoc($sqlquery);
$invoice=$row1['invoice_no'];
/* if($row1['invoice_no']<=9)
{
$myvalue=$row1['invoice_no'];
$idvalue="".$myvalue;
}
if($row1['invoice_no']>9 && $row1['sno']<100)
{
$myvalue=$row1['invoice_no'];
$idvalue="".$myvalue;
} */
$sql="SELECT * FROM sadmin_sales where invoice_no='".$invoice."'";
$result = mysql_query($sql);
$count=mysql_num_rows($result);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>IT Flower invoice</title>
<link rel="stylesheet" href="assets/css/style_popup.css" media="all" />
<link href="assets/css/utopia-white.css" rel="stylesheet">
</head>
<body>
<div class="invoice">
<header class="clearfix">
<div id="logo">
<img src="assets/img/utopia-logo1.png">
</div>
<div id="company">
<h2 class="name">Indian Traditional Flowers</h2>
<div>10 - 3500 McNicoll Ave., <br>Toronto, Ontario ON M1V 4c7</div>
<div>+1.647.836.9999</div>
<div>info#itflowers.com</div>
</div>
</header>
<main>
<div id="details" class="clearfix">
<div id="client">
<div class="to">INVOICE TO:</div>
<h2 class="name"><?php
$sql2=mysql_query("SELECT franchies, customer FROM sadmin_sales where invoice_no='".$invoice."'");
$res1=mysql_fetch_array($sql2);echo $res1['customer'];
$franchies= $res1['franchies'];
$sql3=mysql_query("SELECT * FROM sadmin_customer where email='".$franchies."'");
$res2=mysql_fetch_array($sql3);
echo $res2['shop_name'];
?></h2>
<div class="address"> <?php echo $res2['owner_name']; ?> </div>
<div class="address"><?php echo $res2['address']; ?></div>
<div class="email"><?php echo $res2['email']; ?></div>
<div class="email"><?php echo $res2['phone']; ?></div>
</div>
<div id="invoice">
<h1>INVOICE NO: <?php echo $invoice; ?></h1>
<div class="date">Date of Invoice: <?php echo $date = date('d/m/Y h:i:s a'); ; ?></div>
</div>
</div>
<table class="inventory" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr style="text-align: center;">
<th class="no">#</th>
<th class="desc">DESCRIPTION</th>
<th class="unit">UNIT PRICE</th>
<th class="qty">QUANTITY</th>
<th class="total">TOTAL</th>
</tr>
</thead>
<tbody>
<tr>
<?php
$tax=0;
$ship=0;
$paid=0;
$bal=0;
$grand=0;
$sum=0;
for($i=1; $i<$count;)
{
while($row = mysql_fetch_array($result))
{
$franchies = $row['franchies'];
echo "<td class='no'>".$i."</td> ";
echo "<td class='desc'>" . $row['product_name'] . "</td>";
echo "<td class='unit'>" . $row['unit_price'] . "</td>";
echo "<td class='qty'>" . $row['quantity'] . "</td>";
echo "<td class='total' >".$row['total']."</td>";
echo "</tr>";
$sum=$sum + $row['total'];
$i++;
//$tax=$sum *.13;
$include=$row['tax_type'];
if ($include =='includetax')
{
$tax1=mysql_query("select * from sadmin_tax where tax_type like 'include%'");
$res1=mysql_fetch_array($tax1);
$tax2=$res1['percentage'];
$tax=$sum * $tax2/100;
$sum1=$sum - $tax;
}
else
{
$tax3=mysql_query("select * from sadmin_tax where tax_type like 'exclude%'");
$res3=mysql_fetch_array($tax3);
$tax4=$res3['percentage'];
$tax=$sum * $tax4/100;
$sum1=$sum + $tax;
}
$ship=$row['shipping_amt'];
$paid=$row['paid_amt'];
$grand=$sum1 + $ship;
$bal=$grand - $paid;
}
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td colspan="2">SUBTOTAL</td>
<td>$ <?php echo $sum; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">TAX 13%</td>
<td>$ <?php echo $tax; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">SHIP</td>
<td>$<?php echo $ship; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">PAID</td>
<td>$<?php echo $paid; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">BALANCE</td>
<td>$<?php echo $bal; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">GRAND TOTAL</td>
<td>$<?php echo $grand; ?></td>
</tr>
</tfoot>
</table>
<button onclick="myFunction()" class="btn btn-primary" style="width: 106px;float: right;">Print this page</button>
<!-- <div id="thanks">Thank you!</div>
<div id="notices">
<div>NOTICE:</div>
<div class="notice">A finance charge of 1.5% will be made on unpaid balances after 30 days.</div>
</div>
</main>
<footer>
Invoice was created on a computer and is valid without the signature and seal.
</footer> -->
</div>
<script>
function myFunction() {
window.print();
}
</script>
</body>
</html>
I'm not certain I understand your question fully, are you saying you have multitple rows but only want one?
If so , check out MySQL "LIMIT " which will limit your SQL query to X number of rows, such as SELECT * FROM sadmin_customer where email='".$franchies." LIMIT 1
This will return only 1 row, the first row where the conditions are true.

Repeated page design when retrieving entry from MySQL database

I just made a PHP script to retrieve entry from database. When I retrieve entry from a table, the page look like this. The header and form below table is repeated. I need help, thanks.
Here's the whole code I'm using:
<?php
session_start();
include('connection.php');
$username='username';
mysql_query("SELECT * FROM regmember WHERE username='$username'");
$query=("SELECT * FROM product");
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="index.css">
<title>Music Light</title>
<div align="center"><h1>Music Light</h1></div>
<div id="menu">
<ul>
<li><?php echo 'Welcome, '.$_SESSION['username']; ?></li>
<li>Home</li>
<li>Product</li>
<li>Profile</li>
<li>Cart</li>
<li>Testimony</li>
<li>Transaction</li>
<li>Logout</li>
</ul>
</div>
<br>
<br>
<div align="center">
<table border="0">
<tr>
<td>ID</td>
<td></td>
<td><?php echo $row[0];?></td>
</tr>
<tr>
<td>Brand</td>
<td></td>
<td><?php echo $row[1];?></td>
</tr>
<tr>
<td>Instrument Type</td>
<td></td>
<td><?php echo $row[2];?></td>
</tr>
<tr>
<td>Price</td>
<td></td>
<td><?php echo $row[3];?></td>
</tr>
<tr>
<td>Stock</td>
<td></td>
<td><?php echo $row[4];?></td>
</tr>
<tr>
<td>Image</td>
<td></td>
<td><img height="150" width="150" src="productimg/<?php echo $row[6];?>"/></td>
</table>
</div>
<div align="center">
<table>
<form name="deleteentry" action="delete.php" method="get">
<tr>
<td>Delete which entry? (enter product id)</td>
<td><input type="text" name="delete"></td>
<td><input type="button" name="deletebutton" value="Delete"></td>
</tr>
</form>
</table>
</div>
<?php
}
?>
<br>
<br>
<div align="center"><p>Description template</p></div>
<footer>
<p align="center">Copyright © 2013 Music Light</p>
</footer>
missing </head> and <body> and </body>
i would suggest that the <html> <head></head> and <body> to be used outside the loop if u donot actually want to repeat. by loop i mean the while loop
You didn't closed your header with </head>
<head>
<link rel="stylesheet" type="text/css" href="index.css">
<title>Music Light</title>
</head> <= Include this
.
.
.
</html> <= Include this as well at the end

Getting the value of a combo-box using post method

I wanted to use php to get the value of a combo box, and I am using post method...
can anyone tell me how.
<html>
<head>
<title>Virtual Library</title>
<link href="css/login.css" rel="stylesheet"/>
<link href="css/style.css" rel="stylesheet"/>
<script type="text/javascript" src="scripts/ajax_search.js"></script>
</head>
<body>
<div id="wrapper">
<div id="header" align="center">
<ul align="center">
<li><span>Home</span></li>
<li><span>Top 100 Downloads</span></li>
<li><span>Upload</span></li>
<?php if(isset($_SESSION['login_user']))
{
$uname = $_SESSION['login_user'];
echo "<li><a href='profile.php'><span>$uname</span></a></li>";
echo "<li><a href='logout.php'><span>LogOut</span></a></li>";
}
else{
echo "<li><a href='login.php'><span>Member Login</span></a></li>";
echo "<li><a href='register.php'><span>Register</span></a></li>";
}
?>
<li><span>RSS <img src="images/rss.gif" id="rss"></span></li>
</ul>
</div>
<?php if(isset($_SESSION['login_user']))
{
echo "<div class='frmdiv'>
<form action='upload_file.php' method='post' enctype='multipart/form-data'>
<table width='38%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td colspan='2'><div align='center'><font size='2' face='verdana'>Upload File</font></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan='2'><hr></td>
</tr>
<tr>
<td height='26'><font size='2' face='verdana'>FileName</font></td>
<td><font size='2' face='verdana'>
<input type='file' name='file' ></font>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td></td>
<td><select name='media_type' >
<option value='' selected>Select a media type...</option>
<option value='pdf'>PDF</option>
<option value='chm'>CHM</option>
<option value='epub'>EPUB</option>
<option value='html'>HTML</option>
<option value='djvu'>DJVU</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><font size='2' face='verdana'>
<input type='submit' name='Submit' value='Upload'></font>
</td>
</tr>
<tr>
<td colspan='2'><hr></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</form>
<div align='center'>";
}
else{
echo "<script type='text/javascript'>";
echo "alert('You Must Be Logged In To Upload');";
echo "location='login.php'";
echo "</script";
}
?>
</div>
</body>
</html>
this is the combo box.
Try:
if(isset($_POST['media_type']){
$value = $_POST['media_type'];
}
Update: Since that doesn't work for you, check to see if you are getting any post variables:
foreach ($_POST as $var => $value) {
echo "$var = $value<br>n";
}

Categories