hielo 65 Veteran Poster

On lines 37-64, you cannot have $DetailsRow because you have NOT queried the db. It looks like what you need is the data that was just POSTed. So change $DetailsRow to $_POST

hielo 65 Veteran Poster

Works fine but I cant upload more than 3MB files using this script

refer to the following:
http://us2.php.net/manual/en/features.file-upload.post-method.php

specifically,

...The MAX_FILE_SIZE hidden field (measured in bytes) must precede the file input field, and its value is the maximum filesize accepted by PHP...

alternatively, if you have access to your php.ini file look for:
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

and try increasing it.

hielo 65 Veteran Poster

...SET Fname='$a' AND Lname='$b' you need to get rid of AND. To update multiple fields, you need to separate them with a comma, NOT with the keyword AND. Try the following:

<?php
if( isset($_POST) && !empty($_POST) )
{

	mysql_connect("localhost","*****","****") or die('Could not connect:<br />' . mysql_error());
	mysql_select_db("*****", $con) or die( 'Unable to select db:<br />' . mysql_error() );

	$a=mysql_real_escape_string($_POST['e']);
	$b=mysql_real_escape_string($_POST['f']);

	$sql="UPDATE `Sample` SET `Fname`='$a',`Lname`='$b'";

	mysql_query($sql) or die('Unable to execute query: <br />'.$sql.'<br />'.mysql_error()) ;

	echo "Successful";

	mysql_close($con);
}
else
{
	echo "No data was posted!";
}
?>
hielo 65 Veteran Poster

try using the following html parser:
http://simplehtmldom.sourceforge.net/

hielo 65 Veteran Poster

Your textarea should look SIMILAR to the following: <textarea name="comments" rows="7" cols="60">Hello</textarea> These are WRONG: <textarea name="comments" rows="7" cols="60" value="HELLO"></textarea> <textarea name="comments" rows="7" cols="60" value="HELLO"/>

hielo 65 Veteran Poster

instead of:

for (item in content)

try:

for (var item=0,limit=content.length; item < limit; ++item)
hielo 65 Veteran Poster

on line 13 of my previous post put: echo $select_query; what do you get? What is the HTML code you are using on the page you are posting FROM?

hielo 65 Veteran Poster

use wrap your code in an if clause that checks to see if the id was provided. Then at the end just put the IMG tag with the desired id:

<?php
if( isset($_GET['id']) && !empty($_GET['id']))
{
 //rest of code goes here.
 ...
exit;
}
?> 
<img src="imageFetcher.php?id=12" />
hielo 65 Veteran Poster

Will you see something or it will automatically refresh to page1.php ??? I never used this, but if i am right, i would be another way, no ?

Yes, BUT there would be one "major" requirement. No output may be sent do the browser before the header() call.

hielo 65 Veteran Poster

you need to add '~' as the third argument to fgetcsv():

<?php 
$namefile = 'pilots.txt';  
$OUTFILE = fopen($namefile, 'r') or die("Can't open $namefile for read");  
$name = fgets($OUTFILE,4096);  
if($OUTFILE)
{
	while (!feof($OUTFILE))
	{
		$row=fgetcsv($OUTFILE,1024,'~');
		echo sprintf('%s %s', $row[0], $row[4]); 
	}
	fclose ($OUTFILE);  
} 
?>
hielo 65 Veteran Poster

I am not familiar with the editor mentioned so I can't help you with that.

As for the hover problem, there is another workaround:
http://www.xs4all.nl/~peterned/csshover.html

Just thought you might be interested.

Regards,
Hielo

hielo 65 Veteran Poster

Let's say that page1.php includes page2.php, but you want page2.php to NOT be accessed directly. So on page1.php you define the constant:

<?php
//page1.php
define('RESTRICTED',1);
include('page2.php');
...
?>

Then in page 2 you simple check to see if the constant is defined:

<?php
//page2.php
if(!defined('RESTRICTED'))exit('No direct script access allowed!');
...
?>
hielo 65 Veteran Poster

let's say that the code you posted is for a file named getImage.php. Now on page1.php you need to show the image with id=23. All you have to do in page1.php is to put this:

<img src="http://yoursite.com/imageFetcher.php?id=23" />

Also, since you only need the `data` field, then use SELECT data FROM ...

hielo 65 Veteran Poster

Is anything wrong in that syntax?

That depends on your php configuration file. When short_open_tag is On, then

<?
...
?>

is NOT a problem, but if it is Off, then you would get runtime errors. Simply add php to the opening tag:

<?php
...
?>
hielo 65 Veteran Poster

perhaps the parent element of the table has the relevant setting - ex:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!--
#envelope{border-bottom:1px dotted black;}
-->
</style>

</head>
<body>
	<div id="envelope">
	<table summary="">
		<tr>
		<td>x</td>
		</tr>
	</table>
	</div>
</body>
</html>
hielo 65 Veteran Poster

only to find the CSS "hover" is NOT available in IE8. I've found the hover to be very useful in calling attention to links by changing their color.

Are you sure about that? The code below works fine for me. If anything, the lack of support would be in elements that are NOT links. For example, div:hover is not supported(AFAIK), but links have always been supported (at least since IE6).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!--
a:hover{background-color:yellow;color:red;}
-->
</style>

</head>
<body>
<a href="#">Hello</a>
</body>
</html>

As for javascript you can use the onmouseover and onmouseout attributes:

<div onmouseover="highlight(this)" onmouseout="highlight(this)">world</div>
<script language="JavaScript" type="text/javascript">
<!--
function highlight(e)
{
  if( e.style.backgroundColor=='yellow')
  {
  	e.style.backgroundColor='white';
	e.style.color='black';
  }
  else
  {
  	e.style.backgroundColor='yellow';
	e.style.color='red';
  }
}
//-->
</script>
hielo 65 Veteran Poster

it's called autocomplete: <input type="text" autocomplete="off" .../> http://www.htmlcodetutorial.com/forms/_INPUT_AUTOCOMPLETE.html

hielo 65 Veteran Poster

Appreciate if you can write script for only searhing by date function.

All you need to do is to comment out all the options in your select list EXCEPT the Date option. It must still remain with value="2"

also, line 48:

<option value="2">2</value>

should be:

<option value="2">2</option>

Also, IMMEDIATELY before [B]if(!empty($sql))[/B] (line 199), put: echo $sql; do you see the sql command?

hielo 65 Veteran Poster

on your form, this:

<input type="submit" value="Calculate" />

needs a NAME attribute:

<input type="submit" name="Submit" value="Calculate" />

Notice the UPPER CASE "S" for Submit (lowercase "submit" is 'reserved' in javascript). So be sure to use "Submit" in your php code as well:

$calculate=$_POST['Submit'];
 if (isset($_POST['Submit']))
hielo 65 Veteran Poster

If your editor supports different fonts, then change your font-family to Verdana.

Otherwise copy and paste your code onto a text editor (like MS Word); highlight it all then change the font-family to Verdana.

Do you see the now that p1 (p followed by number one) is NOT the same as pl (p followed by lowercase "L")!

hielo 65 Veteran Poster

search for "url rewrite tutorial". Basically your server will "look" at the url first, and (as long as you provide the correct/necessary rewrite rule), internally it can/will send the request to results.php?params=somevalue anothervalue, etc.

If you are using an apache server, chances are you already have that capability. If you are not the webmaster/administrator of the server, contact the admin to find out if your server supports url rewrite.

hielo 65 Veteran Poster

your submit button has name="submit", so you should be using that in $_POST, NOT 'Calculate'. You must use the NAME of the field:

WRONG:

$calculate=$_POST['Calculate'];
 if (isset($_POST['Calculate']))

CORRECT:

/* after this, $calculate should be set whatever the VALUE attribute is set to. In this case Calculate */
 $calculate=$_POST['submit'];
 if (isset($_POST['submit']))
hielo 65 Veteran Poster

Yeah so can i not show the URL in the address bar with the get request details?

I don't understand what you are asking. IF you arrive at page1.php and you need data/info from page2.php and you do NOT want page2.php in the address bar, then when you send the ajax request to page2.php, then the address bar will remain as page1.php. In other words, page2.php remains "hidden".

Now if you want to pass parameters to page2.php, then instead of arriving at page1.php, your users should be arriving to something SIMILAR to page1.php?section=comments then before you send the ajax request, retrieve the string after the quation mark from location.href:

var params = location.href.substring(location.href.indexOf('?') )

then on the server you should be able to see those parameters and send content specific for those parameters.

hielo 65 Veteran Poster

put a % symbol BEFORE and AFTER the variable name:

"SELECT * FROM members WHERE name LIKE '%$searchKey%';"
hielo 65 Veteran Poster

...for some reason it is not reflected in the url

ajax requests do NOT change the url that is currently loaded/displayed in the address bar. The requests occurs "in the background". Hence the url in address bar remains unchanged. IF it did so, then the whole page/window would reload, which defeats the purpose of ajax.

hielo 65 Veteran Poster

The name of a database, table and/or field/column, needs to be enclosed in backticks (`), NOT apostrophes('). You incorrectly used apostrophes. Try:
$select_query="SELECT * FROM `deed_records` WHERE `".$_REQUEST."`='".$_REQUEST."' ";

Also, use [B]... or die( mysql_error() );[/B] whenever you execute a query so you get details about the error (if any).
try:

<html>
<head><title>Showing Results</title></head>
<body bgcolor="#666666">
<?php
include_once "connection.php";
//$clmname=stripslashes(trim($_POST['select']));
//$txtvalue=stripslashes(trim($_POST['value']));
//$txtvalue=$_REQUEST['value'];
$select_query=sprintf("SELECT * FROM `deed_records` WHERE `%s`='%s'"
                        , mysql_real_escape_string($_REQUEST['select'])
                        , mysql_real_escape_string($_REQUEST['value'])
                );

$list=mysql_query($select_query) or die( sprintf('Unable to execute query:<br />%s<br />%s',$select_query, mysql_error() ) );
if( 0==mysql_num_rows($list) )
{
    echo '<p>No records found</p>';
}
else
{
    echo "<table border='1'>
    <tr>
    <th>Index</th>
    <th>Name of Owner</th>
    <th>S/D/H Of Owner</th>
    <th>Address of Owner</th>
    <th>Name of Vendor</th>
    <th>Deed No</th>
    <th>Reg Date</th>
    <th>Rack No</th>
    <th>Due Rs.</th>
    <th>Delivery Date</th>
    </tr>";
    while($record=mysql_fetch_assoc($list))
    {
        echo PHP_EOL."<tr>
        <td>".$record['index']."</td>
        <td>".$record['name_of_owner']."</td>
        <td>".$record['sdh_of_owner']."</td>
        <td>".$record['address_of_owner']."</td>
        <td>".$record['name_of_vendor']."</td>
        <td>".$record['deed_no']."</td>
        <td>".$record['date']."</td>
        <td>".$record['no']."</td>
        <td>".$record['due_rs']."</td>
        <td>".$record['delivery_date']."</td>
        <td>
        </tr>";
    }
}
mysql_close($connect);
?>
</body>
</html>
hielo 65 Veteran Poster

try using urlencode() , NOT htmlentities() .

hielo 65 Veteran Poster

assuming that allSelect is meant to be an array of references to all the SELECT elements, then you should be explicitly selecting/getting only the SELECT elements:

...
function init() {

  allSelect = document.getElementsByTagName("SELECT");
...
}

as for your loadLinks, try the following to see if you get the expected/selected value.

function loadLinks()
{
 if( this.selectedIndex > -1 )
  alert( this.options[this.selectedIndex].value )
 else
  alert('Nothing selected')
}

If you are still having problems, then post your updated code.

hielo 65 Veteran Poster

when you use var BEFORE your variable, it make that variable "private". In other words, it will NOT be visible outside your function. Thus, the variable allSelect in line 4 is NOT the same as the one in line 8. The allSelect variable declared in line 8 exists ONLY WITHIN that function. As soon as init() finishes executing, that variable is NOT accessible from outside. So, on line 8 you need to get rid of "var" so that your function populates the global variable (on line 4).

Also, line 16 is NOT correct. Why? Because init() will be called onload. In other words, WHILE the page is still loading, lines 7-14 will be ignored. The javascript interpreter will then try to execute line 16, but allSelect is still NOT an array. There isn't even a variable named i because:
a. i exists only within init() since it is declared with var b. even if you were to get rid of var , init() has NOT executed yet!

So you need to execute that line WITHIN the for loop in the init() function.

hielo 65 Veteran Poster

Glad to help!

Regards,
Hielo

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

hielo 65 Veteran Poster

give them the SAME name ( name='date' ), but different values. Then $_GET['date'] will give you the date of the button that was clicked.

hielo 65 Veteran Poster

var lis=zxcul.getElementsByTagName('LI')[b];[/b] + ByID the PLUS symbol is meant to "join" the "stuff" on the left with the "stuff" on the right, so get RID of the semicolon to the left of the PLUS symbol.

hielo 65 Veteran Poster

try:

function CngClass(){
    var zxcevt=window.event||arguments.callee.caller.arguments[0];
    var zxcobj=window.event?zxcevt.srcElement:zxcevt.target;
    while (zxcobj.parentNode){
        if (zxcobj.nodeName=='LI') 
            break;
        zxcobj=zxcobj.parentNode;
    }
    if (zxcobj.nodeName!='LI') 
        return;

    var zxcul=zxcobj.parentNode;
    var lis=zxcul.getElementsByTagName('LI');
    for (var z0=0;z0<lis.length;z0++){
        lis[z0].className=lis[z0]!=zxcobj?'off':'on';
        if( lis[z0].className=='on')
          lis[z0].id='change';
        else
          lis[z0].id='';
    }
}
hielo 65 Veteran Poster

Are ALL of those db fields NUMERIC data types?
If you are inserting text, you need apostrophes around the value. If you are inserting a NUMBER then do not put apostrophes around the value - ex:

INSERT INTO Person(email,age) VALUES('john@company.com',23)
hielo 65 Veteran Poster

try pasting it between lines 16 and 17

hielo 65 Veteran Poster

instead of $pct_data = new pie_value(...); you need $pct_data[B][][/B] = new pie_value(...);

hielo 65 Veteran Poster

all you need is:

var LI = document.getElementById('change');
if( LI )
{ //you located an element with id='change'
  LI.className='someOtherClassNameHere';
}
else
{
//no element contains id="change"
}
hielo 65 Veteran Poster

Currently you have TWO open <form> tags. Get rid of the first one and instead
put the <FORM> around the <table> and give your form an id="Add_Record" :

<html>
<head>
<!-- <link rel="stylesheet" media="screen" href="DynCalendar/dynCalendar.css" />
<script language="javascript" type="text/javascript" src="DynCalendar/browserSniffer.js"></script>
<script language="javascript" type="text/javascript" src="DynCalendar/dynCalendar.js"></script>
 -->
<link rel="stylesheet" media="screen" href="http://www.phpguru.org/css/dynCalendar.css" />
<script language="javascript" type="text/javascript" src="http://www.phpguru.org/javascript/sniffer.js"></script>
<script language="javascript" type="text/javascript" src="http://www.phpguru.org/javascript/dynCalendar.js"></script>
</head>
<body>

<form id="Add_Record" action="insert.php" method="POST">

<table width="703" height="210" border="1" cellpadding="5" cellspacing="0">
  <tr>
    <td width="535">
      <p class="Headings"><strong>Add a Record</strong>      </p>
    <p>First Name:
        <input type="text" size="20" maxlength="20"name="firstname" />
        Last Name:
        <input type="text" size="20" maxlength="20" name="lastname" />
  </p>
      <p>Days Used:
        <input type="int" size="3" maxlength="3"name="DaysUsed" /> 
        Hours Used:
        <input type="int" size="4" maxlength="4"name="HoursUsed" />
       Leave Type:
        <select name="type">
          <option value="0"> </option>
          <option value="Sick">Sick</option>
          <option value="Vacation">Vacation</option>
          <option value="Business">Business</option>
          <option value="Funeral">Funeral</option>
          <option value="Other">Other</option>
          <option value="Errand">Errand</option>
        </select>
      </p>
      Start Date:
      <input type="text" name="StartDate">
    <script language="JavaScript" type="text/javascript">
    <!--
    /**
    * Example callback function
    */
    function exampleCallback_ISO1(date, month, year)
    {
        if (String(month).length == 1) {
            month = '0' + month;
        }
    
        if (String(date).length == 1) {
            date = '0' + date;
        }    
        document.forms['Add_Record'].StartDate.value = month + '/' + date + '/' + year;
    }
    calendar1 = new dynCalendar('calendar1', 'exampleCallback_ISO1');
    calendar1.setMonthCombo(true);
    calendar1.setYearCombo(true);
    //-->
    </script>
     
        End Date:
       <input type="text" name="EndDate">
    <script language="JavaScript" type="text/javascript">
    <!--
    /**
    * Example callback function
    */
    function exampleCallback_ISO2(date, month, year)
    {
        if (String(month).length == 1) {
            month = '0' + month;
        }
    
        if (String(date).length == 1) {
            date = '0' + date;
        }    
        document.forms['Add_Record'].EndDate.value = month + '/' + date + …
hielo 65 Veteran Poster
<HEAD>
   <script type="text/javascript">  
     
   function toggleElement(sel1, element1) {  
     
     element1 = document.frm1.elements[element1];  
     //alert(element1.value);  
     if (sel1.value == 'others') {  
     
       element1.style.display = 'inline';  
   
    }  
     else {  
     element1.value = ''; // input text will be empty  
       element1.style.display = 'none'; // hide text element  
     }  
     
     return;  
  }  
  
  window.onload=function(){
      toggleElement(document.getElementById('city'), 'txt1')
  }
 </script>  
</HEAD>


<BODY>
   <form name="frm1" >  
     
   <select name="city" id="city" onchange="toggleElement(this, 'txt1')">  
    <option value="patna">Choose Payment</option>  
    <option value="mumbai">Credit Card</option>  
    <option value="others" selected="selected">Others</option>  
   </select>  
   <input type="text" name="txt1" id="txt1" value="" /> any text  
      
   </form>  

</body>
FreddieBambino commented: Very helpful comment he made to me about Javascript +1
hielo 65 Veteran Poster
<?php 
if($logged_in) { 
  echo "Welcome back, $logged_row[username]&nbsp"; 
 ?>
<a href="<?= $_SERVER["REQUEST_URI"] . '&amp;action=logout' ?>"><?= $lang['ACC_LOGOUT'] ?></a>
<?php
} 
else {
 print('<a href="http://xxx/login.html">Login</a> / <a href="http://xxx.com/signup.html">Signup</a>');
} 
?>
hielo 65 Veteran Poster

Glad to help.

Regards,
Hielo

hielo 65 Veteran Poster

I can go to your site now and attempt to request /Nathaniel10.php and you WILL find a reference to it in your log file. However, that does not mean that I "uploaded" said file to your server. It merely indicates that I "tried" to access a file named "Nathaniel10.php" (regardless of whether it exists or not).

You need to look at the status of the request. If the server returned 404, then it indicates that the server did not found that file and the requestor got a "404 - File not found" error message.

hielo 65 Veteran Poster
<input id="txtstext" class="t-box" name="txtstext" type="text" value="<?php echo htmlentities($_GET['var'],ENT_QUOTES); ?>" style="width:100px">
hielo 65 Veteran Poster

you cannot use myslq_real_escape_string() UNLESS you are connected to your DB first. Did you?

WRONG:

<?php
$username=mysql_real_escape_string($_POST['username']);
$password=mysql_real_escape_string($_POST['password']);

mysql_connect(...) or die( mysql_error() );
mysql_select_db(...) or die( mysql_error() );
mysql_query("SELECT * FROM Person WHERE username='$username' AND password='$password'" ) or die( mysql_error() );
?>

CORRECT:

<?php

mysql_connect(...) or die( mysql_error() );
mysql_select_db(...) or die( mysql_error() );

$username=mysql_real_escape_string($_POST['username']);
$password=mysql_real_escape_string($_POST['password']);

mysql_query("SELECT * FROM Person WHERE username='$username' AND password='$password'" ) or die( mysql_error() );
?>
hielo 65 Veteran Poster

it seems to work fine for me:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">

function isAlphabet(elem, helperMsg){
    var alphaExp = /[a-z]+/i;
    var nums=/\d+/;
    var alnum=/^[a-z\d]+$/i;
    if(elem.value.match(alnum) && elem.value.match(alphaExp) && elem.value.match(nums) ){
        return true;
    }else{
        alert(helperMsg);
        setTimeout(function(){elem.focus();},20);
    return false;
    }
}
</script>
<input type="text" id="Username" name="username" onchange="isAlphabet(this, this.id+' is not valid. It must contain at least one letter and one number') "/>
</body>
</html>
hielo 65 Veteran Poster

try:

<script type="text/javascript">
function goToAnchor() {
location.href = <?php echo sprintf('"display_tattoos_2009.php?in=%s#placeholder%s";', $imagenum, $imagenum); ?>
}
</script>
hielo 65 Veteran Poster

try:

function isAlphabet(elem, helperMsg){
    var alphaExp = /[a-z]+/i;
    var nums=/\d+/;
    var alnum=/^[a-z\d]+$/i;
    if(elem.value.match(alnum) && elem.value.match(alphaExp) && elem.value.match(nums) ){
        return true;
    }else{
        alert(helperMsg);
        setTimeout(function(){elem.focus();},20);
    return false;
    }
}
hielo 65 Veteran Poster
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http:/www.w3.org/TR/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type"
content="text/html; charset=iso-8859-1" />
<title> Oefeningen 3 week 1</title>
</head>
<body>


<table border="1">
    <tr>
        <th>Fahrenheit</th>
        <th>Celsius</th>
    </tr>
    <?php
    $Tf = 32 ;
    $Tc = 0.00;
    
    while( $Tc < 100.01)
    {
    ?>
    
    <tr>
        <td> <?php echo $Tf; ?>   </td>
        <td> <?php echo $Tc; ?>    </td>
    </tr>
    
    <?
        $Tf= $Tf + 15;
        $Tc= ($Tf-32)*(5/9);    
    }
    ?>
</table>
</body>
</html>
hielo 65 Veteran Poster

instead of:

var dropInsertBeforeElement = createElement("<div id='drop_insert_before_" + this.id + "' style='height:6px; width:" + totalWidth + "px;'>");

try:

var dropInsertBeforeElement = document.createElement("div");
dropInsertBeforeElement.id='drop_insert_before_' + this.id;
dropInsertBeforeElement.style.height='6px';
dropInsertBeforeElement.style.width= totalWidth + 'px';
hielo 65 Veteran Poster

apart from whether the extra is free or not, it just enters 0 into each column.

which input element determines this? What html markup is your script generating? It would be easier to understand the problem is you post a link to your page.