Try user.username in where condition.
$result = mysql_query("SELECT user.password, data1.dob FROM user INNER JOIN data1 ON user.username = data1.username WHERE user.username = '" . $_SESSION['username'] . "'");
Try user.username in where condition.
$result = mysql_query("SELECT user.password, data1.dob FROM user INNER JOIN data1 ON user.username = data1.username WHERE user.username = '" . $_SESSION['username'] . "'");
Just looked http://www.3gphone.in/acer/27.
CSS is working right..
Same way you have to give URL for product images.
e.g phonepics/956_1.jpg should be http://www.3gphone.in/phonepics/953_1.jpg
You can define site url in config file and append it in all images and css so if your domain transfer you have only change in config file.
Your email mime type is text, you need HTML type in header.
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
better to use BCC.
It may because of execution time.
Use below function for overcoming time limit.
set_time_limit(0);
Just add one new hidden field with quantity name.
<input type='hidden' name='quantity' value='3'>
Above will show 3 quantity on paypal page.
As a fresher you will be confuse what to read and from where?
As a starter you can learn below points from Google.
- Refer basic functions like echo, print, exit, die, mail, implode, explode, count.
echo and exit will be useful for debug your output.
- How to submit form in php.
After form submission handle different input fields like check box, radio button, file, text box.
Contact us form is best example.
- Basic string and array operation.check php.net you can find example below function description.
During project coding you need repeatedly string and array usage.
- Now take a database like mysql. Starting from mysql_connect take a look for basic mysql function.
Make a demo page for listing data, add new data, edit data and delete data.
After this much basic info you can play with php.
Whenever you stuck anywhere there is always php.net and Google 'How To' available for you.
All the best..
Check this.
<?
echo $strDate = substr('Wed Jun 15 2011 00:00:00 GMT 0530',4,11);
echo '<br />'.date('m/d/Y', strtotime($strDate));
?>
I have changed a bit.
<html>
<head>
<title>Title Here</title>
<link rel="stylesheet" href="/offline/maintenance.css" type="text/css" />
</head>
<body>
<?php
// Make a MySQL Connection
mysql_connect('localhost', 'dbuser', "dbpass") or die(mysql_error());
mysql_select_db('dbname') or die(mysql_error());
// Retrieve all the data from the "example" table
$result = mysql_query('SELECT * FROM sitesettings')
or die(mysql_error());
$row = mysql_fetch_object($result);
if($row->site_on_off=='0') // site is OFFLINE
{
echo '<div id="maintenance">
<img src="offline/logo.png" title="Logo" alt="Logo" />
<br>
<h5>
To bring our clients the best possible service from time to time we will pull our website down for maintenance and upgrades.
Thank you for your patience.
<br><br>
If this is urgent please contact us at ***-***-**** or by email.
</h5>
</div>
';
exit;
}
mysql_free_result($result);
include("subdirectory/index.php");
?>
</body>
</html>
For adding data in mysql:
html_entities(mysql_real_escape_string($variable));
For echoing:
html_entity_decode(stripslashes($variable));
Below is normalization. Field names are self explainable.
Also as urtvi suggested check event uniqueness.
====================
Table Name : event
====================
eventId eventTitle date
1 Seminar
2 Robotics
3 AI
====================
Table Name : user
====================
userId fullName email
1 John user1@test.com
2 Tanya user2@test.com
3 Mathew user3@test.com
===============================
Table Name : event_participant
===============================
participantId eventId userId
1 1 2
2 1 3
3 2 3
4 2 2
5 2 1
This is because it is executing this way,
when first time it try to check pos 1 (from array value) ,increase it and make 2.
Second time it try to check pos 2 (from array value), NOW HERE from above first iteration you have also made pos 2. So here update will affect 2 row.
so on..
Solution is firstly you need to get all unique ID field for which you want to increase pos.
Then in update query use that unique id.
i.e. "UPDATE table1 SET position='$z'+1 Where id='$stored_id' ";
Make sure your field type is INT.
Try this code and see what error you are getting.
<?
echo $query= "SELECT * FROM table WHERE col1 LIKE '%$search_Recordset2%' OR col2 LIKE '%$search_Recordset2%' OR col3 LIKE '%$search_Recordset2%'";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
?>
You need implode function.Which will bing array into string with comma ",".
$qryInsertLeaveApplication = "INSERT INTO global_leave_replacement_application (pic_staffcode)VALUES('".implode(',',$pic_staffcode)."')";
can i set time let say that for 3 second that loading text will visible after 3 second that request has to proceee.
thanx
I would suggest you to not limit it for static 3 sec.
Because sometimes based on server speed it may differs.
I had situation in past where sometimes it takes millisecond or some times if ajax page is taking time then it may take some more seconds.
So better to not take fix 3 SECONDS.
I have modified it.
If you don't have header then each time user press F5 mail will be sent.
Its always good practice to have header after form submission.
<?php
if(isset($_POST["send"]))
{
// php mail sending code
header("location:contactus.php?succ");
exit;
}
?>
<form id="form1" name="form1" method="post" action="">
<table width="362" border="0" align="center" class="tbltxt">
<tr>
<td height="30" colspan="2" style="color:#174AA8; text-decoration:underline;"><b>Send us a message!</b></td>
</tr>
<?php
if(isset($_GET['succ']))
{
?>
<tr>
<td height="30" colspan="2" style="color:#ff0000;">Mail is successfully sent.</td>
</tr>
<?php
}
?>
<tr>
<td width="95" height="30"><label for="Name">Name</label></td>
<td width="257"height="30"><input name="Name" type="text" id="Name" style="width:200px;" /></td>
</tr>
<tr>
<td height="30"><label for="Subject">Subject</label></td>
<td height="30"><select name="Subject" id="Subject" style="width:200px;">
<option value="Technical issue">Technical issue</option>
<option value="Rates">Rates</option>
<option value="Other">Other</option>
</select></td>
</tr>
<tr>
<td height="30">Email address</td>
<td height="30"><input name="Email" type="text" id="Email" style="width:200px;" /></td>
</tr>
<tr>
<td valign="top">Message</td>
<td><label for="Message"></label>
<textarea name="Message" id="Message" rows="5" style="width:200px;"></textarea></td>
</tr>
<tr>
<td height="30"> </td>
<td height="30"><input type="submit" name="send" id="send" value="Send now" />
<input type="reset" name="Reset" id="button" value="Clear form" /></td>
</tr>
</table>
<p> </p>
</form>
Try this.
<?
$replaced_content = " abcs is here {blog:vibhadevit} mnop dsgdh 3535 {blog:computer} after blog content";
preg_match_all('/{blog:[A-Za-z0-9_]+}/', $replaced_content, $matches, PREG_SET_ORDER);
echo '<pre>';
print_r($matches);
?>
Here is a code for exporting table to csv.
<?
mysql_connect('localhost','root','');
mysql_select_db('test');
$sql = "select student_name,student_sirname from student";
// Query Database
$filename = 'file.csv';
$rsSearchResults = mysql_query($sql) or die(mysql_error());
$out = '';
// fiels to export
$out .='Student Name,Sirname';
$out .="\n";
// Add all values in the table
while ($l = mysql_fetch_array($rsSearchResults)) {
for ($i = 0; $i < 2; $i++) {
$out .=''.$l["$i"].',';
}
$out .="\n";
}
// Output to browser with appropriate mime type
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=$filename");
echo $out;
exit;
?>
Are you sure your server supports mode_rewrite?
http://www.webune.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html
Try this.
RewriteEngine On
RewriteRule ^([^/]+)$ /index.php?url=$1 [L]
RewriteRule ^/article/([^/]+)$ /index.php?url=$1&type=news [L]
Can you use your login credentials in below code and post output.
Because i think there is something wrong in credentials only.
<?php
$db_host = "localhost";
$db_user = "root";
$db_password = "";
$db_database = "db_name"
$link = mysql_connect($db_host, $db_user, $db_password);
if (!$link) {
die('Not connected : ' . mysql_error());
}
// make foo the current db
$db_selected = mysql_select_db($db_database, $link);
if (!$db_selected) {
die ('Db selection error : ' . mysql_error());
}
?>
With form ...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?
/* CREATE TABLE `tbl_hindi` (
`data` varchar(1000) character set utf8 collate utf8_bin default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `tbl_hindi` VALUES ('कंप्यूटर'); */
mysql_connect('localhost','root','');
mysql_select_db('test');
mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_results=utf8');
mysql_query('SET collation_connection=utf8_general_ci');
if(isset($_POST['save']))
{
$sql = "insert into tbl_hindi values ('".$_POST['data']."')";
mysql_query($sql);
}
$sql = "select * from tbl_hindi";
$res = mysql_query($sql);
?>
<form method="post">
<table width="900%" border="0">
<tr>
<td>Add New : <input type="text" name="data" size="20" />
<input type="submit" name="save" value="Save" /></td>
</tr>
<tr>
<td>-----------------------------</td>
</tr>
<tr>
<td><strong>Hindi Data</strong></td>
</tr>
<? while($sar = mysql_fetch_assoc($res)) { ?>
<tr>
<td><?=$sar['data'];?></td>
</tr>
<? } ?>
</table>
</form>
</body>
</html>
Okay dude..
This is with form code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?
mysql_connect('localhost','root','');
mysql_select_db('test');
mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_results=utf8');
mysql_query('SET collation_connection=utf8_general_ci');
if(isset($_POST['save']))
{
$sql = "insert into tbl_hindi values ('".$_POST['data']."')";
mysql_query($sql);
}
$sql = "select * from tbl_hindi";
$res = mysql_query($sql);
?>
<form method="post">
<table width="900%" border="0">
<tr>
<td>Add New : <input type="text" name="data" size="20" />
<input type="submit" name="save" value="Save" /></td>
</tr>
<tr>
<td>-----------------------------</td>
</tr>
<tr>
<td><strong>Hindi Data</strong></td>
</tr>
<? while($sar = mysql_fetch_assoc($res)) { ?>
<tr>
<td><?=$sar['data'];?></td>
</tr>
<? } ?>
</table>
</form>
</body>
</html>
Your loop is messy.
This code shows simple looping for showing data in tabular form.
<?php
$username="root";
$password="";
$database="";
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM jokes";
$result=mysql_query($query);
echo '<table width="900%" border="0">';
while($sar = mysql_fetch_assoc($result))
{
echo '<tr>
<td>'.$sar['name'].'</td>
<td>'.$sar['content'].'</td>
</tr>';
}
echo '</table>';
mysql_close();
?>
Try this demo code.
See attached output image.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAwoZubRYDwEsxPfeOl798iRS9zaDN-rzK-R-PNcf5yAaJ9r7Z4BTy9LU9DUBfJ7r-F6C7tX-2AidMHQ&sensor=true"
type="text/javascript"></script>
<script type="text/javascript">
function initialize()
{
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(23.005, 72.5959), 15);
map.setUIToDefault(); // will add top menu,left menu etc
var new_icon = new GIcon();
new_icon.image = "images/car_blue.png" ;
new_icon.size = new GSize(16,16) ;
new_icon.iconAnchor = new GPoint(6, 20);
new_icon.infoWindowAnchor = new GPoint(5,1) ;
var marker = new GMarker(new GLatLng(23.005, 72.5959), new_icon);
map.addOverlay(marker);
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 700px; height: 500px"></div>
</body>
</html>
Replace this much code and check whether all three values are coming correct or not.
If its correct that means code is right and problem is in mysql credentials.
function DBLogin()
{
echo '--host--'.$this->db_host.'--username--'.$this->username.'--pwd--'.$this->pwd;
$this->connection = mysql_connect($this->db_host,$this->username,$this->pwd);
You can use mysql_real_escape_string function for filtration.
Refer this link.http://in2.php.net/manual/en/function.mysql-real-escape-string.php
Yup..
Your logic is absolutely right. :)
Try this code.
It will print all php configuration.
So that you can check existing dlls.
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>
Try 'U' in small case.
echo $sql = "SELECT [B]u[/B]sername FROM login_tbl WHERE username='".$username."' and password='".$password."'";
$result = mysql_query($sql, $connectID);
If it still not works then run echoed query in phpmyadmin.
1. count distance between x and y point.
2. check wheather it is less than radious (y is inside)
it is greater than radious (y is outside)
<?php
// the HTML source of a URL.
$lines = file('http://www.google.com/');
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
?>
Check this code.
And implement as per your need.
<script language="javascript">
function valid(form)
{
if(form.name.value=="")
{
alert('Please enter name');
return false;
}
else if(form.subject.value=="")
{
alert('Please enter subject');
return false;
}
else
{
return true;
}
}
</script>
<form name="frm" id="frm" method="post" onsubmit="return valid(this);">
<br />Name : <input name="name" type="text" />
<br />Subject : <input name="subject" type="text" />
<br /><input name="send" value="Send" type="submit" />
Okay...
$_SERVER was not working on live server in some of my past projects.
So i used below function.
Just sharing...
function getCurrPageUrl($unset=array())
{
$currPageName = basename($_SERVER['PHP_SELF']);
$arr = $_GET;
foreach($unset as $one)
{
unset($arr[$one]);
}
return $url = $currPageName.'?'.http_build_query($arr);
}
This code return array of emails.
<?
$str = '"ceo@facekut.com" <ceo@facekut.com>,"Rahul Mahajan" <creative.rahul007@gmail.com>';
$pattern = '/<([^"]*)>/';
preg_match_all($pattern, $str, $matches, PREG_OFFSET_CAPTURE, 3);
foreach($matches[1] as $val)
{
foreach($val as $key=>$each)
{
if($key==0)
$email[]=$each;
}
}
print_r($email);
?>
$("#idtext").change(function(){
$('.alltr').hide();
$('div[id*="'+$("#idtext").val()+'"]').show();
});
I think this should work.
Here is your query.
SELECT name,SUBSTRING(name,1,LOCATE('_',name)-1) FROM `student`
Why don't you try php code.
<?
$temp = explode('_', $option);
unset($temp[count($temp)]);
$option = implode('_', $temp);
?>
Hi,
First of all you need email access information of accounts you want to grab.
It can be done using PHP IMAP.
Check this link
Once you have emails in php variables insert into your mysql database.
Hope this helps.
Debug code using:
echo $mail_body = $htmlContent; exit;
See what you have in browser.
Firstly there should be relation between these three table recipe, instructions and ingredients.
Here you have selected all records in select query rather you should have select query in ingredients for perticular recipe(e.g. 'where' keyword must be there).
post your table structure to make select queries and new code.
Try below code.
Here i have used session to remember previous items.
<? session_start();?>
<title> SALES </title>
<body>
<form action="index.php" method="post">
ENTER ID: <input type="text" name="item" />
<input type="submit" name="submit" value="submit"/>
<input type="submit" name="refresh" value="refresh" meta http-equiv="refresh" />
</form>
<?php
include("connection.php");
if(isset($_POST['submit'])){
$sel_item = $_POST['item'];
$query = "SELECT * FROM items where {$sel_item} = id";
$result = mysql_query($query) or die();
echo "<table>";
echo "<tr><th>ID</th> <th>ITEM NAME</th> <th>DESCRIPTION</th> <th>SIZE</th> <th>COLOR</th> <th style='text-align:right'>PRICE</th> <th style='text-align:right'>QUANTITY</th></tr>";
while($row = mysql_fetch_array($result)) {
echo"<tr><td>";
echo $row['id'];
echo"</td><td>";
echo $row['item_name'];
echo"</td><td>";
echo $row['description'];
echo"</td><td>";
echo $row['size'];
echo"</td><td>";
echo $row['color'];
echo"</td><td style='text-align:right'>";
echo "P".$row['price'];
echo"</td><td style='text-align:right'>";
echo $row['quantity'];
echo "</td><td>";
}
echo "</table>";
}
?>
<br/><br/>
<h1>SALES</h1>
<form action="index.php" method="post">
<table width="400">
<tr>
<td> ID: <strong><?php echo $sel_item ?></td>
</tr>
<tr>
<td> QUANTITY: </td><td><input type="text" name="quantity"/></td>
<td> <input type="submit" name="add" value="add" ></td>
</tr>
<?php
//include("connection.php");
$total=0;
if(isset($_POST['add'])){
$selc_item = $_POST['selc_item'];
$item_quantity = $_POST['quantity'];
$query = "SELECT * FROM items where {$item_quantity} <= quantity ";
$result = mysql_query($query) or die();
$row = mysql_fetch_array($result);
$item_name = $row[1];
$item_price = $row[5];
$t_item_price = $row[5] * $item_quantity;
$cnt = count($_SESSION['master']);
$cnt++;
$_SESSION['master'][$cnt]['selc_item'] = $selc_item;
$_SESSION['master'][$cnt]['item_name'] = $item_name;
$_SESSION['master'][$cnt]['item_quantity'] = $item_quantity;
$_SESSION['master'][$cnt]['item_price'] = $item_price;
$_SESSION['master'][$cnt]['t_item_price'] = $t_item_price;
}
if(count($_SESSION['master']) > 0 )
{
echo"<table>";
echo"<tr>";
echo"<th>ID</th><th>ITEM NAME</th><th>QUANTITY</th><th>PRICE</th><th>TOTAL PRICE</th><th></th></tr>";
for($i=0;$i<count($_SESSION['master']);$i++)
{
echo"<tr>";
echo"<td>".$_SESSION['master'][$i]['selc_item']."</td>";
echo"<td>".$_SESSION['master'][$i]['item_name']."</td>";
echo"<td>".$_SESSION['master'][$i]['item_quantity']."</td>";
echo"<td>".$_SESSION['master'][$i]['item_price']."</td>";
echo"<td>".$_SESSION['master'][$i]['t_item_price']."</td>";
echo"</tr><br />";
}
echo"</table>";
}
?>
</form>
</html>
This comment will help u to understand.
<?
function mapString($str,$ch)
{
$string_length = strlen($str); //e.g. length is 162
if(strlen($str) < $ch) // if length is less than 160 return 1
{ return 1; }
$ratio = $string_length/$ch ; // so ratio will be 162/160 => 1.33
return floor($ratio); // round 1.33 to 1
}
$text = "your text goes here.";
echo mapString($text,160);
?>
Try this:
<?php
$a = trim($_REQUEST['a']);
$student = trim($_GET['student']);
if($a == 'edit' and !empty($id))
{
/* zapytanie do tabeli */
$wynik = mysql_query("SELECT * FROM table_name WHERE student='$student'")
or die('Błąd zapytania');
while($r = mysql_fetch_assoc($wynik))
{
echo '<form action="edycja.php" method="post">
<input type="hidden" name="a" value="save" />
<input type="hidden" name="student" value="'.$student.'"/>
test1:<br />
<input type="text" name="test1" value="'.$r['test1'].'"/><br />
test2:<br />
<input type="text" name="test2" value="'.$r['test2'].'" /><br />
<input type="text" name="test3" value="'.$r['test3'].'" /><br />
<input type="submit" value="popraw" />
</form>';
}
}
elseif($a == 'save')
{
/* odbieramy zmienne z formularza */
$student = $_POST['student'];
$test1 = trim($_POST['test1']);
$test2 = trim($_POST['test2']);
$test3 = trim($_POST['test3']);
/* uaktualniamy tabelę test */
mysql_query("UPDATE test SET test1='$test1',
test2='$test2, test3='$test3' WHERE student='$student'")
or die('Błąd zapytania');
echo 'Dane zostały zaktualizowane';
}
?>
Hi All,
I have javaPowUploader for multiple file upload.
I am able to upload file upto 4GB after php setting.
But how can i upload file greater than 4GB?
I am not sir.. i am mam :) I think i should rename my profile name.
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="zh-HK" />
<title>Cantab Education: Timetable</title>
<script type="text/javascript">
function showCourse(string,key)
{
if (string == "") {
document.getElementById("dynamic_display").innerHTML = "";
return;
}
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("dynamic_display").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "search.php?key="+ key +"&search=" + string, true);
xmlhttp.send();
}
</script>
<style type="text/css">
body {
font-size: 0.75em;
margin: 0px;
padding: 0px;
}
table#search {
border-collapse: collapse;
margin: auto;
width: 956px;
}
table#search tr th {
border: solid #000000 1px;
}
table#results {
border-collapse: collapse;
margin: auto;
width: 956px;
}
table#results tr th {
background-color: #00561c;
border: solid #000000 1px;
color: #ffffff;
}
table#results tr td {
border: solid #000000 1px;
text-align: center;
}
</style>
</head>
<body>
<form>
<table id="search">
<tr>
<th>
<select name="subject" onchange="showCourse(this.value,'Subject');">
<option selected="selected" value="">Subject:</option>
<option value="A%20Math">A Math</option>
<option value="BAFS(A)">BAFS(A)</option>
<option value="BAFS(Acc)">BAFS(Acc)</option>
</select>
</th>
<th>
<select name="tutor" onchange="showCourse(this.value,'Tutor');">
<option selected="selected" value="">Tutor:</option>
<option value="A.%20Yiu">A. Yiu</option>
<option value="Alan%20x%20Cars">Alan x Cars</option>
<option value="Ally">Ally</option>
</select>
</th>
<th>
<select name="level" onchange="showCourse(this.value,'Level');">
<option selected="selected" value="">Level:</option>
<option value="Form%201">Form 1</option>
<option value="Form%202">Form 2</option>
<option value="Form%203">Form 3</option>
</select>
</th>
<th>
<select name="center" onchange="showCourse(this.value,'Primary Center');">
<option selected="selected" value="">Center:</option>
<option value="Causeway%20Bay">Causeway Bay</option>
<option value="Fo%20Tan">Fo Tan</option>
<option value="Hung%20Hom">Hung Hom</option>
</select>
</th>
</tr>
</table>
</form>
<div id="dynamic_display"></div>
</body>
</html>
search.php
<?php
require_once('MagicParser.php');
$counter = 0;
$limit_results = 1000;
$key = $_GET['key'];
$search = $_GET['search']; …
Here is complete code what you need.
Hope it will help you.
<?php
if(isset($_REQUEST['calculate']))
{
$temp1 = explode('/',$_REQUEST['date1']);
$date1 = mktime(0,0,0,$temp1[0],$temp1[1],$temp1[2]);
$temp2 = explode('/',$_REQUEST['date2']);
$date2 = mktime(0,0,0,$temp2[0],$temp2[1],$temp2[2]);
$dateDiff = $date2 - $date1;
$fullDays = floor($dateDiff/(60*60*24));
$fullHours = floor(($dateDiff-($fullDays*60*60*24))/(60*60));
$fullMinutes = floor(($dateDiff-($fullDays*60*60*24)-($fullHours*60*60))/60);
$answer = "Differernce between date2 and date1 is : $fullDays days, $fullHours hours and $fullMinutes minutes.";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form method="post">
date1 : <input name="date1" type="text" value="<?=$_REQUEST['date1'];?>">
date2 : <input name="date2" type="text" value="<?=$_REQUEST['date2'];?>">
<input type="submit" name="calculate" value="calculate">
<br />
<br />
<?php echo $answer;?>
</form>
</body>
</html>