phpabcd
-
Posts
12 -
Joined
-
Last visited
Never
Posts posted by phpabcd
-
-
I would like to ask after i click ok in a popup window, it will be directed into another page. How to make the pop-up window expand?
-
how can i filter out based on the search terms? Now, it can work with no errors. In the form page, there's only one field to search the variable is search_words.
<?php
include '../script/database.php';//locate the database
$conn = dbConnect();
if (!$conn)
die("Could not connect to the database.");
$search_words = mysql_real_escape_string($_GET['search_words']);
$query =
"SELECT name,login_id,password,email FROM User WHERE name LIKE '".$search_words."%' ORDER BY name ASC
";// my query to display the necessary fields
$result = mysql_query ($query, $conn); // get results by running the query
$i = 1;
while ($row = mysql_fetch_assoc($result)) //use loop to get the results
{
$name = $row['name'];
$login_id = $row['login_id'];
$password = $row['password'];
$email = $row['email'];
?>
<td><?php echo $i;?></td>
<td><?php echo $name;?></td>
<td><?php echo $login_id;?></td>
<td><?php echo $password;?></td>
<td><?php echo $email;?></td>
</tr>
<? $i++; ?>
<?php
}
dbDisconnect($conn); // to disconnect database
?>
-
after the form is submitted, the information will send to the person's junk mail. How do we make it for the mail to be sent to the inbox instead?
-
I tried this, but they keep showing error and i can't resolve it.
<?
include '../script/database.php';//locate the database
$conn = dbConnect();
if (!$conn)
die("Could not connect to the database.");
$search_words = mysql_real_escape_string($_GET['search_words']);
$query =
"SELECT * FROM User WHERE name LIKE '".$search_words."%'
UNION
SELECT name,login_id,password, email FROM User ORDER BY name ASC "; // my query to display the necessary fields
$result = mysql_query ($query, $conn); // get results by running the query
$i = 1;
while ($row = mysql_fetch_row($result)) //use loop to get the results
{
?>
<td><?= $i?></td>
<td><?= $row['name']?></td>
<td><?= $row['login_id']?></td>
<td><?= $row['password']?></td>
<td><?= $row['email']?></td>
</tr>
<? $i++; ?>
<?
}
dbDisconnect($conn); // to disconnect database
?>
</table>
-
yup.
-
I would like to know how to do search terms. For example, someone key in the terms in the text field, and click search, thn it will show the data.
-
I have changed the array and the events variables. However, the same problem still occurs and i can't resolve it.
-
it doesnt work. it comes out error showing one whole list of [function.in-array] outside the calendar
-
IF(!isset($_GET['year'])){
$_GET['year'] = date("Y");
}
IF(!isset($_GET['month'])){
$_GET['month'] = date("n")+1;
}
$month = addslashes($_GET['month'] - 1);
$year = addslashes($_GET['year']);
$query = "SELECT ph_date, ph_id, ph_type
FROM Public_Holiday
WHERE ph_month ='$month'
AND ph_year = '$year'";
//this is the query for publicholiday
$query_result = mysql_query($query, $conn);
while ($info = mysql_fetch_row($query_result))
{
$day = $info['0'];
$event_id = $info['1'];
$events[$day][] = $info['1'];
$event_info[$event_id]['0'] = substr($info['2'], 0, 20);
}
//this is to insert the value into the calendar by running the query
$todays_date = date("j");
$todays_month = date("n");
$days_in_month = date ("t", mktime(0,0,0,$_GET['month'],0,$_GET['year']));
$first_day_of_month = date ("w", mktime(0,0,0,$_GET['month']-1,1,$_GET['year']));
$first_day_of_month = $first_day_of_month + 1;
$count_boxes = 0;
$days_so_far = 0;
IF($_GET['month'] == 13){
$next_month = 2;
$next_year = $_GET['year'] + 1;
} ELSE {
$next_month = $_GET['month'] + 1;
$next_year = $_GET['year'];
}
IF($_GET['month'] == 2){
$prev_month = 13;
$prev_year = $_GET['year'] - 1;
} ELSE {
$prev_month = $_GET['month'] - 1;
$prev_year = $_GET['year'];
}
?>
<br />
<!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>Welcome to Department of Anaesthesiology</title>
<link href="calendarstyle.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<link href="calendarstyle.css" rel="stylesheet" type="text/css">
</head>
<br />
<body>
<div align="center"><font color="#00CC99" size="+2" face="Verdana, Arial, Helvetica, sans-serif">Overall Day-Duty Roster</font></div>
<br />
<div align="center"><font size="4">Departmental duties for the month:</font></div>
<div align="center">
<div align="center"><span class="currentdate"><? echo date ("F Y", mktime(0,0,0,$_GET['month']-1,1,$_GET['year'])); ?></span><br>
<br>
</div>
<div align="center"><br>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="right"><a href="<? echo "monthlyoverallroster2.php?month=$prev_month&year=$prev_year"; ?>"><<</a></div></td>
<td width="300"><div align="center">
<select name="month" id="month" onChange="MM_jumpMenu('parent',this,0)">
<?
for ($i = 1; $i <= 12; $i++) {
$link = $i+1;
IF($_GET['month'] == $link){
$selected = "selected";
} ELSE {
$selected = "";
}
echo "<option value=\"monthlyoverallroster2.php?month=$link&year=$_GET[year]\" $selected>" . date ("F", mktime(0,0,0,$i,1,$_GET['year'])) . "</option>\n";
}
?>
</select>
<select name="year" id="year" onChange="MM_jumpMenu('parent',this,0)">
<?
//Define parameters
$startdate= 2000;
$enddate= date("Y");
$dated = getdate();
$year = $dated['year'];
//for loop for the dropdown list(year)
for ($year = $startdate; $year<=$enddate; $year++) {
IF($year == $_GET['year']){
$selected = "selected";
} ELSE {
$selected = "";
}
echo "<option value=\"monthlyoverallroster2.php?month=$_GET[month]&year=$year\" $selected>$year</option>\n";
}
?>
</select>
</div></td>
<td><div align="left"><a href="<? echo "monthlyoverallroster2.php?month=$next_month&year=$next_year"; ?>">>></a></div></td>
</tr>
</table>
<br>
</div>
<table width="875" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="1">
<tr class="topdays">
<td><div align="center">Sunday</div></td>
<td><div align="center">Monday</div></td>
<td><div align="center">Tuesday</div></td>
<td><div align="center">Wednesday</div></td>
<td><div align="center">Thursday</div></td>
<td><div align="center">Friday</div></td>
<td><div align="center">Saturday</div></td>
</tr>
<tr valign="top" bgcolor="FFFFFF">
<?
for ($i = 1; $i <= $first_day_of_month-1; $i++) {
$days_so_far = $days_so_far + 1;
$count_boxes = $count_boxes + 1;
echo "<td width=\"125\" height=\"100\" class=\"beforedayboxes\"></td>\n";
}
for ($i = 1; $i <= $days_in_month; $i++) {
$days_so_far = $days_so_far + 1;
$count_boxes = $count_boxes + 1;
IF($_GET['month'] == $todays_month+1){
IF($todays_date == $day){
$class = "publicholidayhighlightedboxes";
} ELSE {
$class = "dayboxes";
}
}
ELSE {
IF($i == $todays_date){
$class = "highlighteddayboxes";
} ELSE {
$class = "dayboxes";
}
}
echo "<td width=\"125\" height=\"100\" class=\"$class\">\n";
$link_month = $_GET['month'] - 1;
echo "<div align=\"right\"><span class=\"toprightnumber\">\n<a href=\"javascript:MM_openBrWindow('event_add.php?day=$i&month=$link_month&year=$_GET[year]','','width=500,height=300');\">$i</a> </span></div>\n";
IF(isset($events[$i])){
echo "<div align=\"left\"><span class=\"eventinbox\">\n";
while (list($key, $value) = each ($events[$i])) {
echo " <a href=\"javascript:MM_openBrWindow('event.php?id=$value','','width=500,height=200');\">" . $event_info[$value]['1'] . " " . $event_info[$value]['0'] . "</a>\n<br>\n";
}
echo "</span></div>\n";
}
echo "</td>\n";
IF(($count_boxes == 7) AND ($days_so_far != (($first_day_of_month-1) + $days_in_month))){
$count_boxes = 0;
echo "</TR><TR valign=\"top\">\n";
}
}
$extra_boxes = 7 - $count_boxes;
for ($i = 1; $i <= $extra_boxes; $i++) {
echo "<td width=\"125\" height=\"100\" class=\"afterdayboxes\"></td>\n";
}
$time_end = getmicrotime();
$time = round($time_end - $time_start, 3);
?>
-
$day= info['0']
do i need to insert the day in my array?
-
<?
for ($i = 1; $i <= $first_day_of_month-1; $i++) {
$days_so_far = $days_so_far + 1;
$count_boxes = $count_boxes + 1;
echo "<td width=\"125\" height=\"100\" class=\"beforedayboxes\"></td>\n";
}
for ($i = 1; $i <= $days_in_month; $i++) {
$days_so_far = $days_so_far + 1;
$count_boxes = $count_boxes + 1;
IF($_GET['month'] == $todays_month+1){
IF($todays_date == $day){
$class = "publicholidayhighlightedboxes";
} ELSE {
$class = "dayboxes";
}
}
ELSE {
IF($i == $todays_date){
$class = "highlighteddayboxes";
} ELSE {
$class = "dayboxes";
}
}
The problem is I can only display one highlighted box in one month. For example, in November, there are two public holidays, but only 1 public holiday box is highlighted. Would appreciate if someone can help me out asap. Thank you
search term corresponds with radio button selected
in PHP Coding Help
Posted
I want to let user to choose the checked box, so they will type in the words in the box, and select the radio button to limit their search. How should I approach it?
$search_words = mysql_real_escape_string($_POST['search_words']);
$query =
"SELECT name,login_id,password,email
FROM User
WHERE name LIKE '".$search_words."%'
ORDER BY name ASC";
// my query to display the necessary fields
$result = mysql_query($query, $conn);//get results
$result2 = mysql_query($query, $conn);//get results
$resultCheck = mysql_result($result2,0,0);
?>
<p align="center" class="passwordsummary_header"> User's Password Summary
<table width="302" border="1" align="center">
<tr>
<td width="229">
<form method="post" action="search.php" id="searchform">
<div align="center" class="label">
<p>Search:
<input name="search_words" type="text" id="search_words" size="30" maxlength="20" />
<input type="submit" name="GO" id="GO" value="Go" />
</p>
<p>
<input type = "radio" name = "namesearch" id = "namesearch"
value = "AM" <?php if($name == 'namesearch') {echo "checked";}?> >
name search</input>
<input name = "loginidsearch" type = "radio" id = "loginidsearch" value = "loginidsearch" <?php if($login_id == 'loginidsearch') {echo 'checked';}?>>loginid search<br />
<input type = "radio" id = "emailsearch" name = "emailsearch" value = "emailsearch" <?php if($email == 'emailsearch') {echo 'checked';}?>>
email search </input>
</div>
</form>
</td>
</tr>
</table>
</p>
<?php
if ($search_words != "" && $resultCheck != "")
{
echo "<table width='650' border='1' align='center' cellspacing='1'>
<tr><tr>
<td class='passwordsummary_label'>No</td>
<td class='passwordsummary_label'>Name</td>
<td class='passwordsummary_label'>Login ID</td>
<td class='passwordsummary_label'>Password</td>
<td class='passwordsummary_label'>Email</td>
</tr>";
$i = 1;
while ($row = mysql_fetch_row($result)) //use loop to get the results
{
$name = $row['0'];
$login_id = $row['1'];
$password = $row['2'];
$email = $row['3'];
?>
<td class="passwordsummary_info"><?php echo $i;?></td>
<td class="passwordsummary_info"><?php echo $name;?></td>
<td class="passwordsummary_info"><?php echo $login_id;?></td>
<td class="passwordsummary_info"><?php echo $password;?></td>
<td class="passwordsummary_info"><?php echo $email;?></td>
</tr>
<?php $i++;
}
echo "</table>";
}
else
{
echo '<p class="results">No search results</p>';
}