hielo 65 Veteran Poster

I run my task scheduler and give the path of my php page

It's not clear to me what you did. If I am not mistaken, currently you update it "manually" by typing the url in the browser directly and loading the page. IF that is correct, then in windows scheduler you just need schedule some browser that you don't use too often ex: IE to open every day at a specific time and have it open on a specific url. If you cannot figure out how to specify the url that should open, then configure the browser that you chose so that its default homepage is the url to your page.

hielo 65 Veteran Poster

You are welcome. Don't forget to mark the thread as solved.

Regards,
Hielo

hielo 65 Veteran Poster

it forces the interpreter to treat the "stuff" between {} as a variable. The reason it was chocking is because you have $_POST within a double quoted string, but for consistency I added it to all the other variables as well.

hielo 65 Veteran Poster

copy and paste the following:

$result = mysql_query("UPDATE  `customer` SET `nic` = '{$nic}', `full_name` = '{$full_name}', `name_with_initials` =  '{$name_with_initials}',                                   `address` = '{$address}', `contact_number` = '{$contact_number}', `gender`  = '{$gender}' where `customer_id`={$_POST['customer_id']}") or die (mysql_error()) ;
hielo 65 Veteran Poster

don't forget about the or die(mysql_error() ); whenever you execute a query:

$result = mysql_query("UPDATE  customer 
					SET	nic = '$nic'
						, full_name = '$full_name'
						, name_with_initials =  '$name_with_initials'
						, address = '$address'
						, contact_number = '$contact_number'
						, gender  = '$gender' 
					WHERE customer_id=$_POST['customer_id']")  or die( mysql_error() );

As for your parse_error, you would need to post your php code for modify_form.php for us to know what line is #25.

hielo 65 Veteran Poster

It has worked for me in the past. Just make sure you are using a string or a number, and not some variable that you declare outside the class.

hielo 65 Veteran Poster

BTW: If you look at my first post in your earlier thread, you will see how I included a hidden field name tran_ID for each of your rows. This is the same technique I am describing above.

hielo 65 Veteran Poster

But when i modifies one record of a particular customer

you need to also submit the id of that particular customer. Assuming each customer record has unique key (PRIMARY KEY) named 'cust_id', then on you also need to include it on your form (perhaps as a hidden field). So when the info is posted, your php script above will see the cust_id for the selected user and in your UPDATE statement you need to limit the affected records to just the selected customer by issuing a "... WHERE cust_id=$_POST['cust_id']" in your update statement.

hielo 65 Veteran Poster

if you are referring to classes, see below:

class className{
  private $property1="hello";
  public $property2="goodbye";
}
hielo 65 Veteran Poster

select the divs whose class contain "myDivs", do an each() and within the function check the numeric suffix of the class

<!DOCTYPE html>
<html>
<head>
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
	<script>
	$(function(){
		$("div[class*=myDivs]").each(function(){
			var id=($(this).attr('class')).match(/(\d+)$/)[0];
			if( 7 <= id && id <=12)
			{
				doSomething( id, this.className );
			}
		});
	});
	
	function doSomething(id, cls){
		alert( 'class="' + cls + '" with numeric id=' + id);
	}
	</script>
</head>
<body>
	<div class="myDivs6">6</div>
	<div class="myDivs7">7</div>
	<div class="myDivs8">8</div>
	<div class="myDivs9">9</div>
	<div class="myDivs10">10</div>
	<div class="myDivs11">11</div>
	<div class="myDivs12">12</div>
	<div class="myDivs13">13</div>

</body>
</html>
hielo 65 Veteran Poster

If there is already Data in the field should I be using UPDATE instead of INSERT?

UPDATE

How do I specify which record/primary key is to update?

currently you are generating:

...
echo "<input type='text' size='2' name='PTS1011_wk1'>";
...
echo "<input type='text' size='2' name='GP1011_wk1'>";
...

for each player. I am assuming that playerID IS the unique key for every record. If that is the case then what you need to do is put that as an array index in the name of the field:

...
echo "<input type='text' size='2' name='PTS1011_wk1[" . $row['playerID'] . "]'>";
...
echo "<input type='text' size='2' name='GP1011_wk1[" . $row['playerID'] . "]'>";
...

which should generate something like:

...
<input type='text' size='2' name='PTS1011_wk1[7]'>
<input type='text' size='2'  name='GP1011_wk1[7]'>
<input type='text' size='2' name='PTS1011_wk2[7]'>
<input type='text' size='2'  name='GP1011_wk2[7]'>
<input type='text' size='2' name='PTS1011_wk3[7]'>
<input type='text' size='2'  name='GP1011_wk3[7]'>
<input type='text' size='2' name='PTS1011_wk4[7]'>
<input type='text' size='2'  name='GP1011_wk4[7]'>
...
<input type='text' size='2' name='PTS1011_wk1[21]'>
<input type='text' size='2'  name='GP1011_wk1[21]'>
<input type='text' size='2' name='PTS1011_wk2[21]'>
<input type='text' size='2'  name='GP1011_wk2[21]'>
<input type='text' size='2' name='PTS1011_wk3[21]'>
<input type='text' size='2'  name='GP1011_wk3[21]'>
<input type='text' size='2' name='PTS1011_wk4[21]'>
<input type='text' size='2'  name='GP1011_wk4[21]'>
...

where the 7 and 21 represent the unique id for each player per row. PHP will see an array SIMILAR to:

$_POST['PTS1011_wk1'] => array(7=>"a")
$_POST['PTS1011_wk2'] => array(7=>"b")
$_POST['PTS1011_wk3'] => array(7=>"c")
$_POST['PTS1011_wk4'] => array(7=>"d")

$_POST['PTS1011_wk1'] => array(21=>"e")
$_POST['PTS1011_wk2'] => array(21=>"f")
$_POST['PTS1011_wk3'] => array(21=>"g")
$_POST['PTS1011_wk4'] => array(21=>"h")

the same goes for the GP1011_wk# group. So if you want to get the value "a", you would need to get it from $_POST[7].

So, your "challenge" …

hielo 65 Veteran Poster

You are currently doing:

if( conditions )
{
   ...
   required: true
   ...
}

If you look closer at your working example, your required is NOT true|false, it is a reference to a function that returns true or false. So, instead of what you have (and is not working) put your conditions in an anonymous function and assign that anonymous function to required:

$(".yearly_ns").each(function() {
		$(this).rules(	"add"
						,{	required: function(){
									return (''+$("input[name='package']").val() != '99' && $("input[name='nameserver_setup']:checked").val() == "SET") ;
									} 
						}
					); 
	});
hielo 65 Veteran Poster

try:

header("Cache-Control: no-cache \n");
header("Pragma: no-cache \n");
header("Expires: 0 \n");
//header("Refresh:3; $_SERVER[PHP_SELF]?sid=$sessionid");

//not sure if the variable with the id that you are using is $sid OR $sessionid, but be sure to use the correct one below
echo sprintf('<script>setTimeout( function(){location.href="%s?sid=%s&cb=%s"} ,3000);</script>',$_SERVER['PHP_SELF'], $sessionid, time());
echo $percent_done.'% completed';
hielo 65 Veteran Poster

You posted this in MySQL. The syntax I gave you is for MySQL, NOT access.
Try:

strQuery = "
	SELECT SUM([Production]) as total
	FROM [MONTHLYPROD] 
	WHERE( 
			CDATE([DATE])
				BETWEEN 
						#01/12/1999# 
					AND 
						#01/02/2000# 
		) 
		AND ([UNIQUEID] LIKE '"+engineName+"')"
hielo 65 Veteran Poster

Make sure that your page STARTS with session_start(); THEN (later on) you can assign to/retrieve values from $_SESSION.

In your case, instead of $sum use $_SESSION - ex:

$_SESSION['sum']=mysql_fetch_assoc($totals);
...
echo $_SESSION['sum']['GP1011_wk1'];
...
echo $_SESSION['sum']['PTS1011_wk1'];
...

Lastly, on the OTHER php page(s) where you want to use those values, you MUST also call session_start() at the beginning of the file first, THEN you can echo the values.

ceeandcee commented: Thank you! +1
hielo 65 Veteran Poster

... how I did it

That looks like a copy and paste of Hielo's first post!! :)

hielo 65 Veteran Poster

Basically you need to use a particular program on your server that in turn executes a certain program at a specific date/time OR at periodic intervals.

On a windows server, you have the "Task Scheduler". On a Unix/Linux box you would use the crontab or at command. Again, if you are with a webhost, find out from them what they have available for you.

http://www.linuxjournal.com/article/4087
http://www.ibm.com/developerworks/linux/library/l-job-scheduling.html
http://kevin.vanzonneveld.net/techblog/article/schedule_tasks_on_linux_using_crontab/

hielo 65 Veteran Poster

sorry, it should be an "arrow" not an "equal": foreach($row as $k => $v)

hielo 65 Veteran Poster

That ":hover" will likely not be recognized by IE 6. There are a lot of users still using that browser. Try the following instead:

<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script>
//cache the images first 
var imgs=[];
imgs[imgs.length]=new Image();
imgs[imgs.length-1].src='images/numr.png';

imgs[imgs.length]=new Image();
imgs[imgs.length-1].src='images/num1.png';

imgs[imgs.length]=new Image();
imgs[imgs.length-1].src='images/num2.png';

imgs[imgs.length]=new Image();
imgs[imgs.length-1].src='images/num3.png';

$(document).ready(function(){
 		$('.imageButton').hover( hoverIn, hoverOut);
});

function hoverIn(){ 
	$(this).attr('prevImage',$(this).attr('src')).attr('src','images/numr.png');
}
function hoverOut(){ 
	$(this).attr('src', $(this).attr('prevImage') ).attr('prevImage','');
}
</script>
</head>
<body>
<input type="image" class="imageButton" src="images/num1.png" id="as">
<input type="image" class="imageButton" src="images/num2.png" id="ad">
<input type="image" class="imageButton" src="images/num3.png" id="af">
</body>
</html>
hielo 65 Veteran Poster

Generally, when a function/method call returns something, and you need that something later on, you need to "receive/assign" it to something else. Your $post->get_news($user_id); returns an array, but there is NOTHING "receiving" that array. Also, just because your method get_news() returns an array, it does NOT "overwrite" the $post variable. Thus, after the method call, the $post variable is still a 'News' object. So $post[$i] is not valid - again, because $post is NOT an array - it is still a News object. So try:

$post=new News;
$data = $post->get_news($user_id);

//to verify that you got the array you were expecting
print_r($data);

for($i=0; $i<5; $i++){
  foreach($data[$i] as $k=>$v){
      echo $v; //get error: "Cannot use object of type News as array in ..."
   }
}

On another note, the only similarity between your thread and the other was that both of you have the need to retrieve data from the db. You are way ahead of the game since you already have some php code in place that needs minor fixing. The other poster didn't seem to have anything in place yet.

Regards,
Hielo

hielo 65 Veteran Poster

assuming your fields are named `GP` and `PTS`:

<?php

$result = mysql_query("SELECT * FROM stats1011 where 1A = 'BULL' OR 1B = 'BULL' order by field(pos,'LW','C','RW','D','G'), Last ASC")
or die(mysql_error());  
   

?>


<?php
echo "<table width='150' border='1' cellspacing='0' cellpadding='1' bgcolor='ffffff'>";
echo "<tr> 
<tr bgcolor='000000'>
<td align='center'colspan='5'><img src='/images/bar_bull.jpg' width='150' height='19' border='0'></td>
</tr>

<tr>
<td colspan='3' align='left' width='100' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>Player</b></td>
<td align='center' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>GP</b></td>
<td align='center' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>PTS</b></td>

</tr>
";

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	// Print out the contents of each row into a table
	


	echo "<tr><td width='15' align='center' bgcolor='FFFF99'><font face='arial' size='1' color='000000'><b>";
	echo $row['Pos']; 
	echo "</b></td><td width='100' align='left' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
	echo $row['Last'];
	echo "</td><td width='15' align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
	echo $row['Team'];
	echo "</td><td width='15' align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
	echo $row['GP1011_wk1'];
	echo "</td><td width='15' align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
	echo $row['PTS1011_wk1'];
	
} 
$totals=mysql_query("SELECT SUM(`GP`) as GP1011_wk1, SUM(`PTS`) as PTS1011_wk1 FROM `stats1011` where 1A = 'BULL' OR 1B = 'BULL' ") or die(mysql_error());
$sum=mysql_fetch_assoc($totals);
echo "<tr><td colspan='3' align='left' width='100' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>TOTALS</b></td>";
echo "<td align='center' width='100' bgcolor='000000'><font face='arial' size='1' color='ffffff'>";
echo $sum['GP1011_wk1'];
echo "</td><td align='center' width='100' bgcolor='000000'><font face='arial' size='1' color='ffffff'>";
echo $sum['PTS1011_wk1'];
echo "</td></table>";

?>
hielo 65 Veteran Poster

When I go to the link you posted and then look at the browser's source code I am seeing:

<form action="verify.php"...>
   ...
  <form action="javascript:alert('enable');"> 
  <input type="submit" id="Submitter" value="Continue to next step" disabled="disabled" /> 
  </form> 
...
</form>

That is NOT valid html and some browsers "choke" on it. You are NOT allowed to nest form tags:

WRONG:

<form>
  <form>...</form>
</form>

CORRECT:

<form>...</form>
<form>...</form>

So on your code get rid of the inner <form> and leave only the submit button <input type="submit" id="Submitter" value="Continue to next step" disabled="disabled" />

hielo 65 Veteran Poster

currently in user_list.php (line 95) you have SELECT * FROM users LIMIT $startrow, 10 . If in fact your users table has a field named `id`, then focus your efforts in profile.php since user_list.php seems fine. In profile.php you should be retrieving the user id by issuing $_GET['id'] NOT $_POST['id']

hielo 65 Veteran Poster

Then just get rid of the <html>...</html> . On the page you are submitting FROM you need your submit button to have name="Submitter" for the php code above to work.

hielo 65 Veteran Poster

newprimitive, please stop hijacking someone else's thread and open your own. I'll gladly help

hielo 65 Veteran Poster

... where id = '$_SESSION[user_id]'") are you updating $_SESSION[user_id] to that of the one you selected/click on in profile.php?

hielo 65 Veteran Poster
<?php
if( isset($_POST['Submitter']) && !empty($_POST['Submitter']) )
{
 $to = "reciever@example.com";
 $subject = "Test Subject";
 $body = "Test Body";
 $headers = "From: sender@example.com\r\n" .
     "X-Mailer: php";
 if (mail($to, $subject, $body, $headers)) {
   echo("<p>Message sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
  exit();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="checkbox" name="agree" value="yes" onclick="Submitter.disabled = !this.checked" />Do you Agree?
<input type="submit" name="Submitter" id="Submitter" value="Submit" disabled="disabled"/>
</form></body>
</html>
keavon commented: It was very fast and worked pretty well. He helped me later on in an other post too. +1
hielo 65 Veteran Poster

The amount is credited and the balance is updated very well. But interest should be added daily.

OK, then if the queries are working fine, then your problem is NOT really about "adding interest rates to your account tables", but rather, "how to auto-execute queries on a daily basis". If that is the case, you need to set up a "cron job". If you are with a web host, ask them what utility they have available to schedule a "cron job".

hielo 65 Veteran Poster
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<form>
<input type="checkbox" name="agree" value="yes" onclick="Submitter.disabled = !this.checked" />Do you Agree?
<input type="submit" name="Submitter" id="Submitter" value="Submit" disabled="disabled"/>
</form></body>
</html>
hielo 65 Veteran Poster

save this as hielo.php and try it:

<?php
define('TABLE_NAME','accounts');

$dbConnection= mysql_connect("localhost","username","password") or die( mysql_error() );

$fields=array(	'tran_ID'=>array('label'=>'Transction ID','format'=>"%d")
				,'account_type'=>array('label'=>'Account Type','format'=>"'%s'")
				,'account_number'=>array('label'=>'Account Number','format'=>"'%s'")
				,'transaction_type'=>array('label'=>'Transaction Type','format'=>"'%s'")
				,'amount'=>array('label'=>'Amount','format'=>"'%s'")
				,'Date'=>array('label'=>'Date','format'=>"'%s'")
				);

mysql_select_db("dbName") or die( mysql_error() );

if( isset($_POST['update']) && !empty($_POST['update']) )
{
	updateRecord($_POST['tran_ID'], $dbConnection);
}
elseif( isset($_POST['edit']) && !empty($_POST['edit']) )
{
	showSelectedRecord($_POST['tran_ID'], $dbConnection);
}
else
{
	showAllRecords($dbConnection);
}
mysql_close();
exit();

function showAllRecords($dbConnection)
{
  $sql = sprintf("SELECT `tran_ID`,`account_type`,`account_number`,`transaction_type`,`amount`,`Date` FROM `%s`",TABLE_NAME);
  $result=mysql_query($sql) or die( mysql_error() );
  $total=mysql_num_rows($result);

  if( 0==$total )
  {
    echo "<p>No records found.</p>";
  }
  else
  {
    $row=mysql_fetch_assoc($result);
	$id=$row['tran_ID'];

    echo '<table>';
    echo '<thead><tr><th>' . implode( '</th><th>', $keys) . '</th></tr></thead><tbody>';
	unset($row['tran_ID']);
    do{
      echo '<tr><td>' . implode('</td><td>',$row) . '</td><td><form method="post" action="' . $_SERVER['PHP_SELF'] . '"><input type="hidden" name="tran_ID" value="' . $id . '"/><input type="submit" name="edit" value="Edit"/></form></tr>';
    }while( $row=mysql_fetch_assoc($result) );
    echo '</tbody></table>';
  }
return $total;
}

function showSelectedRecord( $id,$dbConnection )
{
  global $fields;
  
  $sql = sprintf("SELECT `account_type`,`account_number`,`transaction_type`,`amount`,`Date` FROM `%s` WHERE `tran_ID`=%d", TABLE_NAME, mysql_real_escape_string($id));
  $result=mysql_query($sql) or die( mysql_error() );
  $total=mysql_num_rows($result);
  if(1==$total)
  {
  	$row=mysql_fetch_assoc();
	echo sprintf('<form method="%s" action="%s">','post',$_SERVER['PHP_SELF']);
	foreach($row as $k=$v){
		echo sprintf('<div><label for="%s">%s</label>: <input type="text" name="%s" value="%s"/></div>', $k, $fields[$k]['label'], $k, htmlentities($v, ENT_QUOTES) );
	}
	echo '<div><input type="hidden" name="tran_ID" value="'.$id.'"/><input type="submit" name="update" value="Update" /></div>';
	echo '</form>';
  }
  elseif(0==$total)
  {
    echo '<p>Unable to find a record with tran_ID='.$id.'</p>';
  }
  else
  {
    echo '<p>Unable to find a UNIQUE record with tran_ID='.$id.'. Instead, a total of '.$total.' records were found!</p>';
  }
}

function updateRecord($id, $dbConnection)
{
  global $fields;
  $sql="";
  unset($fields[$id]);
  foreach($fields as $k=>$v)
  {
    $f=",`%s`=".$fields[$k]['format'];
  	$sql.=sprintf($f, $k, mysql_real_escape_string($_POST[$k]) );
  }
  $sql=sprintf("UPDATE `%s` SET %s WHERE `tran_ID`=%d", TABLE_NAME, substr($sql,1), mysql_real_escape_string($id) );
  mysql_query($sql) or die(mysql_error());
  echo …
hielo 65 Veteran Poster

mysql_real_escape_string() is to avoid sql injection. It's for security purposes. IF you don't know what sql injection is, search it. Tons of results out there.

The sprintf() is not required, but I find it easier to construct strings. Look it up on the php manual and be sure to look at the examples section.

As for that last line, it just puts the name of the fields at the top of the table. Look up the implode() and array_keys() in the manual as well. All of these are well documented that it is pointless for me to try to reword what is already properly and clearly described in the manual.

hielo 65 Veteran Poster

This line of your coding should be changed know.

There is NOTHING wrong with that line.

On line 2, are you sure you included the "!" symbol to the left of empty()?

hielo 65 Veteran Poster

Save this as hielo.php and try it:

<?php
if( isset($_POST['nic']) && !empty($_POST['nic']) )
{
  mysql_connect("localhost","username","password") or die( mysql_error() );

  mysql_select_db("dbName") or die( mysql_error() );

  $sql = sprintf("SELECT `customer_id`, `nic`, `full_name`, `name_with_initials`, `address`, `contact_number`, `gender` FROM `customer` WHERE `nic`='%s'", mysql_real_escape_string($_POST['nic']) );

  $result=mysql_query($sql) or die( mysql_error() );

  if( 0==mysql_num_rows($result) )
  {
    echo "<p>No records found.</p>";
  }
  else
  {
    $row=mysql_fetch_assoc($result);  

    echo '<table>';
    echo '<thead><tr><th>' . implode( '</th><th>', array_keys($row) ) . '</th></tr></thead><tbody>';
    do{
      echo '<tr><td>' . implode('</td><td>',$row) . '</td></tr>';
    }while( $row=mysql_fetch_assoc($result) );

    echo '</tbody></table>';
  }
exit();
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<div>Enter NIC number: <input type="text" name="nic" value="" /> <input type="submit" value="Submit"/></div>
</form>
hielo 65 Veteran Poster

Try:

strQuery = "
	SELECT SUM(`Production`) 
	FROM` MONTHLYPROD` 
	WHERE	(STR_TO_DATE(`DATE`,'%m/%d/%Y') 
				BETWEEN 
						STR_TO_DATE('01/12/1999','%m/%d/%Y') 
					AND 
						STR_TO_DATE('01,02,2000', '%m,%d,%Y') 
			) 
		AND (`UNIQUEID` LIKE '"+engineName+"')";
hielo 65 Veteran Poster
I am using jQuery $.post to send Ajax requests. It works fine for non redirecting PHP scripts,

There's your problem. From the jQuery manual

jQuery.post( url, [ data ], [ success(data, textStatus, XMLHttpRequest) ], [ dataType ] )

the third argument is a reference to a function which is to be called whenever the request completes "successfully". But this "successful" request equates to a http response status=200. A redirect gives you a 301 request, NOT 200. So you cannot use $.post(). Instead use $.ajax(). Currently you probably have something SIMILAR to:

$.post('page.php',params, function(){
  //here is whatever you are doing on a successful request
  ...
});

change that to:

$.post('page.php',params, function(){
  //here is whatever you are doing on a successful request
  ...
});
$.ajax({
  type: 'POST'
  ,url: 'page.php'
  ,data: params
  ,success: function(){
    //here is whatever you are doing on a successful request
    ...
  }
  ,complete: function(httpObj, textStatus){
     switch( 1*httpObj.status )
     {
          case 301: //here you do whatever you need to do
                    //when your php does a redirection
                    alert("Redirection");
                    break;

          case 404: //here you handle the calls to dead pages
                    alert("Page Not Found");
                    break;
     }
  }
});
hielo 65 Veteran Poster

why would it?

You were not including the "url=" part. INSTEAD of the header() function, you can try:

echo '<script>location.href="'.$_SERVER['PHP_SELF'].'?cb=(new Date()).valueOf()";</script>';
exit();
hielo 65 Veteran Poster

If you do not want any redirection to take place when viewing the page via ajax, what you can do is to send a parameter that identifies the request as being ajax. In your php code, immediately before the redirect code see if you detect that parameter and if you do, then do NOT redirect.

To clarify, if the url you are sending the requests to is http://site.com/file.php, then simply make the requests to http://site.com/file.php?rt=ajax (rt=requestType).

Then, assuming you currently are redirecting using header("Location: ..."); , then it would now be:

if( !isset($_GET['rt'])  || $_GET['rt']!='ajax' )
{
  header("Location: ...");
  exit();
}

That way if the page is NOT accessed via ajax, it would still redirect.

hielo 65 Veteran Poster

you need to capture the x-y coordinates of the mouse. Search for "mouse x y coordinates" in google.

hielo 65 Veteran Poster

Glad to help.

Regards,
Hielo

PS: Don't forget to mark the thread as solved.

hielo 65 Veteran Poster

Like before, I was about to suggest

switch ('' + `cLogin`)

to force the value into string context and leave the quotes around the numbers in the case statements, but what you did is the inverse of what I was about to suggest. Glad it's working now.

Regards,
Hielo

PS: Don't forget to mark the thread as solved.

hielo 65 Veteran Poster
hielo 65 Veteran Poster

It forces IE to make the ajax request EVERY TIME, since it adds the current timestamp, which is different everytime. From the browser's view, the url is different everytime, it does NOT use the cached page. That was your problem - it was reusing the cached page.

hielo 65 Veteran Poster

The only other change I can suggest is (based on my previous post), change: switch (cLogin) to switch (''+cLogin) to force cLogin into string context.

There are not syntax problems in the given javascript code, so if the problem persist, it must be related to SpeedScript. Are you sure you can "share/dereference" SpeedScript variables from javascript?

hielo 65 Veteran Poster

This is probably what you seek:

<!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>Index</title>
        <style type="text/css">
			.marker
			{
				background-color:#0066FF;
				height:32px;
				width:32px;
				z-index:4;
			}
			
			#map
			{
				position:absolute;
				top:250px;
				left:0px;
				width:100%;
				height:auto;
				z-index:0;
				text-align:center;
			}
        </style>
     
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
 $(document).ready(function(){
				var count=1;

				$("img.image").click(function(e){
					 var div=$("<div class='marker'></div>").attr("id","marker" + count)
					 								.css("left",e.pageX)
													.css("top",e.pageY)
													.show()
					 								.appendTo("div#map");
					 alert( div.attr("id") );
					});
            });
        </script> 
</head>
    <body>
		<div id="map"><img src="worldDotMap.png" height="429" width="900" alt="World" class="image" id="world" /></div>

    </body>
</html>
hielo 65 Veteran Poster

I can't say which one is "better" than the other. My suggestion to you would be to use whichever of the two you find easier to understand. Down the road you may need to come back to your script and make changes. Understanding well what your code does will make your job easier.

hielo 65 Veteran Poster

a. your javascript code is checking the display property, but your css uses the visibility property.

b. If your css initially has a STYLE block/tag with #submitButton{display:none} (or declared on an exteral stylesheet), then doing alert( document.getElementById('submitButton').style.display ) will reveal that the alerted value will NOT be "none" as declared in the css STYLE tag/external stylesheet. The "XXX.style.display" would show "none" only if you declared it on the tag using the style attribute - ex:

<input style="display:none" />

I suggest you try the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>	   
#submitButton {
    display:none;
}
</style>
<script>
function showSubmit(){
                var s = document.getElementById("submitButton");
                if (s.style.display!="inline"){
                    s.style.display="inline";
                }
            }
</script>
</head>
<body>
		  
Click <a href="#" onclick="showSubmit()">here</a> to display submit button.
        <form action="mailscript.php" method="post" class="mailbox">
            <table class="mailbox">
            <tr><td>Email To:</td><td><input type="text" name="emailto" /></td></tr>
            <br />
            <tr><td>Subject:</td><td><input type="text" name="subject" /></td></tr>
            <br />
            <tr><td>Message:</td><td><input type="text" name="body" class="body"/></td></tr>
            </table>
            <br />
            <input id="submitButton" type="submit" value="Send Email" class="submit" name="submit"/>
        </form>		  
	   

</body>
</html>
hielo 65 Veteran Poster

, I've ommitted the bits which are not relevent to this problem.

Does the omitted code have the <div class="marker"> ? What you posted does not make sense given $("div.marker").attr("id","marker" + count); since no where on your code do see a div the class="marker" which seems to be the cornerstone of your code!

hielo 65 Veteran Poster

Hope this was what you meant.

No, that wasn't what I meant. You just needed to change line 9 of your original post to what I gave you. Everything else would be the same.

hielo 65 Veteran Poster
$query = "SELECT lastname, firstname, state, zip, jobtype, otherjobtype, nightavail, weekendavail, ptft, resume FROM data 
				WHERE (job_id LIKE '%" . $trimmed . "%') OR (jobtype LIKE '%" . $trimmed . "%')
 ORDER BY lastname ";
hielo 65 Veteran Poster

It's hard to help you without seeing the relevant HTML markup associated with your jquery statements, but I can tell you that

$("#div.marker")

looks "suspicious". That implies that you have some element with id="div" and a class="marker" - for example:

<div id="div" class="marker">...</div>

If the div in question does NOT have id="div" , then get rid of the leading "#" symbol.