php-general Digest 10 Nov 2001 09:03:21 -0000 Issue 986

Topics (messages 74057 through 74090):

can't insert into mssql smalldatetime
        74057 by: aaron

putting the result of PHP code into a string
        74058 by: Morten Gjetanger
        74061 by: Jason Stechschulte

What is the PATH...
        74059 by: Cleber S. Mori

Re: Regular expression question
        74060 by: Jack Dempsey

odbc_free_result
        74062 by: Ernesto

Re: PHP Usage Stats
        74063 by: Matt McClanahan
        74075 by: Chris

PHP4.0.6 configure error with apache 2.0.16
        74064 by: Tyler Longren

HTTP_POST_VARS: Data there, but can't get to it
        74065 by: Lara J. Fabans
        74071 by: Christopher William Wesley
        74084 by: Tom Rogers

Functions to big
        74066 by: De Necker Henri
        74067 by: De Necker Henri

HTTP Headers
        74068 by: Mike Harvey
        74073 by: Christopher William Wesley
        74074 by: Richard S. Crawford
        74086 by: Brent Rieck

InterSystems Cache DB and PHP
        74069 by: SHAWN

UPLOADING BLUES: Empty form variables when uploading
        74070 by: Sandra Rascheli

post variables to MySQL fields
        74072 by: Rory O'Connor

Server redirection
        74076 by: Ernesto
        74077 by: Kurt Lieber

Re: Faking MS Access on MySQL linux box
        74078 by: John Lim

Re: Design for Large OO poject
        74079 by: John Lim

Re: Associative Arrays Performance under Linux
        74080 by: John Lim

might be bugs on PHP 4.06 or mySQL 4.0
        74081 by: Yamin Prabudy

Ereg Bug
        74082 by: js

Text Wrapper
        74083 by: jtjohnston
        74088 by: Brian Clark
        74090 by: jtjohnston

Nevermind Ereg Bug
        74085 by: js

Form Name Attribute
        74087 by: Kal Amry

Passing vars...
        74089 by: Ashley M. Kirchner

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I have this query

$db1 = "INSERT INTO tablename
(name,email,phone,room,problem,upgrade,software,hardware,printer,network,os,
priority,submitdate)

VALUES
('$name','$email','$phone','$room','$problem','$upgrade','$software','$hardw
are','$printer','$network','$os','$priority','1996-05-01')";

$cur1 = MSSQL_QUERY($db1);

But when I do a select of the submitdate field, it always turns up as
today's date no matter what I try to insert.  Do I need to change the format
of my date before I insert it somehow?  The submitdate field is of type
smalldatetime

Thanks,
Aaron


--- End Message ---
--- Begin Message ---
I'm quite sure there is a simple solution to the problem bellow!

I like to evaluate som PHP code, but I want the result to be putted into a
string.

example:

$var = "Test1";
$code = "<td><?php echo $var1?></td>";
$html = someFunction($code);

After this i want $html to contain "<td>Test1</td>

I've checked the eval function, but it just evaluates the code and just
outputs the result. I really wants the output into a string!

regards

Morten Gjetanger


--- End Message ---
--- Begin Message ---
On Fri, Nov 09, 2001 at 10:33:39PM +0100, Morten Gjetanger wrote:
> I like to evaluate som PHP code, but I want the result to be putted into a
> string.
> example:
> 
> $var = "Test1";
> $code = "<td><?php echo $var1?></td>";
> $html = someFunction($code);
> 
> After this i want $html to contain "<td>Test1</td>

$var = "Test1";
$code = "<td>$var</td>";
$html = someFunction($code);

Done.

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
"You can't have filenames longer than 14 chars.
You can't even think about them!"
             -- Larry Wall in Configure from the perl distribution
--- End Message ---
--- Begin Message ---
When PHP try to execute a program via exec() or system(), where does it
search for it?
I mean, it sertainly is not MY (foo.php owner) path, because it returns me
a
  sh: YOUR_PROGRAM: command not found

It seems to be (/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin ) now.
Where can I set this PATH?

Thanks!

Cleber S. Mori
Monitor Lab Linux
2o Ano - Bacharelado em Ciências da Computação
ICMC - Instituto de Ciências Matemáticas e de Computação
USP - Universidade de São Paulo - São Carlos

HPage:          http://grad.icmc.sc.usp.br/~cleber/
E-mail:         [EMAIL PROTECTED]
ICQ/UIN:        1409389


--- End Message ---
--- Begin Message ---
What is $num going to be? A number? So how do you determine where that
number ends and where there shouldn't be another number in front of it...are
there any restrictions on the size of $num?

say $num is 51
then you're saying that you want to match
51::
but not 151::
however, what if $num is 151? see what i mean?
----- Original Message -----
From: "Leon Mergen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 1:53 PM
Subject: [PHP] Regular expression question


> Hello,
>
> I have a little question regarding regular expressions... I want to check
> for the pattern
>
> $num::
>
> But, $num may not be started with another number (assume the number will
be
> 51 , 1 will also match (the pattern 1:: is available in 51::) ...
Currently,
> my regular expression is:
>
> eregi("([^0-9]$num::)", $string);
>
> But that doesn't seem to work... The other option, the start of a line or
a
> : also didn't work:
>
> eregi("([^|:]$sess_id::)", $string);
>
> Anyone can help me with this?
>
> Thanks in advance,
>
> Leon Mergen
>
>
> --
> 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]
>
>

--- End Message ---
--- Begin Message ---

Hi,

I'm a newbie and I'm currently porting a system coded in another language 
to PHP4.
Here's a question about the internals of PHP:

The manual states that it's not necesary to do odbc_free_result() because 
PHP will free all used resources upong script completion. Ok, but what if I 
reuse (overwrite) the ODBC result identifier like this:

     $ex=odbc_exec($jg_difolt, "SELECT ...");
     ....
     //Here... I don't free the resource
     $ex=odbc_exec($jg_difolt, "SELECT ...");
     ....
     //Now... I free the resource...
     odbc_free_result($ex);

I guess both resources are freed, but I just want to make sure because I do 
this all the time (because the old code I'm porting does it (because it's 
ok to do it in _that_ language) (and I'm too lazy to rework it)).

Thanks in advance.

Regards,
Ernesto

--- End Message ---
--- Begin Message ---
On Fri, Nov 09, 2001 at 10:11:50AM -0800, Chris wrote:

> Are there any refrences that would indicate the percent of sites (PHP
> installs) using various versions of PHP (i.e., 60% PHP4, 30% PHP3,
> etc.)?

See the top of http://php.net which refers to usage stats provided by
Netcraft and SecuritySpace.

Matt
--- End Message ---
--- Begin Message ---
That Report doesn't seem to identify PHP version only total

Matt McClanahan wrote:

> On Fri, Nov 09, 2001 at 10:11:50AM -0800, Chris wrote:
>
> > Are there any refrences that would indicate the percent of sites (PHP
> > installs) using various versions of PHP (i.e., 60% PHP4, 30% PHP3,
> > etc.)?
>
> See the top of http://php.net which refers to usage stats provided by
> Netcraft and SecuritySpace.
>
> Matt

--- End Message ---
--- Begin Message ---
Hello list,

I tried to compile apache 2.0.16 with php 4.0.6.  Here's my ./configure line
for apache:
./configure --prefix=/usr/local/apache2 --enable-module=so


And here's my ./configure line for PHP:
./configure --with-apxs2=/usr/local/apache2/bin/apxs  --with-mysql --disable
-debug --enable-track-vars --with-ftp --with-xml

And here's the error I get from the ./configure in PHP:
checking for Apache 2.0 module support via DSO through APXS...
Usage: apxs -g [-S <var>=<val>] -n <modname>
       apxs -q [-S <var>=<val>] <query> ...
       apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]
               [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]
               [-Wl,<flags>] <files> ...
       apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...
       apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...
configure: error: Sorry, I cannot run apxs. Either you need to install Perl
or you need to pass the absolute path of apxs by
using --with-apxs2=/absolute/path/to/apxs

Anyone know what's going on?  I have perl installed.

Tyler


--- End Message ---
--- Begin Message ---
Hi,

I'm having some difficulties accessing HTTP_POST_VARS

The original form has a table where each row has a set of 3 radio
buttons  name="whatdo<?php print $x?>[]"   where $x is the row counter.
(I'm using PHP to pull info into a table, then the user manipulates
the info, and it places the info into 2 other tables depending upon what
the choice is for the 3 radio buttons).

So, on submit, it reloads the page, and I pull in all of the areas.  All
work except the radio buttons.

I've tried:
$submitted_vars = $HTTP_POST_VARS;
$whatdo = $submitted_vars[whatdo];
---
and
$whatdo = $HTTP_POST_VARS["whatdo"];
--

but when I do a print_r($whatdo)
it's blank

When I do a
print_r($HTTP_POST_VARS)
I get
Array ( [whatdo] => Array ( [0] => load [1] => delete), [other stuff]....)


What am I doing wrong :-)  How do I access this data?  It's so frustrating
since all the rest of the postvars are working, and I can see that the
data's there in the HTTP_POST_VARS....I just can't get to it. (pun not
intended)

Thanks,
Lara

---------------------
Lara J. Fabans
Lodestone Software, Inc
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
On Fri, 9 Nov 2001, Lara J. Fabans wrote:

> The original form has a table where each row has a set of 3 radio
> buttons  name="whatdo<?php print $x?>[]"   where $x is the row counter.

Well, for a set of raido buttons, they should all have the same name.
In your case, all 3 radio buttons should be named "whatdo".
Don't put on any brackets ... that will cause whatdo to be an array when
it's being handled by the form handler.

Then you can check $HTTP_POST_VARS['whatdo'] for the value of the checked
radio button when the form was submitted.

        g.luck,
        ~Chris                           /"\
                                         \ /     September 11, 2001
                                          X      We Are All New Yorkers
                                         / \     rm -rf /bin/laden


--- End Message ---
--- Begin Message ---
Hi
Your whatdo's will be whatdo0 whatdo1...whatdox
You need to do like this if I understand what you are doing :)
$row=0;
while($row < $numofrows):
   $var = "whatdo".$row;
   $whatdo = $submitted_vars["$var"];
   //do whatever with $whatdo
   .
   $row ++;
endwhile;


Tom
At 09:41 AM 10/11/01, Lara J. Fabans wrote:
>Hi,
>
>I'm having some difficulties accessing HTTP_POST_VARS
>
>The original form has a table where each row has a set of 3 radio
>buttons  name="whatdo<?php print $x?>[]"   where $x is the row counter.
>(I'm using PHP to pull info into a table, then the user manipulates
>the info, and it places the info into 2 other tables depending upon what
>the choice is for the 3 radio buttons).
>
>So, on submit, it reloads the page, and I pull in all of the areas.  All
>work except the radio buttons.
>
>I've tried:
>$submitted_vars = $HTTP_POST_VARS;
>$whatdo = $submitted_vars[whatdo];
>---
>and
>$whatdo = $HTTP_POST_VARS["whatdo"];
>--
>
>but when I do a print_r($whatdo)
>it's blank
>
>When I do a
>print_r($HTTP_POST_VARS)
>I get
>Array ( [whatdo] => Array ( [0] => load [1] => delete), [other stuff]....)
>
>
>What am I doing wrong :-)  How do I access this data?  It's so frustrating
>since all the rest of the postvars are working, and I can see that the
>data's there in the HTTP_POST_VARS....I just can't get to it. (pun not
>intended)
>
>Thanks,
>Lara
>
>---------------------
>Lara J. Fabans
>Lodestone Software, Inc
>[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]

--- End Message ---
--- Begin Message ---
Hi there !

I just want to know what is the max size that a function can be before it
becomes out of range for the function that follows?
--- End Message ---
--- Begin Message ---

> Hi there !
> 
> I just want to know what is the max size that a function can be before it
> becomes out of range for the function that follows?
--- End Message ---
--- Begin Message ---
Is it possible to redirect to an IP address but have the browser address bar
show an URL?

Mike H.
http://ibiz-tools.com http://vestudiohost.com


--- End Message ---
--- Begin Message ---
On Fri, 9 Nov 2001, Mike Harvey wrote:

> Is it possible to redirect to an IP address but have the browser address bar
> show an URL?

Assuming that you meant "hostname" instead of "URL" since the browser
address bar will always display a URL ... No.

        ~Chris                           /"\
                                         \ /     September 11, 2001
                                          X      We Are All New Yorkers
                                         / \     rm -rf /bin/laden

--- End Message ---
--- Begin Message ---
Boy, that's one of those "Imagine the trouble we would get into if we 
could!" questions, isn't it?  Just like "How do I disable the back 
button?", or "How do I use PHP to feed me the contents of a web browser's 
hard drive?"

That said, some hosting services support what is called "domain parking", 
where you can hop on to a URL, and then have that URL displayed in the 
browser's location bar throughout the browsing experience.  The problem is 
that it's unreliable (you don't know when you're going to "burst out" of 
park mode and see the "real" URL), and the URL that is displayed is 
relatively static.  That is, you will only see the URL, and not any 
subdirectories.

It's obnoxious, and I don't recommend it, but check with your hosting 
service if that's really the route you want to go.

Can't be done with PHP, though.


At 03:55 PM 11/9/2001, Mike Harvey wrote:
>Is it possible to redirect to an IP address but have the browser address bar
>show an URL?
>
>Mike H.
>http://ibiz-tools.com http://vestudiohost.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]


Sliante,
Richard S. Crawford

http://www.mossroot.com
mailto:[EMAIL PROTECTED]
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
"It is only with the heart that we see rightly; what is essential is 
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"

--- End Message ---
--- Begin Message ---
On Fri, 2001-11-09 at 15:55, Mike Harvey wrote:
> Is it possible to redirect to an IP address but have the browser address bar
> show an URL?

assuming you have a valid url with a hostname, just wrap the ip address
url inside of a frame that takes up the entire window.

--Brent


--- End Message ---
--- Begin Message ---
Does anyone know if PHP can be used (other than with ODBC) with the Cache
database from InterSystems? 
 
Thanks in Advance,
Shawn Sellars
--- End Message ---
--- Begin Message ---
Hi everybody,

I hope someone is able to help me with this, I've been having this problem for  a 
couple of months now and I have not been able to find a solution. I have a form to 
upload a file which submits to itself, and has two submit buttons, one called 
"eliminarfoto" (deletephoto) and "salvar" (savephoto), but for some weird and 
unexplainable reason (it only happens to some users, not all of them) when they hit 
any of these two submit buttons, the form returns empty variables.

This is part of my script, has anybody had a similar problem before??? Any help would 
be greatly appreciated.

 <FORM ENCTYPE="multipart/form-data" ACTION="foto.php" METHOD=POST>
 <TABLE border=0 cellPadding=2>
 <TR>
  <TD VALIGN=TOP><P><FONT face=Verdana size=1><B>Foto</B> 
  (opcional,<br>tamaño máximo: 20k,<br>formatos permitidos: JPEG, GIF)</FONT></TD>
  <TD>
  <? if ($foto) 
  { 
  echo "<IMG align=bottom border=0 width=140 height=160 src=\"../fotos/$foto?nc=" . 
time() ."\"><br>"; 
  }
  ?>
  <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
  <INPUT NAME="userfile" TYPE="file">
  <INPUT TYPE="submit" NAME="eliminarfoto" VALUE="Eliminar">
  <INPUT TYPE="hidden" NAME=foto VALUE="<? echo $foto ?>">
      </TD>
 </TR>
 <TR>
  <TD VALIGN=TOP COLSPAN=2 ALIGN=CENTER>
  <font face="Verdana,Arial,Helvetica,Sans-serif" size="2"> 
  <INPUT TYPE="SUBMIT" NAME=salvar VALUE="Continuar ->"></TD>
  
 </TR>
 </TABLE>
 </FORM>
--- End Message ---
--- Begin Message ---
A while back somebody answered a question about some PHP code that would 
take the $HTTP_POST_VARS and create the SQL that would write them to a 
MySQL table  (provided the posted var names matches the MySQL 
fieldnames).

Does anyone have info on that project?  The PHP searchable archive is 
down, otherwise I wouldn't be asking on the list.

Thanks,
Rory
--- End Message ---
--- Begin Message ---

Hi there... newbie here!

How do I do server-side redirection?
I want to redirect the user to another URL without using javascript.

Regards,
Ernesto

--- End Message ---
--- Begin Message ---
On Friday 09 November 2001 07:46 pm, Ernesto wrote:
> How do I do server-side redirection?
> I want to redirect the user to another URL without using javascript.

RTFM.

http://php.net/header

Or, check the archives of the mailing list.

http://marc.theaimsgroup.com/?l=php-general

This question has been asked dozens upon dozens of times before.

--kurt
--- End Message ---
--- Begin Message ---
See http://php.weblogs.com/adodb_csv

"ADODB also supports SQL communications through HTTP as a database proxy. In
plain English, if you have a FoxPro or Access database that you need to
connect to from Unix, you can do so via HTTP (eg. Apache talking to IIS,
which talks to a small PHP program [the proxy] that queries the database,
packs it into serialized text and sends it back to Apache).

  PHP client -- Apache ------------ IIS -- PHP server -- Database

Or if you have to go through a firewall to access your database, this
solution allows you to stream SQL queries as HTTP through the firewall."

[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote in message
GMJD1G$[EMAIL PROTECTED]">news:GMJD1G$[EMAIL PROTECTED]...
Hello,

For reasons not worth discussing here, I have to develop and test on
Linux/Apache some PHP pages that will have to access via ODBC a MS Access
database on an NT/IIS/PHP server.

I would like to do it by writing PHP pages that access via ODBC
some mysql or other database on my linux box, in such a way that,
if it works there, I just change some general setting, upload the pages
and they work for sure on the MS Access thing (something like:
ifdef LINUX then ODBC_ACCESSES_MYSQL
ifdef NT    then ODBC_ACCESSES_MS_Access)

I am sure that this must be possible, but would really appreciate some
examples/pointers to specific tutorial/similar stories/etc.

TIA,
mweb



--- End Message ---
--- Begin Message ---
Hi Daniel,

Most OOP projects contain multiple hierarchies, not just one. Normally DB
is not made the base class. Think in terms of whether the objects have
is-type-relationships or use-part-relationships.

Eg.

Boring_News uses-the-part MySQL_DB, so Boring_News uses the MySQL_DB object
as a member var.

class Boring_News { $var db; ...  }

Sexy_Articles is-a-type-of News, so perhaps Sexy_Articles can be derived
from the News class.

class Sexy_Articles extends News { ... }

Hope this helps.

Bye, John

Daniel Harik <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hello guys,
>
> I've started large long-term project, i'm buildingd my own CMS (content
> manegment system) with  few more developers, compared to nuke i want
> it to be fully object-oriented, so that adding more modules would be
> easy and logical, i have built first beta version of it, i want to
> maximize code reuse, so here is the structure of my classes
>
> class DB{}
> class Member extends DB()
> class News extends Member{}
> class Poll extends News{}
> ...........................
> All new blocks and modules are added
> in this place
> ...........................
> class NewBlock extends BitOlderBlock{}
>
> after this comes the class that's always in the end
>
> class Blocks extends NewBlock{}
>
> then i have a file that uses all this library
>
> looks like this:
> ---------------
> <?
> include ("blocks.php");
> class mainPage extends Blocks{
>
>  function displayMainPage(){
>   $this->heading();
>
>   $this->block_news();
>
>   $this->footer();
>  }
>
>
> }
> $page = new  mainPage;
> $page->displayMainPage();
> ?>
>
>
> --------------
>
>
> I'm very new for big Object-oriented projects, but i'm not new to PHP,
> i was wondering if my design is good or bad, if you could show me
> what's wrong with it i'd be very thankful
>
> Thank You very much, and have a nice day :-)
>
>
>
>
>
>
>
> --
> Best regards,
>  Daniel                          mailto:[EMAIL PROTECTED]
>


--- End Message ---
--- Begin Message ---
This is just a suggestion. Rather than creating the associative array from
scratch, prebuild one and just use copies of that associative array when you
need it. I don't know whether it will be faster, but intutitively it should.

This is analogous to pre-allocating structs in memory before using them in
C.

Regards, John

PS: Let me know if this is practical and if it works!

Mike Boulet <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have been troubleshooting the performance of some code for a couple of
> days and I have not been able to find out what is happening.
>
> Here's the pseudo-code
>
> - Get jobs from the MySql database. Return all customers. Returns 10 rows.
> then for each customer return their active jobs. ( About 1 to 2 rows ).
> - for each row build and array entry which looks like the following
>
>     Array Customers
>     {
>         Array CustInfo()
>         {
>             Array Job 1 Info
>                     Array Functions()
>                     Array Details()
>             Array Job 2 Info
>                     Array Functions()
>                     Array Details()
>         }
>         Array CustInfo()
>         {
>             Array Job 1 Info
>                     Array Functions()
>                     Array Details()
>             Array Job 2 Info
>                     Array Functions()
>                     Array Details()
>         }
>     }
>
>     There may be more than one customer (CustInfo) stored.  The problem is
> that under Windows 2000 server the code that builds the array takes 1/1000
> of second to execute for each item added to the custinfo array.  When I
move
> the same code and database to my Red Hat 7.1 Linux server  it takes 2/100
of
> a second!! So the whole process of building the arrays takes a total of
> 2/10th of a second under Windows 2000 server and takes 2 seconds on the
> Linux server.
> I have never seen this kind of issue before under Linux and was wondering
> what it could be? PHP Config option? Linux config option?
>
> Specs of the Servers
> =================================
> The Windows 2000 server is a 600Mhz Pentium with 384Megs ram
>
> The Linux server is Red Hat 7.1 on a Dual gighz server with 512 megs ram..
>
> Both servers are running php 4.0.6.
>
> There is no load on the Linux server to affect the numbers. All other
> processes including other PHP code runs great and much faster than Windows
> 2000.
>
> Any advice would be appreciated.
>
>
>
>


--- End Message ---
--- Begin Message ---
Hi there,
I just try to install mySQL 4.0 then i install PHP, seems like somethings 
aint right,...i can do make install and there is error..upss sorry i forget 
about the error but it say about some unknow module on mysql

then i change to mySQL 3.23.44 everything is OK

did anyone success on insalling mySQL 4.0 and PHP 4.06

who know is me that mess up on installing


Best Regards

Yamin Prabudy
--- End Message ---
--- Begin Message ---
I'm ready to rip my hair out!

I have a form which submits to a script to generate an image using the info 
on the form.

I am trying to center the text over the image, and this application 
requires the use of variable-width fonts.  So I am using a very basic regex 
to check for an all-caps string in order to adjust the placement of the 
text in the image.

I don't know what is causing this, but the regex seems to get "stuck" 
holding a particular value.  If you type in a string in all lower case 
after changing the regex, it works fine.  It may work 10 times in a 
row.  But then after some seemingly arbitrary number of submissions, the 
value of the variable $uo in the script snippet below will not change.

I am stumped - if anyone has any insight into this I'd appreciate it.

You can view the script in action here: http://toolshed51.dhs.org/~josh/

The script prints the value of $uo preceding the input text.

Thanks,
Josh

Code snip:

                         for($x=3;$x>=1;$x--)
                 {
                         $string = ${"line" . $x};
                         $string = stripslashes($string);
                         if(ereg("^([A-Z])*$", "$string"))
                         {
                                 $uo = 1;
                         } else
                         {
                                 $uo = 2;
                         }
--- End Message ---
--- Begin Message ---
$string = "Mary had a little lamb whose face was icy cold. Everywhere
that Mary went the townsfolk were sure to know";

I want to display the text where the max number of  characters on any
one line is 34.

1234567890123456789012345678901234
Mary had a little lamb whose face
was icy cold. Everywhere that
Mary went the townsfolk were
sure to know.

Where would I start?

strlen($string)
explode
and then what?
--- End Message ---
--- Begin Message ---
Hi jtjohnston,

@ 2:16:38 AM on 11/10/01, jtjohnston wrote:

> $string = "Mary had a little lamb whose face was icy cold. Everywhere
> that Mary went the townsfolk were sure to know";

> I want to display the text where the max number of  characters on any
> one line is 34.

> 1234567890123456789012345678901234
> Mary had a little lamb whose face
> was icy cold. Everywhere that
> Mary went the townsfolk were
> sure to know.

> Where would I start?

PHP 4.0.2 or greater?

http://www.php.net/manual/en/function.wordwrap.php

If not, check out the user notes at the bottom.

--
 -Brian Clark | PGP is spoken here: 0xE4D0C7C8
  Please, DO NOT carbon copy me on list replies.

--- End Message ---
--- Begin Message ---
How long have I been f***ing around with perl?
Thanks someone for thinking that one up! :)

Brian Clark wrote:

> Hi jtjohnston,
>
> @ 2:16:38 AM on 11/10/01, jtjohnston wrote:
>
> > $string = "Mary had a little lamb whose face was icy cold. Everywhere
> > that Mary went the townsfolk were sure to know";
>
> > I want to display the text where the max number of  characters on any
> > one line is 34.
>
> > 1234567890123456789012345678901234
> > Mary had a little lamb whose face
> > was icy cold. Everywhere that
> > Mary went the townsfolk were
> > sure to know.
>
> > Where would I start?
>
> PHP 4.0.2 or greater?
>
> http://www.php.net/manual/en/function.wordwrap.php
>
> If not, check out the user notes at the bottom.
>
> --
>  -Brian Clark | PGP is spoken here: 0xE4D0C7C8
>   Please, DO NOT carbon copy me on list replies.

--- End Message ---
--- Begin Message ---
I figured out a work around.  I'd still be interested if anyone else has 
experienced this.

Josh

--- End Message ---
--- Begin Message ---
Hi guys, If I have a code in file1.php such as:

<form name=formName1 action=file2.php method=post>
code..........
code..........
</form>

And

<form name=formName2 action=file2.php method=post>
code..........
code..........
</form>

Now in file2.php, I need to check which form I am receiving!! How do I
check!!

In other words, let's assume we only have the form names "formName1" and
"formName1" - What code I can use in file2.php to get the name of the
calling form. I just want to know how can I get the name of the form (in the
above case, formName1 or formName2)

Thanx


--- End Message ---
--- Begin Message ---

    Small problem...  I used to have a single file that included others
based on some variables set.  However, I've decided instead of including
a different file, I would set a location header and redirect the browser
to the (once included) file instead.  Problem is, now my variables
aren't being passed from one page to the other now.

    My index.php file sets the following in a form:

    // variables passed
    // $email[to]   -> who the mail is send to
    // $email[from] -> from who the mail came it
    // $name[to]    -> the name of the person who will get the mail
    // $name[from]  -> the name of the person who send the mail
    // $picture     -> the full picture-url
    // $comment     -> comment
    // $session[ID] -> a simple sessionID
    // $album       -> album in catalog
    // $startitem   -> page (item) in album

    ...and I need those variables passed on to the file to which I'm
redirecting to.  Any ideas anyone?

--
H | "Life is the art of drawing without an eraser." - John Gardner
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
  Director of Internet Operations / SysAdmin    .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave, #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.


--- End Message ---

Reply via email to