
kwstephenchan
Members-
Posts
64 -
Joined
-
Last visited
Everything posted by kwstephenchan
-
Hi All, I encountered this "undefined index" error from the following code: for ($i=0;$i<sizeof($arr);$i++) { ?> <tr> <td width='25%'></td> <td width='75%' class='intxt' align='left'> <input type="checkbox" name="box[]" value="<?php echo $darr[$i];?>"><?php echo $narr[$i]; ?></td> </tr> <?php } // closing for loop ?> // when I try to retrieve the value using $_POST['box'], I got the undefined error for ($i=0;$i<count($_POST['box']);$i++) { } Can someone please tell me what have I done wrong? Thanks.
-
Hi all, I am new to Ajax. just wonder if the following can be implemented using Ajax: The first PHP calls ajax and ajax call another php. User then picks a selection (with html and user interaction) and the selection is sent back to the first php via ajax without reloading the first page and losing everything that the user has entered. I have tried php calling ajax and ajax calls another php and returns a value back to the first php. It works. The difference is that this second php does not have a user interface, it is just searchiing database for value. If this cannot be implemented, I might as well give up on this approach. Please advise. Thanks.
-
Hi all. I intend to have an input field in PHP program 1. Besides this input field, I have a button so that the user can search for value to be used instead of inputing. On pressing this button, another php program, say program 2 will be called. Program 2 will go to the database and list the values for selection. The user can then select and the selected value will be passed back to program 1 (without refreshing other fields in program 1) Can anyone advise how this can be done? I tried using Ajax, but it does not seem to be doing the trick, wonder what have I done wrong. Thanks Followings are the code bit: ***** javascript definition **** <script type="text/javascript"> var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp"); } function getData(srcPHP, parm) { var url = srcPHP+"?parm=" + parm; if(XMLHttpRequestObject) { XMLHttpRequestObject.open("GET", url, true); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { eval(XMLHttpRequestObject.responseText); } } XMLHttpRequestObject.send(null); } } function alerter(divID,pvalue) { alert(' back toJavaScript'); var showDiv = document.getElementById(divID); showDiv.innerHTML = pvalue; } </script> **** parts of program calling the Javascript **** <tr valign="baseline"> <div width="40%" height="20" align="right" class="lbtxt">Owner : </div> <div height="20" class="intxt"> <input name="m_ownerid" type="text" id="m_ownerid" size="4"> <font color="#ffffff"><?php $divID="m_ownerid"; $srcData="data.php"; $str="<img src='images/moredot.gif'>"; echo '<a href=javascript:getData(\''.$srcData.'\',\''.$divID.'\') >'.$str.'</a>'; ?>*</font></div> </tr> ***** code content in data.php **** <?php $parm = $_GET['parm']; $pvalue="passing value"; echo 'alerter(\''.$parm.'\',\''.$pvalue.'\')'; // echo '<a href=javascript:getData(\''.$srcData.'\',\''.$divID.'\') >'.$str.'</a>'; ?> <?php /* <html> <body> <table> <tr> <td> this is the html part </td> </tr> </table> </body> </html> */ ?> As noted, I have commented out the html part because if I leave them in, I'll get page error. As I am new to Ajax, wonder if it is true that the second PHP program cannot have HTML in it. Thanks for all the help.
-
Hi all. I intend to have an input field in PHP program 1. Besides this input field, I have a button so that the user can search for value to be used instead of inputing. On pressing this button, another php program, say program 2 will be called. Program 2 will go to the database and list the values for selection. The user can then select and the selected value will be passed back to program 1 (without refreshing other fields in program 1) Can anyone advise how this can be done? I tried using Ajax, but it does not seem to be doing the trick, wonder what have I done wrong. Thanks.
-
[SOLVED] Internet Explorer download error in executing FPDF
kwstephenchan replied to kwstephenchan's topic in PHP Coding Help
By the way, I use IE 6.0 SP3, if that has anything to do with it. Thanks. -
Hi all, I got this error message "Internet Explorer cannot download" when executing a very simple FPDF (a Hello World ! FPDF). I used Apache, Window XP. Has anyone encountered similar and the way to solve this?? I searched for "internet explorer cannot download" and is advised to : "Do Not Save Encrypted Files check box is not checked and that the server does not send the "Cache-Control: No Store" or the "Cache-Control: No Cache" header." I checked my browser and the said checkbox is not checked and I do not use cache-control in my PHP program. Could someone advise what I should do?? - editing Apache or what?? Thanks, KW
-
Hi all, I am new to FPDF and the following is a starter FPDF script but it does not work and I have no clue. $pdf=new FPDF(); $pdf->SetTitle('Project Plan'); $pdf->SetFont('Helvetica','B',20); $pdf->SetTextColor(50,60,100); $pdf->AddPage('P'); $pdf->SetDisplayMode(real,'default'); $pdf->SetXY(50,20); $pdf->SetDrawColor(50,50,100); $pdf->Cell(100,10,'Installation Plan',1,0,'C',0); $pdf->SetXY(10,50); $pdf->SetFontSize(10); $pdf->Write(5,'Congradulations! You have generated a PDF. '); $pdf->Output('example1.pdf','I'); When I execute this php, I got error from IE as followiL Internet Explorer cannot download rptproj02.php from localhost. Internet Explorer cannot find site and something like that. What I have done was to download FPDF, extract it and place the FPDF.php in my project directory (including some font file), was there something else that I should do ?? Please help. KW
-
Thanks. However, what I want to achieve is that as soon as the user has selected an end date, the comparison will take place but I do not know where I can insert such comparison. I tried on focus, on blur, on change and so on but the trigger of these event will require user to actually input something or to set the cursor to the field even though a date has been selected. What I want is to tell the user a wrong date has been selected if the end date is earlier than the start date. Thanks!
-
<tr valign="baseline"> <td width="200" height="20" align="right" class="lbtxt">Estimated Start : </td> <td height="20" class="intxt"> <input name="m_eststart" type="date" id="m_eststart" class="datechooser dc-dateformat='Y-m-d' dc-iconlink='images/datechooser.png'" size="10"> <font color="#5da845"> </font><br> </tr> <tr valign="baseline"> <td width="200" height="20" align="right" class="lbtxt">Estimated End : </td> <td height="20" class="intxt"> <input name="m_estend" type="date" id="m_estend" class="datechooser dc-dateformat='Y-m-d' dc-iconlink='images/datechooser.png'" size="10"> <font color="#5da845"> </font><br> </tr> datechooser is an Ajax function that I got from www.yellow.us. After I have picked a date, the selected date will be placed with the date format specified. But I cannot compare these two dates, so if user picks an end date which is earlier than start date, I can only check after the form is submitted. I thus need to refresh the screen and defeating the purpose of Ajax. Thanks.
-
Hi Everyone, I got an ajax code bit (using AJax) for a popup calendar to be used in my website. There is a start date and an end date. Both dates are selected from this popup calendar, as such, I cannot use onfocus, onblur, onchange and so on as the field was not input by user. The date is picked and placed into these two fields. But I want to compare the two dates so that the end date is not supposed to be earlier than the start date. Anyone got any idea how the comparison can be accomplished. Thanks!
-
language conversion problem in PHP ??
kwstephenchan replied to kwstephenchan's topic in PHP Coding Help
Thanks. -
language conversion problem in PHP ??
kwstephenchan replied to kwstephenchan's topic in PHP Coding Help
I checked my php.ini file both in the php directory and in the Apache directory. Found that mbstring was set to Japanese (don't ask me why, I did not do it) and internal charset set to EUC-JP. I modified these two setting to Chinese and EUC-CN (again in both directory) and when I invoked the same page again in DW, I got HTTP 500 (page cannot be displayed). After I copied the original php.ini file back, restart again, I still can't get the page to display. Any idea?? Appreciate if you could email me the code including the meta tag, my email address is [email protected]. Thanks. -
language conversion problem in PHP ??
kwstephenchan replied to kwstephenchan's topic in PHP Coding Help
Is this a PHP problem or Apache?? I have defined the default charset in Apache as gb2312 which is for Chinese character. Is there anyway in PHP or Apache setting that I can check for collation?? Thanks. -
Hi, when I enter a Chinese name in PHP, it returns Incorrect string value: '\xC2\xED\xC8\xD9' for column 'm_name' at row 1. But if I enter the same Chinese character using phpMyAdmin, it was okay and the value stored for the same Chinese character is 马荣 This is an old program and it worked fine all along. But after I reinstall Apache, PHP, MySql, I started having this problem. But if I import (except for this field) other data with Chinese character into the new database, there was no problem. This field m_name has a varchar size of 20. I don't know what's wrong with it. Can anyone help?? Thanks.
-
dreamweaver and php
kwstephenchan replied to kwstephenchan's topic in Editor Help (PhpStorm, VS Code, etc)
Bingo!, it works! Thanks a million! -
dreamweaver and php
kwstephenchan replied to kwstephenchan's topic in Editor Help (PhpStorm, VS Code, etc)
My Dreamweaver version is MX2004, suspect that MX2004 is not capable to handle PHP5, does anyone know. Do I need Dreamweaver CS3 to handle PHP5 programs?? Thanks. -
dreamweaver and php
kwstephenchan replied to kwstephenchan's topic in Editor Help (PhpStorm, VS Code, etc)
I used to have a site set up and it works fine without such server as mentioned. But after I re-installed Apache, PHP, and MySql again, I got this problem. I suspected that there may be something that I should do either in Apache or PHP but haven't but I do not know where and what. -
Hello all, It sounds stupid, but when I test the following php code using Dreamweaver (F12), it returns exactly the same code. But if it is a htm file, F12 returns what I want. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>無標題文件</title> </head> this is a php page <?php this is a message enclosed in php tags ?> <body> </body> </html> And this is what I get using Dreamweaver F12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>無標題文件</title> </head> this is a php page <?php this is a message enclosed in php tags ?> <body> </body> </html> Is there some setting I missed in PHP or in Dreamweaver?? Please help!
-
When I go to http://localhost/ , it returns a message "it works". So I assume Apache has been properly set up. I'll try to re-install phpMyAdmin to see what happen. Thanks.
-
Thanks Dave, But I checked for the directoryindex tag in the config file of Apache, it looks something like this: DirectoryIndex index.html index.html.var index.php index.htm It is not exactly what you have with the <IfModule dir_module> </IfModule> though. Is it different?? Cheers, Stephen
-
Apache - 2.28 MySql 5.0.51 PHP 5.2.5 phpMyAdmin 2.6.0 apache documentroot = "c:/att/wwwroot" copied phpmyadmin files under the document root c:/att/wwwroot/phpmyadmin have adjusted phpmyadmin config.ini uri to :$cfg['pmaAbsoluteUri']='http://localhost/phpMyAdmin/'; but when invoked on IE http://localhost/phpMyAdmin, I got Http 404 page not found Can someone tell me what have I done wrong. By the way, when I download phpMyAdmin 2.22.4, I could not find config.ini, all I found was config,sample.ini and this sample.ini file does not have the above "absoluteUri" command, have I missed something?? Thanks.
-
Thanks. I am looking forward to the new look.
-
when I visited this site, I was directed to forum right away. But I used to be able to select Tutorial section where I can find some useful tutorials. Has it been removed?? Thanks. kwstephenchan
-
Hi Folks, I got this error message "illogical mix of collation (gb2312_chinese_ci, implicit) and (latin_swedish_ci, coercible) for operator "=". It is a new table and there is no data in this table yet. I have read answers regarding collation and suggestion was to alter table. Since this is a new table and no data in it, will alter table be applicable?? If it still is, what should I do in altering the table?? Could it be the configuration that I should change (from default set up)?? Could someone help?? Cheers Kwstephenchan