urtrivedi 276 Nearly a Posting Virtuoso

This query is assuming that your table will have only one record for each year, that is
for 2001 there is only 1 record in your table and like that for every year.

SELECT a.id, a.date, a.value, SUM( b.value ) prev
FROM  `tablename` a
LEFT OUTER JOIN prevsum b ON a.date > b.date
GROUP BY a.id, a.date, a.value
urtrivedi 276 Nearly a Posting Virtuoso

How you can you verify and charge card without using payment gateway (intermediate service). As far as I know, direct payment is not at all possible.

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

I think you need some jquery code, to do so.
I never did so, but seen somebody posted here such code in jquery.

or
following post may help, he is adding text boxes dynamically using javascript.

http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/364816/1562712#post1562712

urtrivedi 276 Nearly a Posting Virtuoso

document.createElement("div");

DO no create new div, rather use existing

.
.
.
var divTag = document.getElementById("my_div");
//       	divTag.id = "div";// do change id of your div
.
.
.
//keep rest code as it is
.
.
urtrivedi 276 Nearly a Posting Virtuoso

I think there is no row in your database with email id "hehe@live.com.my",
if it is there then change your line number 5 in above code with following line

echo $qryGetName = "SELECT username FROM user_info WHERE trim(email) =  trim('".$get_staffemail[$i]."') ";
urtrivedi 276 Nearly a Posting Virtuoso

first of all, set id for your TR

<tr id=myrow style='display:block'>
.
.
.
</tr>

now add few lines in calculate total function

function calculatetotal()
{
.
.
.
.
.

	if(text1.value==text2.value)//here use proper syntax according to your elements
	{
             ///hide row 
	     document.getElementById("myrow").style.display='none';
	}
	else
	{
             //show row	
	     document.getElementById("myrow").style.display='block';
	}

}
urtrivedi 276 Nearly a Posting Virtuoso

Two separte loops executing one by one will always give you unexpected results, in your case. Thats why follow my steps, given in my previous post above.
You need loop in loop (nested loop).

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso
<html>

<script language="javascript">
var curr=0 ;
function addradio()
{
    document.getElementById("my_div").innerHTML=document.getElementById("my_div").innerHTML+
"<br><input type='radio' id='my"+curr+"'  value='Male' name='my"+curr+"'>Male "+
"<input type='radio' id='my"+curr+"' value='Female' name='my"+curr+"'>Female ";
  curr=curr+1;
}
function changeIt()
{

my_div.innerHTML = my_div.innerHTML +"<br>Skills<input type='text' name='mytext[]' value='mytext'>";
my_div.innerHTML = my_div.innerHTML +"<br><input type='radio' id='my' value='mytext' value='male' name='radio[]'>";
my_div.innerHTML = my_div.innerHTML +"<input type='radio' id='my' value='Female' name='radio[]'>";


//var el = document.getElementById('my');
//el.name = 'level';
}
</script>

<body>
<form name="form" action="homep.php" method="">

<input type="button" value="test" onClick="addradio()">
<div id="my_div"></div>
  <input type="submit" name="Submit" value="Submit">



</form>
</body>
</html>
urtrivedi 276 Nearly a Posting Virtuoso

if you have placed checkbox chk_list[] in the html <form> element, then you can submit the form with action=some.php.

Now in your php file
you will get array of selected values
$_POST[0]
$_POST[1]
$_POST[2]
.
.
.
.
$_POST[n]

Here n is number of selected check boxes,
Here Unselected checkboxes are not available in the array.

urtrivedi 276 Nearly a Posting Virtuoso

why should use MULIPLE SIZE=10..? what is the meaning?

I guess If you want allow user to select multiple items. It will show 10 items in one screen.

urtrivedi 276 Nearly a Posting Virtuoso

I have changed code between your if(productcount>0)

if ($productcount > 0) {

		 	$colindex=1;
		 	$totcols=2;
		 	$rowclosed=false;
  		    //$totrows=ceil($count/$totcols);
  		    
			$dynamicList .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"6\">";		 
			
			while($row = mysql_fetch_array($sql)){ 
		             $id = $row["id"];
					 $productname = $row["productname"];
					 $price = $row["price"];
					 $dateadded = strftime("%b %d, %Y", strtotime($row["dateadded"]));
				
				if($colindex==1)
				{
				 
			        $dynamicList .= "<tr>";
			        $rowclosed=false;
		        }
		        $dynamicList .= '<td width="9%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventoryimages/' . $id . '.jpg" alt="' . $productname . '" width="77" height="102" border="1" /></a></td>
		          <td width="41%" valign="top">' . $productname . '<br />
		            £' . $price . '<br />
		            <a href="product.php?id=' . $id . '">View Product Details</a></td>';
		        
		        $tmp='<td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventoryimages/' . $id . '.jpg" alt="' . $productname . '" width="77" height="102" border="1" /></a></td>
		          <td width="83%" valign="top">' . $productname . '<br />
		            £' . $price . '<br />
		            <a href="product.php?id=' . $id . '">View Product Details</a></td>';

				if($colindex==$totcols)
				{

		        	$dynamicList .= " </tr>";
		        	$colindex=1;
		        	$rowclosed=true;
				}
				else
				{
					$colindex++;
				}		     
		    }
			if(!$rowclosed)
			{
	        	$dynamicList .= " </tr>";		    
	        }
		     $dynamicList .= "</table>";
		} else {
			$dynamicList = "We have no Birthday Cards listed in our store yet";
		}
urtrivedi 276 Nearly a Posting Virtuoso
"<select name='ccrseid' MULIPLE SIZE=10>";

If you want to do things without submitting, then you must use javascript to do so.

urtrivedi 276 Nearly a Posting Virtuoso

1) why you are hard coding '68502' in your query. You must pass some get/post variable for getting the dynamic content.
2) $zip11 = $row; // YOu are fethcing things in zip11 but then you are not making use of it, why?

Also explain your problem little bit more and attach all used php files and mysql table structure.

urtrivedi 276 Nearly a Posting Virtuoso
$query="SELECT registered_members.firstname,registered_members.lastname,registered_members.member_id,friends.m_id,friends.f_id,friends.restriction FROM registered_members,friends WHERE (m_id=$id AND f_id=$x_id AND restriction='green') OR (f_id=$id AND m_id=x_id AND restriction='green')";

echo $query;

$result = mysql_query($query);

Echo the prepared query string before executing it. Then copy it, run in phpmyadmin. Find out the error there and then correct your php code.

urtrivedi 276 Nearly a Posting Virtuoso

I think you need loop into loop

a) section query
secion loop
{
    display section title
    question query where section =section_loop_variable
    question loop
    {
        display question title
    }
}
urtrivedi 276 Nearly a Posting Virtuoso

try with giving name of columns in query, do not use *,

select sectionid, SurveyID, sectionTitle from section where  where SurveyID =".$_GET['survey'];

or if you are using two tables, then post code and table structure of that table

urtrivedi 276 Nearly a Posting Virtuoso

Only HTML will not help
If you want to show images on next page, You have to upload it first, Or you may give comments and title fields along with browse button on first page itself.

To upload and store comments you need to use php/mysql (or any other alternative).

urtrivedi 276 Nearly a Posting Virtuoso

I think you want to do following

1) press button on form1

2) in pl sql code of button, open form2 with some parameter

Steps for achiving this
1) in form two in object navigator mode you will file one node called PARAMTERS
add you paratmeter as many you want (for eg. p_1, p_2, p_3)

2) set form 2 in modal mode, so that after before closing form2 user can not access form1

3) in form one pl/sql code of button

DECLARE
		pl_id ParamList;
		pl_name VARCHAR2(10) := 'paramlist';
	  theformname  VARCHAR2(50);
	BEGIN
	  theformname := 'form2';
		pl_id := GET_PARAMETER_LIST(pl_name);
		IF ID_NULL(pl_id) THEN
			pl_id := CREATE_PARAMETER_LIST(pl_name);
		ELSE
			DELETE_PARAMETER(pl_id,'p_1');
			DELETE_PARAMETER(pl_id,'p_2');
			DELETE_PARAMETER(pl_id,'p_3');
		END IF;
		
 		Add_Parameter(pl_id,'p_1',TEXT_PARAMETER,'value1');
 		Add_Parameter(pl_id,'p_2',TEXT_PARAMETER,'value2');
 		Add_Parameter(pl_id,'p_3',TEXT_PARAMETER,'value3');
	 	
	  CALL_FORM(theformname,no_hide,do_replace,no_query_only,pl_id);
	END;
urtrivedi 276 Nearly a Posting Virtuoso

First thing is that 2 FKs on same field is not a good idea and it will never work, I do not know how mysql allowed it.

Even if it work how you will know, when you look into your order, that who ordered this, customer or admin.

Also why you want to allow admin to order something?

1) One solution is use only customer table. then add one more column to customer table is_admin (y/n).
2) Now add admin rows to the customer table and set flag to Y in is_admin columns.
3) For other customer you may keep this flag to N.
4) Now remove that fk from admin table with order table. You may also drop admin table.

I think above steps may solve your problem without compromising your requirements.

urtrivedi 276 Nearly a Posting Virtuoso

The code is finding sum of array values using recursive method

var numArray = ;
Here you can change the values and check the result. as it is called onload, everytime you have to open link in fresh page, refresh may not work

sumNumbers()
functions accepts 3 arguments, data array, current array index, and result array

function checks if current index is >= to lenght then it returns to calling part.
other wise it adds current index array value to 0th index of result array
it also build a string of array values and store in 1st index of result array.

Now index value is increment and again same function is called with incremented index value.

urtrivedi 276 Nearly a Posting Virtuoso
$sql = "SELECT * FROM tbl_product where fld_type like '%{$type}%'";
urtrivedi 276 Nearly a Posting Virtuoso

onblur="alert('

Above is nothing but javascript. I think you want to say that, you do not want to use javascript function.

urtrivedi 276 Nearly a Posting Virtuoso
select response_id, count(*) tot_questions from 
(

select distinct response_id, question_id from response_bool 
union
select distinct response_id, question_id from response_date
union
select distinct response_id, question_id from response_multiple 
union
select distinct response_id, question_id from response_rank
union
select distinct response_id, question_id from response_single 
union
select distinct response_id, question_id from response_text

)
 WHERE question_id > 118 AND question_id < 148 
group by response_id
ORDER BY response_id;
urtrivedi 276 Nearly a Posting Virtuoso

You may also try xajax ready to use library. Its good and fast.

urtrivedi 276 Nearly a Posting Virtuoso

You just see following line number in my code
10,14,15,18,64,66,68,73

problems
You have not closed your function {}
you are using $password in javascript
you are calling getelementbyID, but you have not set id for your form, name, password element


Also you must ignore using standard html attributes names as name and ID of your elements

<!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" />


<script language="javascript" type="text/javascript">
function button1(){
	var user =document.getElementById("go-btn").value;
	if(document.getElementById("password").value!="amry")
alert('You are very brave!');
else 
{
  alert('A wise decision!')
document.getElementById("frm").submit();

}
}
</script>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="1css/css.css" />
<style type="text/css">
<!--

#image{
	
	
	    margin-top: 7px;
}


#images{
	
font-family: fantasy;
    font-size: 8px;	
	
}
-->
</style></head>

<body >

	<div class="login-form">
    	<div id="hedding">
        	<div class="left"></div>
            <div class="main">
            	<div class="text">
                    <span class="heding-txt1">LOGIN AREA</span>
                    <span class="heding-txt2">FOR</span>
                    <span class="heding-txt3">ZMS</span>
                </div>
                
            </div>
            <div class="right"></div>
        </div>
        
            
        </div>
        <div class="enter">
        
        	<div class="form-lft"></div>
            <div class="form-main">
            	<div class="inner-form">
                <form name=frm id=frm action="logindb.php" method="POST" >
                    <label>Username</label>
                    <input type="text" class="input" name="name" id=name/>
                    <label>Password</label>
                    <input type="password" class="input" name="password" id=password />
                </div>
                <div class="buttns">

               /////////// here is the go btn /////////////////
                	 <input type="button"  class="go-btn" value="go-btn" id="go-btn"  onclick="javascript:button1()"/>
                     <input type="submit" class="lost-btn" value="go-btn" id="lost-btn" />
                </div>
                </form></div>
			<div class="form-rght"></div>
        
        </div>
    </div>	
        
        
        
</body>
<div id="image"><center><img src="222071_1941814027700_1312940202_2218448_386665_n.jpg"/></center>
</div>
<div id="images"><center>Developed by AMRY Soft</center></div>
</html>
urtrivedi 276 Nearly a Posting Virtuoso

this is just overview who you can get your result.

Your case is dynamic, so you may build following query in you code page using for loop and iterating through function master table.

SELECT a.USERID, b.username,
min(case when a.functionid=3 then a.functionid else null end) f1,
min(case when a.functionid=5 then a.functionid else null end) f2,
min(case when a.functionid=6 then a.functionid else null end) f3
from rights a inner join users b on a.userid=b.userid
group by a.userid,b.username
urtrivedi 276 Nearly a Posting Virtuoso

post following
1) full structure of your views with sample data.
2) full query you are trying to get result
3) sample result expected from sample data above

urtrivedi 276 Nearly a Posting Virtuoso

name "submit" is creating problem for you, give another name to button, say btnsubmit.

<input type="button" name="submit" value="SUBMIT" width="60" height="40" onclick="validate()">

urtrivedi 276 Nearly a Posting Virtuoso

you must use form tag in between, then define one hidden input. When user submits the form, set hidden input using your myfunction, and then process the form(insert the submited hidden value) in the form action page.

urtrivedi 276 Nearly a Posting Virtuoso

at the end of the page write following code

<?php
echo "<script type='text/javascript' language='JavaScript'>
         showhidefield('{$_POST['freq']}');
      </script>";
?>
urtrivedi 276 Nearly a Posting Virtuoso

Ya it will set for intial load. You already have javascript in place for later changes by user.

urtrivedi 276 Nearly a Posting Virtuoso

following is the latest, I am posting again because I have modified my previous post.

<input name="chooseDonation" type="radio" id="chooseDonation" onClick="showhidefield('once')" value="onetime" <?php echo ($_POST['freq']=="once")?'checked':'';?> /> 
-or- Monthly Donation: 
<input name="chooseDonation" id="many" type="radio" value="monthly"  onclick="showhidefield('monthly')" <?php echo ($_POST['freq']=="monthly")?'checked':'';?> />
urtrivedi 276 Nearly a Posting Virtuoso

you simply copy my code to your page do not change anything in my code.

<input name="chooseDonation" type="radio" id="chooseDonation" onClick="showhidefield('once')" value="onetime" <?php echo ($_POST=="once")?'checked':'';?> />
-or- Monthly Donation:
<input name="chooseDonation" id="many" type="radio" value="monthly" onmouseup="" onclick="showhidefield('monthly')" <?php echo ($_POST=="monthly")?'checked':'';?> />

urtrivedi 276 Nearly a Posting Virtuoso

No I have just copied source from your website. Only change I have made is in RED.

urtrivedi 276 Nearly a Posting Virtuoso

I think you should not play with your javascript, instead you must use your post variable with html input element.

like


<input name="chooseDonation" type="radio" id="chooseDonation" onClick="showhidefield('once')" onmouseup="" value="onetime" <?php=($_POST=="once")?checked:'';?> />
-or- Monthly Donation:
<input name="chooseDonation" id="many" type="radio" value="monthly" onmouseup="" onclick="showhidefield('monthly')" <?php=($_POST=="monthly")?checked:'';?> />

urtrivedi 276 Nearly a Posting Virtuoso

I have added ID PART, you have kept it blank.

<form id=frmContactUs name="frmContactUs" action="ContactUs" method="post">
urtrivedi 276 Nearly a Posting Virtuoso

what I have suggested will be done at client side using javascript and without submitting a form. In my code case user may select invalid date but can not submit that invalid date.

if you want to use php then you must use ajax or you must submit form.

urtrivedi 276 Nearly a Posting Virtuoso

Do not restrict select element by user choice. You must try to to validate date after user submits the form using some javascript function.

<script lang='javascript'>

var daysOfMonth = new Array(
  31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
);

var daysOfMonthLY = new Array(
  31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
);
function isLeapYear(year) {
  year = year - 0;
  if ((year/4)   != Math.floor(year/4))   return false;
  if ((year/100) != Math.floor(year/100)) return true;
  if ((year/400) != Math.floor(year/400)) return false;
  return true;
}

function isValidDate(day, month, year) {
  day = day - 0; month = month - 0; year = year - 0;
  if ((isLeapYear(year) && day > daysOfMonthLY[month-1]) ||
     (!isLeapYear(year) && day > daysOfMonth[month-1]))
    return false;
  else
    return true;
}


function checkdate()
{


	if (!isValidDate(document.register.day.value, document.register.month.value, document.register.year.value))
	{
	 	alert('Invalid Date');
		document.register.day.focus();		 	
		return false;
	}
}
</script>
urtrivedi 276 Nearly a Posting Virtuoso

no its javascript syntax we can not play with it. You may learn it at

http://www.w3schools.com/jsref/jsref_obj_regexp.asp

urtrivedi 276 Nearly a Posting Virtuoso

this loop will go through all the elements in the form and one by one.

urtrivedi 276 Nearly a Posting Virtuoso

First thing is you must write
Check2(document.myform3.Check_ctr) instead of
check2(document.myform3.Check_ctr) (Capital C in check2 because javascript is case sensitive.

I have changed whole code as following, keeping name and ID same, using checkbox array (easy to process in php after submission)

<head>
<SCRIPT text/javascript>

function Check1()
{
  var intCounter = 0;
   for(intCounter=0;intCounter<=document.myform3.elements.length-1;intCounter++)
    {
      if(document.myform3.elements[intCounter].type=="checkbox")
      {
          document.myform3.elements[intCounter].checked= document.myform3.Check_ctr.checked ;
       }
   }
}

function Check2(chk)
{
	
	if (chk.checked)
  	  document.myform3.Check_ctr.checked =true;
}

</script>
<body>
<form name="myform3" method="post" action="post_php">
<table align="center" width="370px" border="0">
<tr>
	<td width="250px">Item</td>
	<td  align="center" valign="middle">Tick to Display</td>
</tr>
<tr>    
        <td>Project Name: </td>
        <td align=center valign=middle><input type="checkbox" name="Check_ctr" id ="Check_ctr" value="yes" onclick="Check1()" /></td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td valign=middle align=center><input type="checkbox" name="check_list[]" value="1" id="check_list[]" onclick="Check2(this)"/></td>						
</tr>
<tr>
	<td>&nbsp;</td>
	<td valign=middle align=center><input type="checkbox" name="check_list[]" value="1" id="check_list[]" onclick="Check2(this)"/></td>
</tr>
<tr>							
	<td>&nbsp;</td>
	<td valign=middle align=center><input type="checkbox" name="check_list[]" value="1" id="check_list[]" onclick="Check2(this)"/></td>
</tr>
</table>
<input type="submit" name="submit" value="Save Changes" />
urtrivedi 276 Nearly a Posting Virtuoso
<html>
<head>
<script type="text/javascript">

isFirstName = /^[A-Za-z\ \-]+$/;
isAge       = /^[1-9]\d{0,2}$/;

function check()
{
   if (!isFirstName.test(document.getElementById("name").value))
    {
     alert("invalid age");
    
    }


   if (!isAge.test(document.getElementById("age").value))
    {
     alert("invalid age");
    }
}
</script>
</head>
<body>
<form>
Age: <input type="text" id="age" size="30"><br />
Name: <input type="text" id="name" size="30"><br />
<input type="button" value="Check" onclick=check()>
</form>
</body>
</html>
urtrivedi 276 Nearly a Posting Virtuoso

its good that you used count variable not you must keep it as hidden in the form

here is html form code

<INPUT TYPE=HIDDEN id=currentframeno name=currentframeno value=<?php echo ($_POST['currentframeno'])+1 ?>>

then initialise it in javascript as

count = <?php echo $_POST['currentframeno']?>;
urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

$num = "/webroot/imagerfoldername/".$files[$i];

urtrivedi 276 Nearly a Posting Virtuoso

index.php

<iframe src='all.php' > </iframe>

OR

include('all.php');
urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

if you are looking for $tld in your server list then you can do it directly

$serverlist=array(........);.//your serverlist array

$tld="org";

$key = array_search($tld, $array); 

echo $key;//returns 3