Re: [PHP] cookies and clocks
look at it this way: you are dealing with an INTERVAL of time, thus the only reason you really need javascript is in the construction of a date object. you can either import that object into php as a string, or you can actually go the extra mile and set the cookie in javascript. HTH, DanO Mark Maggelet [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a cookie that times out after an hour for security reasons. About 1 out of 200 of my users send me an email saying they can't log into my site and I find out that it's usually because their clocks are off. Has anyone had any luck using the time on the client to set cookies by instead of server time? I hate using javascript for this but I don't see much choice. thanks, - Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTML and PHP?
try this: ? print EOP html jldsfajlf;dsajfl;dkfl;dsa /html EOP; ? AFAIK it is the easiest way to do multi-line printing! DanO ""Jason Caldwell"" [EMAIL PROTECTED] wrote in message 9b868e$2ca$[EMAIL PROTECTED]">news:9b868e$2ca$[EMAIL PROTECTED]... Is there a utility that I can use that will take a bunch of HTML and encapsulate it in the PRINT command? i.e. PRINT("{html stuff}\n"); ?? I have a ton of HTML pages that I want to make dynamic, but dread having to type the PRINT command in front of every line of html, and let alone having at manually add the slashes... urg. Thanks. Jason [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] while loop and modulus?
by default, HTML browsers, according to spec, will handle the rendering of any and all empty cells at the end of a row. even netscape ;) so, this is technically not a bug. my question is how it works when you have 7 photos in a row, or 4? DanO -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 27, 2001 11:18 AM To: [EMAIL PROTECTED] Subject: [PHP] while loop and modulus? OK, using this code: ? echo "table border=\"0\"\n"; echo "tr\n"; $photocount = 0; while($row = mysql_fetch_array($result)) { $smallpic = $row['smallpic']; echo "td$smallpic/td\n"; if (($photocount % 3) == 2) { echo "/tr\ntr\n"; } $photocount++; } echo "/tr\n"; echo "/table"; ? And 8 photos in the table, I'm getting this output: table border="0" tr tdsm982438092.gif/td tdsm982437452.gif/td tdsm982439016.gif/td /tr tr tdsm982529915.gif/td tdsm983222652.gif/td tdsm983222686.gif/td /tr tr tdsm983222868.gif/td tdsm983222919.gif/td /tr /table Great, except it's missing an end cell, and after a few hours fiddling about with code last night, I still didn't get any further in working out how I was going to echo a table cell even if data's missing. So, any help would be appreciated. Apologies for what're probably "easy" questions. I slog away at work all day, come back hoping to get something productive done on this, and the ol'brain won't take it. Frustrating, to say the least. James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How to make text BOLD
the problem is obvious: you are trying to send HTML in a plain text email. see : http://www.php.net/manual/en/function.mail.php i would actually recommend that you DO NOT send HTML email and leave it in plain text. DanO -Original Message- From: Nguyen, David M [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 7:55 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] How to make text BOLD Below is my script and the output I got, I want DATE and EQUIPMENT TO BE BOLD: $message = "The following Webpage is added or updated:\n\nBDate:/B $date\nBEquipment:/B $equipment\nTopic: $topic\nURL: $url"; mail( $to, $subject, $message, $mail_header ) or print "Could not send mail"; print ("HTML\n"); print ("HEAD\n"); print ("TITLE$title/TITLE\n"); print ("/HEAD\n"); print ("BODY BACKGROUND=\"images/bkgrnd.jpg\" bgcolor=\"#FF\"\n"); SEE what I got from output: BDate:/B Fri, February 2001 - 09:50:38 BEquipment:/B General Please advise how to fix it. Thanks, David -Original Message- From: Hoover, Josh [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 9:35 AM To: Nguyen, David M; [EMAIL PROTECTED] Subject: RE: [PHP] How to make text BOLD Could you send an example of how you're using the bold/strong tags in your PHP code? If we see it, we can probably help you out better :) Josh Hoover KnowledgeStorm, Inc. Searching for a new IT solution for your company? Need to improve your product marketing? Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify the process for you. KnowledgeStorm - Your IT Search Starts Here I want to make my text BOLD using either STRONG/STRONG or B/B but it did not work with PHP. Can someone please advise why not or if there is another way to do it. Thanks, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How to make text BOLD
a tip: you'll have to apply the style to both ul and li to make it work in microscape. DanO -Original Message- From: Brian V Bonini [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 8:23 AM To: Nguyen, David M Cc: PHP Lists Subject: RE: [PHP] How to make text BOLD How about: STYLE type="text/css" li.bold {font-weight: bold;} /STYLE p The following Webpage is added or updated: ul li class="bold"DATE: ?= $date ?/li li class="bold"Equipment: ?= $equipment ?/li liTopic: ?= $topic ?/li liURL: ?= $url ?/li /ul /p or p The following Webpage is added or updated: ul libDATE:/b ?= $date ?/li libEquipment:/b ?= $equipment ?/li liTopic: ?= $topic ?/li liURL: ?= $url ?/li /ul /p -Original Message- From: Nguyen, David M [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 10:55 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] How to make text BOLD Below is my script and the output I got, I want DATE and EQUIPMENT TO BE BOLD: $message = "The following Webpage is added or updated:\n\nBDate:/B $date\nBEquipment:/B $equipment\nTopic: $topic\nURL: $url"; mail( $to, $subject, $message, $mail_header ) or print "Could not send mail"; print ("HTML\n"); print ("HEAD\n"); print ("TITLE$title/TITLE\n"); print ("/HEAD\n"); print ("BODY BACKGROUND=\"images/bkgrnd.jpg\" bgcolor=\"#FF\"\n"); SEE what I got from output: BDate:/B Fri, February 2001 - 09:50:38 BEquipment:/B General Please advise how to fix it. Thanks, David -Original Message- From: Hoover, Josh [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 9:35 AM To: Nguyen, David M; [EMAIL PROTECTED] Subject: RE: [PHP] How to make text BOLD Could you send an example of how you're using the bold/strong tags in your PHP code? If we see it, we can probably help you out better :) Josh Hoover KnowledgeStorm, Inc. Searching for a new IT solution for your company? Need to improve your product marketing? Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify the process for you. KnowledgeStorm - Your IT Search Starts Here I want to make my text BOLD using either STRONG/STRONG or B/B but it did not work with PHP. Can someone please advise why not or if there is another way to do it. Thanks, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] using tar to untar a file into a certain dir... In php of course
have you tried: mv mytar.tar /my/path/to/dir/; tar -xpf /my/path/to/dir/mytar.tar this should work, but there may be a more direct unix-y way to do it. DanO -Original Message- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:49 PM To: PHP User Group Subject: [PHP] using tar to untar a file into a certain dir... In php of course Hello, I am making a php file that untars files. What I can't seem to figure out is how to untar a file into another folder. I have tried: tar -xpf file.tar /new/folder/* and tar -xpf file.tar /new/folder/ does anyone know how to do this? Thank you, Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Specific PHP/JSP questions
see: http://www.php.net/manual/en/function.header.php it works just like JSP. DanO -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:01 PM To: Gerald Gutierrez; [EMAIL PROTECTED] Subject: Re: [PHP] Specific PHP/JSP questions Addressed to: Gerald Gutierrez [EMAIL PROTECTED] [EMAIL PROTECTED] ** Reply to note from Gerald Gutierrez [EMAIL PROTECTED] Thu, 15 Feb 2001 01:04:30 -0800 2) In JSPs, it is possible to do server-side page redirection, i.e. "forward" a request from page A to page B, as if the user actually requested page B. There is no browser involvement in the redirection; it is complete on the server. In this scenario, there are two "page scopes", and one "request scope". How is this server-side redirection done in PHP? You might do something like: pageA.php - ? if( user_realy_wants_page_b ) { include( 'pageb.php' ); exit; } ? Page A starts here... - That all happens on the server, and does not require anything outside of page A to implement. 3) In doing the server-side page redirection, variables can be added to a "request" object, which embodies parameters related to a request. Page A can add variables to the request object (perhaps values from an SQL select), which page B can then retrieve and display. How is this done in PHP? In the example above, any variables set in page A will be visible in page B when it is included. The values must be set BEFORE the include() is hit. 5) On a JSP site, I typically arrange things such that a particular JSP (or servlet) accepts requests, processes them and then forwards them to one of a number of different pages, depending on the outcome of the processing. This is in contrast to the alternative approach where one simply goes to a page, which does some processing and then displays the contents of the requested page. What is the typical way to achieving this "funnel all requests to a single point and have it forward the correct response to the user" paradigm? ? switch ( $Desired_Action ) { case 'PageA' : include( 'pagea.php' ); break; case 'PageB' : include( 'pageb.php' ); break; case 'PageC' : include( 'pagec.php' ); break; default: include( 'defailt.php' ); break; } would be one possibility. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] using tar to untar a file into a certain dir... In php of course
good point. i should think before i post. here is another go: ? chdir("destination"); system("tar -xpf /some/path/to/mytar.tar"); ? i can't test this as i am on a windows box at the moment, but i think you can get the gist of it. change the working directory of php and then extract from another file. DanO -Original Message- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:16 PM To: PHP User Group Subject: FW: [PHP] using tar to untar a file into a certain dir... In php of course From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:07 PM To: DanO Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course That just untars it into the current dir the php script is in. -Original Message- From: DanO [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:58 PM To: PHP User Group Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course have you tried: mv mytar.tar /my/path/to/dir/; tar -xpf /my/path/to/dir/mytar.tar this should work, but there may be a more direct unix-y way to do it. DanO -Original Message- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:49 PM To: PHP User Group Subject: [PHP] using tar to untar a file into a certain dir... In php of course Hello, I am making a php file that untars files. What I can't seem to figure out is how to untar a file into another folder. I have tried: tar -xpf file.tar /new/folder/* and tar -xpf file.tar /new/folder/ does anyone know how to do this? Thank you, Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] CORBA?
how is this type of comment on a mailing list productive? DanO -Original Message- From: Gerald Gutierrez [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 3:26 PM To: Jonathan Sharp; [EMAIL PROTECTED] Subject: Re: [PHP] CORBA? At 02:49 PM 2/16/2001 -0800, Jonathan Sharp wrote: I've seen mentions of CORBA before and skimmed a book at the local bn, but what exactly is it? Is it programming standards? A seperate language all together? (something like COM?) Thanks, -Jonathan Sharp Technology Director Imprev, Inc. http://imprev.com CORBA is a distributed object standard. You say you're a technology director? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] javascript in PHP statement
note that javascript and PHP CANNOT interact natively on the same page...one is client side and one is server side. you can pass variables between the two in an HTTP request, however. page1.php: script type=javascript function makeSqlQuery(businesstype,village) { var sqlQuery; sqlQuery = "SELECT * FROM MAIN WHERE BUSINESSTYPE=" + businesstype + " AND VILLAGE=" + village location = "php2.php?sqlQuery=" + sqlQuery; } /script form name=thisform select name=businesstype /select select name=village /select input type=button onclick="makeSqlQuery(thisform.businesstype,thisform.village)" /form -- this is a silly way to do it, however, and you should just pass the variables themselves and construct and run the query in a new request using php. you use the same page with control structures on it. DanO -Original Message- From: Michael Hall [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 15, 2001 12:06 PM To: Matt Davis Cc: [EMAIL PROTECTED] Subject: Re: [PHP] javascript in PHP statement I am new to php and I am wondering if it is possible to use a javascript variable in a php statement for example: // create sql statement $sql = "select * from main where businesstype = "consultancy" and top.upper.villagename = != "0";"; As far as I know, no. Unless "top.upper.villagename" is a field in your database and the rest is that field's contents (couldn't be ... too many unescaped double quotes and semicolons). Nope, SQL statements don't work like that and can only refer directly to data in a database, not php or any other variables. You might consider using if statements something like this: if ($top.upper.villagename != '0') { $sql = "SELECT * FROM main WHERE business = 'consultancy'"; } Hope this helps Mick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Dynamic Drop-down list
the 'SELECTED' attribute will select an item in a dropdown list. by default, with no SELECTED attribute, the first item will be shown and selected. make sense? DanO -Original Message- From: Todd Cary [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 08, 2001 5:00 PM To: [EMAIL PROTECTED] Subject: [PHP] Dynamic Drop-down list I create a Drop-down from a DB table. All works as expected *except* the default item (the one showing to the surfer) is the last in the list. Is there a way I can have the first item show? Todd /* Make a drop-down */ function make_dropdown($ddName, $itemList, $first) { if (count($itemList)) { echo("SELECT NAME=" . $ddName . ""); if ($first) { echo('OPTION VALUE="**" SELECTED' . $first); }; while (list ($key, $val) = each ($itemList)) { echo('OPTION VALUE="' . $key . '" SELECTED' . $val); }; echo("/SELECT"); }; }; -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Error with Cookies and SSI
sounds like your php script cannot write to the header, which means you'll have to set cookies (gasp!) client-side. there are some handy javascript cookie libraries that can make this much easier on you. such as: http://hotwired.lycos.com/webmonkey/javascript/code_library/wm_ckie_lib/ fear not the javascript. it is your friend. DanO -Original Message- From: Ben Wiechman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 06, 2001 12:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Error with Cookies and SSI I am having a problem getting a php script to read a cookie that should be set. I have to incorporate the output of a php script into an existing page that uses SSI to do a virtual include of my php script. i.e. !--#include virtual="script.php" -- Problem is, when I do this, the script does not set the cookie variables. If I just run the script the cookies are set, and read, correctly, but when I include the PHP script with the SSI call it does not read the cookie variables for some reason. Does anyone know a work-around for this? And using a std php script is not an option, I need a way to get this to work using SSI. Any help would be greatly appreciated. Thanks in advance, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Profanity Filter
why use a DB? just create an array of dirty words then loop your input thru it with a regex. DanO -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, January 19, 2001 11:09 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Profanity Filter In a message dated 19/01/2001 19:03:13 GMT Standard Time, [EMAIL PROTECTED] writes: Use a database for the words and say "SELECT 1 WHERE LOWERCASE('$name') LIKE '%'+word+'%'" and count how many rows are returned. No need to re-invent the wheel. -- Ignacio Vazquez-Abrams Yeah problem is he has no database support from his host Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] question (as if anything else would be in an email to the list...)
just write a js function like: --cut here-- script !-- function changeValue(newValue) { document.formname.inputNameToChange.value = newValue; //here is alert to show you the thingy alert(document.formname.inputNameToChange.value); } //-- /script form name=formname input type=hidden name=inputNameToChange select onChange="changeValue(this.options[this.selectedIndex].value);" option value=value1label1 option value=value2label2 /select /form --end cutting-- DanO (javascript is your friend, not your enemy!) -Original Message- From: Jason Jacobs [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 18, 2001 1:33 PM To: [EMAIL PROTECTED] Subject: [PHP] question (as if anything else would be in an email to the list...) Hi again. I have a new problem. I have a form with a drop down list. When the user chooses something from the list, I need a variable to change values so it can be used upon submission of the form. I thought maybe I could throw a little line of code into an onChange() function in the select tag, but I got the MS Debugger thrown up on me. Anyone got an idea of how to do this? Is it possible to call a javascript function and change the variable in there? Or an easier way (like inline php code...)? Thanks Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] decimal point movement...
why go thru the costly overhead of a regex when you can use math? ex: ? $number = '600'; $new= $number/100; $rem= $new-$new%100; if ($rem == 0) { $new .= ".00"; } print $number; print "\n"; print $new; ? you divide the number by 100 to push the decimal back, and, if there is no remainder (by modulus division), you append .00 to the variable. DanO -Original Message- From: Robert Collins [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 18, 2001 1:05 PM To: 'Christopher Allen'; php Subject: RE: [PHP] decimal point movement... Christopher, try a regular expression somthing like this ? $temp = "007170"; ereg ("([0-9]{2})([0-9]*)", $temp, $test); $changed_to_deicmal_form = $test[1].".".$test[2]; echo "$changed_to_deicmal_form"; ? Robert -Original Message- From: Christopher Allen [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 18, 2001 11:35 AM To: php Subject: [PHP] decimal point movement... Greetings! I am looking for an efficeient way to assign a decimal to a number and store the new number. I wanto add a decimal point after the first 2 leading digitis.. while ( query runs) { $temp=007170; $changed_to_deicmal_form; // would store .7170 } Furthermore I was using printf to round up numbers...has anyone found a different or better way? Christopher C. M. Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mixing HTML and PHP code
it's valid to use single-quotes, double-quotes, or NO quotes. specs, anyone? --- The value of the attribute may be either: A string literal, delimited by single quotes or double quotes and not containing any occurrences of the delimiting character. (7) http://www.w3.org/MarkUp/html-spec/ --- 3.2.2 Attributes Elements may have associated properties, called attributes, which may have values (by default, or set by authors or scripts). Attribute/value pairs appear before the final "" of an element's start tag. Any number of (legal) attribute value pairs, separated by spaces, may appear in an element's start tag. They may appear in any order. In this example, the id attribute is set for an H1 element: H1 id="section1" This is an identified heading thanks to the id attribute /H1 By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa. Authors may also use numeric character references to represent double quotes (#34;) and single quotes (#39;). For double quotes authors can also use the character entity reference quot;. In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), and periods (ASCII decimal 46). We recommend using quotation marks even when it is possible to eliminate them. Attribute names are always case-insensitive Attribute values are generally case-insensitive. The definition of each attribute in the reference manual indicates whether its value is case-insensitive. All the attributes defined by this specification are listed in the attribute index. http://www.w3.org/TR/1998/REC-html40-19980424/intro/sgmltut.html#h-3.2.1 -Original Message- From: Chris Lee [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 11, 2001 4:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] mixing HTML and PHP code It works, it works in lynx, netscape 4.76 netscape 6 mozilla 0.7 IE 5.5 opera 5.01 amaya 4.2.1 now I havent used any mac browsers but if it works for all those I assume it will for Mac browsers eh. Chris Lee Mediawaveonline.com "Alex Black" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... That's pretty ugly. echo "input type='text' name='hello' size='20' value='$value'"; that isn't html anymore, though. even though IE and NS may be forgiving, input type='text' isn't valid. " it is. That's a bit better. This is even better still: echo "INPUT TYPE='TEXT' NAME='hello' SIZE='20' VALUE='$value'"; Now, I can see the PHP variable used in there a lot easier than I could before. Syntax highlighting would bring it up more, too. speaking as an html author, and a lover of php, _please_: input type="text" name="hello" size="20" value="?=$value?" it makes the code useable. Actually, it makes it less useable for me. how? and what about your html production people, who needs to make changes to it? : _never_ and I do mean that _never_ use echo for printing html. it makes your apps impossible to change, and in a production environment, that's not ok. What if, halfway through a page, I figure out that I need to do a redirect or set a cookie? I suggest you design your applications in such a way that you separate logic from markup, and preferably assemble your applications out of separate components that perform "categories" of logical operations. Using markup that is not contain echos does not preclude good application design. If you're building pages where database connections on the same page as your markup, I see why you would say that. As you do larger applications, you'll find that practice does not scale well: Have a look at binarycloud.com. binarycloud provides a framework for building large scale, robust applications that effectively separate markup from logic. (and it makes coffee!) I assemble *all* the page content into a single string variable, and echo it out as the last thing the script does. This way I'm free to play with HTTP headers right up to that time. agh! well, ok - but I suggest that you use functions instead, and call your html printing functions at the end of your script. or better, build simple components, and glue them together to make an application that consists of files that do logical operations, and files that contain markup. Dumping all that crap into a variable and printing one massive goo-ball isn't the route to incredible webserver performance, either. Try stress testing your installations, you'll find apache suddenly needs a _hideous_ amount of memory. However, each to their own - your way works for you and your team, mine works for me and mine :) And as