php-general Digest 10 May 2005 15:08:42 -0000 Issue 3446

Topics (messages 214808 through 214840):

While and echoing HTML
        214808 by: Mark Sargent
        214810 by: Prathaban Mookiah
        214811 by: Fabian Müller
        214813 by: Mark Sargent
        214814 by: Mary-Anne Nayler
        214815 by: Mary-Anne Nayler
        214816 by: darren kirby
        214817 by: Mark Sargent
        214819 by: Richard Lynch
        214821 by: Burhan Khalid
        214837 by: Jared Williams

Re: Please Ignore
        214809 by: Mark Sargent

Header location, redirection loses parameters,
        214812 by: Olav Draageset
        214818 by: Richard Lynch
        214822 by: Prathaban Mookiah

Re: Wash with SOAP
        214820 by: Burhan Khalid

using header ('Location:) to pass varaiables
        214823 by: Ross
        214825 by: Marek Kilimajer
        214828 by: Angelo Zanetti

strpos with array?
        214824 by: Merlin
        214826 by: Marek Kilimajer
        214827 by: Shaw, Chris - Accenture
        214829 by: Burhan Khalid
        214833 by: Merlin
        214836 by: Merlin

Re: A couple questions about templating
        214830 by: Rory Browne

Re: Accessible HTML - OT
        214831 by: Leif Gregory
        214840 by: Mikey

Editing PDF
        214832 by: Sam Smith

String manipulation out of the box solution?
        214834 by: Merlin

Password encryption and password retrieval
        214835 by: Deep

how to know whether web server of a remote machine is running or not
        214838 by: balwant singh

yet another php templating question
        214839 by: Ryan A

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi All,

this page,

http://www.freewebmasterhelp.com/tutorials/phpmysql/5

has the below code,

<?
$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $first." ".$last; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $phone; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $mobile; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $fax; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo $email; ?>">E-mail</a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="<? echo $web; ?>">Website</a></font></td>
</tr>

<?
$i++;
}


echo "</table>";

which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..?

<html>
<body>
<h1><center>Jumbo Status</center></h1><br>
<?php
$db = mysql_connect("localhost", "root", "grunger");
mysql_select_db("status",$db);
$result = mysql_query("SELECT ProductTypes.product_type_detail FROM ProductTypes",$db);
$myrow = mysql_fetch_array($result);
$num = mysql_num_rows($result);
?>
<table aligh="center" border="2">
<tr>
<td>Product Type</td>
</tr>
<?
$i=0;
while ($i < $num){
$product_type=mysql_result($result,$i,"product_type_detail");
echo "<tr><td><? echo $product_type ?></td></tr>"
}
$i++
?>
</table>
</body>
</html>

I get the folowing error,

*Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20
*
which is the $i++ section.

Cheers.

Mark Sargent.
--- End Message ---
--- Begin Message ---
I guess it is the missing semicolon.


And you can write:

echo "<tr><td><? echo $product_type ?></td></tr>"

as simply

echo "<tr><td>$product_type</td></tr>"

Prathap


---------- Original Message -----------
From: Mark Sargent <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Tue, 10 May 2005 13:23:51 +0900
Subject: [PHP] While and echoing HTML

> Hi All,
> 
> this page,
> 
> http://www.freewebmasterhelp.com/tutorials/phpmysql/5
> 
> has the below code,
> 
> <?
> $i=0;
> while ($i < $num) {
> 
> $first=mysql_result($result,$i,"first");
> $last=mysql_result($result,$i,"last");
> $phone=mysql_result($result,$i,"phone");
> $mobile=mysql_result($result,$i,"mobile");
> $fax=mysql_result($result,$i,"fax");
> $email=mysql_result($result,$i,"email");
> $web=mysql_result($result,$i,"web");
> ?>
> 
> <tr>
> <td><font face="Arial, Helvetica, sans-serif"><? echo $first." 
> ".$last; ?></font></td> <td><font face="Arial, Helvetica, sans-
> serif"><? echo $phone; ?></font></td> <td><font face="Arial, 
> Helvetica, sans-serif"><? echo $mobile; ?></font></td> <td><font 
> face="Arial, Helvetica, sans-serif"><? echo $fax; ?></font></td> 
> <td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? 
> echo $email; ?>">E-mail</a></font></td> <td><font face="Arial, 
> Helvetica, sans-serif"><a href="<? echo $web; ?>">Website</a></font></td>
> </tr>
> 
> <?
> $i++;
> }
> 
> echo "</table>";
> 
> which I basically understand, except the html generation. I am 
> trying to create something similiar, although, I think there are 
> some errors in even perhaps my logic..?
> 
> <html>
> <body>
> <h1><center>Jumbo Status</center></h1><br>
> <?php
> $db = mysql_connect("localhost", "root", "grunger");
> mysql_select_db("status",$db);
> $result = mysql_query("SELECT ProductTypes.product_type_detail FROM 
> ProductTypes",$db);
> $myrow = mysql_fetch_array($result);
> $num = mysql_num_rows($result);
> ?>
> <table aligh="center" border="2">
> <tr>
> <td>Product Type</td>
> </tr>
> <?
> $i=0;
> while ($i < $num){
> $product_type=mysql_result($result,$i,"product_type_detail");
> echo "<tr><td><? echo $product_type ?></td></tr>"
> }
> $i++
> ?>
> </table>
> </body>
> </html>
> 
> I get the folowing error,
> 
> *Parse error*: parse error, unexpected '}', expecting ',' or ';' in 
> */var/www/html/products.php* on line *20
> *
> which is the $i++ section.
> 
> Cheers.
> 
> Mark Sargent.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------- End of Original Message -------

--- End Message ---
--- Begin Message ---
Mark Sargent <[EMAIL PROTECTED]> writes:

> $i=0;
> while ($i < $num){
> $product_type=mysql_result($result,$i,"product_type_detail");
> echo "<tr><td><? echo $product_type ?></td></tr>"
> }
> $i++

You should put "$i++" into the while loop. And you should add an ";"
at the end of the echo line as well as at the end of "$i++".

With kind regards, Fabian Müller

--- End Message ---
--- Begin Message ---
Prathaban Mookiah wrote:

I guess it is the missing semicolon.


And you can write:

echo "<tr><td><? echo $product_type ?></td></tr>"

as simply

echo "<tr><td>$product_type</td></tr>"

Prathap


---------- Original Message ----------- From: Mark Sargent <[EMAIL PROTECTED]> To: php-general@lists.php.net Sent: Tue, 10 May 2005 13:23:51 +0900 Subject: [PHP] While and echoing HTML



Hi All,

this page,

http://www.freewebmasterhelp.com/tutorials/phpmysql/5

has the below code,

<?
$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $first." ".$last; ?></font></td> <td><font face="Arial, Helvetica, sans-
serif"><? echo $phone; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $mobile; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo $fax; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo $email; ?>">E-mail</a></font></td> <td><font face="Arial, Helvetica, sans-serif"><a href="<? echo $web; ?>">Website</a></font></td>
</tr>

<?
$i++;
}

echo "</table>";

which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..?

<html>
<body>
<h1><center>Jumbo Status</center></h1><br>
<?php
$db = mysql_connect("localhost", "root", "grunger");
mysql_select_db("status",$db);
$result = mysql_query("SELECT ProductTypes.product_type_detail FROM ProductTypes",$db);
$myrow = mysql_fetch_array($result);
$num = mysql_num_rows($result);
?>
<table aligh="center" border="2">
<tr>
<td>Product Type</td>
</tr>
<?
$i=0;
while ($i < $num){
$product_type=mysql_result($result,$i,"product_type_detail");
echo "<tr><td><? echo $product_type ?></td></tr>"
}
$i++
?>
</table>
</body>
</html>

I get the folowing error,

*Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20
*
which is the $i++ section.

Cheers.

Mark Sargent.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


------- End of Original Message -------




Hi All,

Thanx. I saw the extra echo and removed it. Problem with that code, though. It displays only the 1st record, repeatedly, causing the browser to hang. Can anyone see what is wrong..? Cheers.

Mark Sargent.
--- End Message ---
--- Begin Message ---
Hi Mark,

As far as I can see the only problem is that you have forgotten to add a semicolon after the i++

Cheers,

Mary-Anne

Mark Sargent wrote, On 10/05/05 02:23 PM:

Hi All,

this page,

http://www.freewebmasterhelp.com/tutorials/phpmysql/5

has the below code,

<?
$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $first." ".$last; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $phone; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $mobile; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $fax; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo $email; ?>">E-mail</a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="<? echo $web; ?>">Website</a></font></td>
</tr>

<?
$i++;
}


echo "</table>";

which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..?

<html>
<body>
<h1><center>Jumbo Status</center></h1><br>
<?php
$db = mysql_connect("localhost", "root", "grunger");
mysql_select_db("status",$db);
$result = mysql_query("SELECT ProductTypes.product_type_detail FROM ProductTypes",$db);
$myrow = mysql_fetch_array($result);
$num = mysql_num_rows($result);
?>
<table aligh="center" border="2">
<tr>
<td>Product Type</td>
</tr>
<?
$i=0;
while ($i < $num){
$product_type=mysql_result($result,$i,"product_type_detail");
echo "<tr><td><? echo $product_type ?></td></tr>"
}
$i++
?>
</table>
</body>
</html>

I get the folowing error,

*Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20
*
which is the $i++ section.

Cheers.

Mark Sargent.


--- End Message ---
--- Begin Message --- oh, and the i++ should be inside the while loop and there is also a missing semi colon after the echo, ie;

$i=0;
while ($i < $num){
$product_type=mysql_result($result,$i,"product_type_detail");
echo "<tr><td><? echo $product_type ?></td></tr>";
$i++ ;
}


Mark Sargent wrote, On 10/05/05 02:23 PM:

Hi All,

this page,

http://www.freewebmasterhelp.com/tutorials/phpmysql/5

has the below code,

<?
$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $first." ".$last; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $phone; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $mobile; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $fax; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo $email; ?>">E-mail</a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="<? echo $web; ?>">Website</a></font></td>
</tr>

<?
$i++;
}


echo "</table>";

which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..?

<html>
<body>
<h1><center>Jumbo Status</center></h1><br>
<?php
$db = mysql_connect("localhost", "root", "grunger");
mysql_select_db("status",$db);
$result = mysql_query("SELECT ProductTypes.product_type_detail FROM ProductTypes",$db);
$myrow = mysql_fetch_array($result);
$num = mysql_num_rows($result);
?>
<table aligh="center" border="2">
<tr>
<td>Product Type</td>
</tr>
<?
$i=0;
while ($i < $num){
$product_type=mysql_result($result,$i,"product_type_detail");
echo "<tr><td><? echo $product_type ?></td></tr>"
}
$i++
?>
</table>
</body>
</html>

I get the folowing error,

*Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20
*
which is the $i++ section.

Cheers.

Mark Sargent.


--- End Message ---
--- Begin Message ---
quoth the Mark Sargent:
<snip>
> <html>
> <body>
> <h1><center>Jumbo Status</center></h1><br>
> <?php
> $db = mysql_connect("localhost", "root", "grunger");
> mysql_select_db("status",$db);
> $result = mysql_query("SELECT ProductTypes.product_type_detail FROM
> ProductTypes",$db);
> $myrow = mysql_fetch_array($result);
> $num = mysql_num_rows($result);
> ?>
> <table aligh="center" border="2">
> <tr>
> <td>Product Type</td>
> </tr>
> <?
> $i=0;
> while ($i < $num){
> $product_type=mysql_result($result,$i,"product_type_detail");
> echo "<tr><td><? echo $product_type ?></td></tr>"

You are already in a php block here. Why the '<?' ? Try:
echo "<tr><td>$product_type</td></tr>";

> }
> $i++

As the error message is trying to tell you, php statements are terminated with 
semi-colons:

$i++;

> ?>
> </table>
> </body>
> </html>
>
> I get the folowing error,
>
> *Parse error*: parse error, unexpected '}', expecting ',' or ';' in
> */var/www/html/products.php* on line *20
> *
> which is the $i++ section.
>
> Cheers.
>
> Mark Sargent.

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972

Attachment: pgpbqlPoMKN7B.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Mary-Anne Nayler wrote:

oh, and the i++ should be inside the while loop and there is also a missing semi colon after the echo, ie;

$i=0;
while ($i < $num){
$product_type=mysql_result($result,$i,"product_type_detail");
echo "<tr><td><? echo $product_type ?></td></tr>";
$i++ ;
}


Mark Sargent wrote, On 10/05/05 02:23 PM:

Hi All,

this page,

http://www.freewebmasterhelp.com/tutorials/phpmysql/5

has the below code,

<?
$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $first." ".$last; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $phone; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $mobile; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $fax; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo $email; ?>">E-mail</a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="<? echo $web; ?>">Website</a></font></td>
</tr>

<?
$i++;
}


echo "</table>";

which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..?

<html>
<body>
<h1><center>Jumbo Status</center></h1><br>
<?php
$db = mysql_connect("localhost", "root", "grunger");
mysql_select_db("status",$db);
$result = mysql_query("SELECT ProductTypes.product_type_detail FROM ProductTypes",$db);
$myrow = mysql_fetch_array($result);
$num = mysql_num_rows($result);
?>
<table aligh="center" border="2">
<tr>
<td>Product Type</td>
</tr>
<?
$i=0;
while ($i < $num){
$product_type=mysql_result($result,$i,"product_type_detail");
echo "<tr><td><? echo $product_type ?></td></tr>"
}
$i++
?>
</table>
</body>
</html>

I get the folowing error,

*Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20
*
which is the $i++ section.

Cheers.

Mark Sargent.


Hi All,

yes, changed it a little. Works fine now. Suprised at how much I've forgotten about HTML too. Cheers.

Mark Sargent.

<html>
<body>
<h1><center>Jumbo Status</center></h1><br>
<table aligh="center" border="2">
<tr>
<td>Product Type</td>
</tr>
<?php
$db = mysql_connect("localhost", "root", "grunger");
mysql_select_db("status",$db);
$result = mysql_query("SELECT ProductTypes.product_type_detail FROM ProductTypes",$db);
$num = mysql_num_rows($result);
for ($i=0; $i<$num; $i++){
$myrow = mysql_fetch_array($result);
$product_type=mysql_result($result,$i,"product_type_detail");
echo "<tr><td>$product_type</td></tr>";
}
?>
</table>
</body>
</html>
--- End Message ---
--- Begin Message ---
On Mon, May 9, 2005 10:57 pm, Mark Sargent said:
> Thanx. I saw the extra echo and removed it. Problem with that code,
> though. It displays only the 1st record, repeatedly, causing the browser
> to hang. Can anyone see what is wrong..? Cheers.

Everybody else has told you to move the $i++; inside the while { } loop.

I'm not gonna tell you that.

I'm gonna tell you to get out a pencil and some paper, and "walk" through
your code, writing down exactly what data goes where, in which variables,
on each line.

Make yourself a nice big wide columnar sheet of paper tracking each variable.

LINE | $db | $result | $myrow | $num | $i | $product_type |
1
2
3
4
5  | db-link |
6
7  |        | db-result |
.
.
.

You need to do this.

Trust me.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message --- Mary-Anne Nayler wrote:

Hi Mark,
As far as I can see the only problem is that you have forgotten to add a semicolon after the i++

Mark:

Since you are not displaying the counter, you really don't need to mess with $i.

 You can reduce your code to just :

   <?php

   $db = mysql_connect("localhost", "root", "grunger");
   mysql_select_db("status",$db);
   $result = mysql_query("SELECT ProductTypes.product_type_detail FROM
   ProductTypes",$db);

   ?>

   <table aligh="center" border="2">
   <tr>
   <td>Product Type</td>
   </tr>

   <?php

   while($myrow = mysql_fetch_assoc($result))
    echo "<tr><td>".$row['product_type']."</td></tr>";
   }
   ?>
   </table>
   </body>
   </html>

--- End Message ---
--- Begin Message ---
> 
> I guess it is the missing semicolon.
> 
> 
> And you can write:
> 
> echo "<tr><td><? echo $product_type ?></td></tr>"
> 
> as simply
> 
> echo "<tr><td>$product_type</td></tr>"
> 

I prefer 

echo '<tr><td>', $product_type, '</td></tr>';

No string concatenation, or variable replacement required.

Jared

--- End Message ---
--- Begin Message ---
Testing receipt of post..cheers.

Mark Sargent.
--- End Message ---
--- Begin Message --- I have several URLs that I want to point to the same site with a different parameter. I try to do this by redirecting all to the same location, by

<?
hader ("Location: http://mysite.com/index.php?var1=value1&var2=value2";);
exit;
?>

The redirection is done properly, but variables are not sent. Can anyone say what should be done? (some init settings ??)
Thanks
--- End Message ---
--- Begin Message ---
On Mon, May 9, 2005 3:16 pm, Olav Draageset said:
> I have several URLs that I want to point to the same site with a different
> parameter. I try to do this by redirecting all to the same location, by
>
> <?
> hader ("Location: http://mysite.com/index.php?var1=value1&var2=value2";);
> exit;
> ?>

I would expect it to "just work" if you spelled 'header' correctly...

Are you sure you don't have some kind of mod_rewrite stuff messing you up?

Can you surf DIRECTLY to that URL in your browser and get what you expect?

> The redirection is done properly, but variables are not sent. Can anyone
> say what should be done? (some init settings ??)

AFAIK there is no php.ini setting that would affect/cause this...  You
could read through all of php.ini.dist (?) and its comments from the CVS
source in an hour to be sure.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Are you trying to assign the value "value1" to var1 or are you trying to 
assign the value of the variable value1 to var1?

Prathap

---------- Original Message -----------
From: "Olav Draageset" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Tue, 10 May 2005 00:16:33 +0200
Subject: [PHP] Header location, redirection loses parameters, 

> I have several URLs that I want to point to the same site with a 
> different  parameter. I try to do this by redirecting all to the 
> same location, by
> 
> <?
> hader ("Location: 
> http://mysite.com/index.php?var1=value1&var2=value2";); exit; ?>
> 
> The redirection is done properly, but variables are not sent. Can 
> anyone  say what should be done? (some init settings ??) Thanks
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------- End of Original Message -------

--- End Message ---
--- Begin Message --- Jay Blanchard wrote:
It has come to a point where a vendor is requiring that we use SOAP to
access a service that they provide, so I need some recommendations...

a. Do I build my own request/receipt functions.
2. Do I use something like nusoap or Pears' SOAP classes?

Would those of you who are experienced with PHP and SOAP give me your
opinions? TVMIA!

PHP5 has excellent SOAP capabilities with the built-in SOAP extention. So, if you are using PHP5, you have no worries. Hop over to www.php.net/soap and start browsing the function list.

If you are not using PHP5, then either NuSOAP or the PEAR libs will work.
--- End Message ---
--- Begin Message ---
Is it possible to send variables using header() ?

I have tried variations on the theme

header ('Location: email_confirm.php?email=$email);

but nothing seems to work.

Ta,

Ross 

--- End Message ---
--- Begin Message --- Ross wrote:
Is it possible to send variables using header() ?

I have tried variations on the theme

header ('Location: email_confirm.php?email=$email);

but nothing seems to work.

I don't know what you tried, but the above results in parse error. Try:

header ("Location: email_confirm.php?email=$email");

email_confirm.php:

echo $_GET['email'];
--- End Message ---
--- Begin Message ---
try this

header("Location: email_confirm.php?email=".$email);
exit();

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052



Ross wrote:

>Is it possible to send variables using header() ?
>
>I have tried variations on the theme
>
>header ('Location: email_confirm.php?email=$email);
>
>but nothing seems to work.
>
>Ta,
>
>Ross 
>
>  
>

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

I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array.

For example:

        $replace = array("picture", "pics");
        $pos = strpos ($term, $replace);
        if ($pos !== false) {
           $term = str_replace($replace, "", $term);
           echo 'term without the word:'.$term;
        }

This does of course not work since strpos does not take arrays.

Thank you for any help,

Merlin
--- End Message ---
--- Begin Message --- Merlin wrote:
Hi there,

I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array.

For example:

    $replace = array("picture", "pics");
    $pos = strpos ($term, $replace);
    if ($pos !== false) {
       $term = str_replace($replace, "", $term);
       echo 'term without the word:'.$term;
    }

This does of course not work since strpos does not take arrays.

Thank you for any help,

Merlin


http://www.php.net/array_search
--- End Message ---
--- Begin Message ---
Hello,

Have you tried using array_keys or array_search for finding an occurrence in
an array?

HTH.

Chris.

-----Original Message-----
From: Merlin [mailto:[EMAIL PROTECTED]
Sent: 10 May 2005 11:11
To: php-general@lists.php.net
Subject: [PHP] strpos with array?


*************************************

This e-mail has been received by the Revenue Internet e-mail service.

*************************************

Hi there,

I am wondering if there is a function (I could not find) which does the same
thing like strpos does, but with an array.

For example:

        $replace = array("picture", "pics");
        $pos = strpos ($term, $replace);
        if ($pos !== false) {
           $term = str_replace($replace, "", $term);
           echo 'term without the word:'.$term;
        }

This does of course not work since strpos does not take arrays.

Thank you for any help,

Merlin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





************************

This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*************************

--- End Message ---
--- Begin Message --- Merlin wrote:
Hi there,

I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array.

For example:

    $replace = array("picture", "pics");
    $pos = strpos ($term, $replace);
    //if ($pos !== false) {
if (in_array($term,$replace)) {
       $term = str_replace($replace, "", $term);
       echo 'term without the word:'.$term;
    }

http://www.php.net/in_array
--- End Message ---
--- Begin Message --- Burhan Khalid wrote:
Merlin wrote:

Hi there,

I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array.

For example:

    $replace = array("picture", "pics");
    $pos = strpos ($term, $replace);
    //if ($pos !== false) {

if (in_array($term,$replace)) {

       $term = str_replace($replace, "", $term);
       echo 'term without the word:'.$term;
    }


http://www.php.net/in_array
Thank you! That was exactly what I was searching for.

Merlin
--- End Message ---
--- Begin Message --- Burhan Khalid wrote:
Merlin wrote:

Hi there,

I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array.

For example:

    $replace = array("picture", "pics");
    $pos = strpos ($term, $replace);
    //if ($pos !== false) {

if (in_array($term,$replace)) {

       $term = str_replace($replace, "", $term);
       echo 'term without the word:'.$term;
    }


http://www.php.net/in_array
Actually this did not solve the problem, since this function is searching for the exact phrase, but not within a string.

I solved it that way:
        // try pictures
        $replace = array("pictures", "picture", "bilder", "bild", "pic", "pics", 
"pix");
        foreach($replace AS $try){
                $pos = strpos ($term, $try);
                if ($pos !== false) {
                        $term = str_replace($try, "", $term);
                   #echo 'yes'.$term.$pos; exit;
                   HEADER("Location:/index.php?search_for=".$term.""); exit;
                }       
        }       

Maybe it will be useful for somebody else.

Merlin
--- End Message ---
--- Begin Message ---
> This has all been done before, and in a number of ways. If you really
> *must* build your own templating class, go and thoroughly review the
> code of those that already exist: Smarty, Savant, paTemplate,
> FastTemplate, etc. Figure out how each solved the problems. Then
> determine if you can improve upon their solutions.

This has all been done before, and I'm assuming that the James knows,
and has seen that before, since he used the same common method names,
as is in many php templating systems. $class->assign has been used in
any templating system I've ever seen(although to be honest I haven't
seen that many).

I don't think the fact that it has been done before should inhibit him
from doing it again. Carrying out the process, is one of the most
educational ways, and perhaps one of the most enlightening ways to see
how a process works.

I'm not sure how many lines of code are in Savant, paTemplate, or
FastTemplate, etc, but smarty has way too many to be used as a
learning tool, and there are times, when you want raw speed, that can
only be delivered via minimal, specialist code. Smarty is also too
complicated to be used by someone without good knowledge of
templating, and one of the best ways to understand it is to write your
own IMHO.

I think this question, whilst centred around templating, offers
opportunities for topics that aren't directly related to templating,
and perhaps PHP Programming in General. One particular area of
potential interest is dynamic code generation.

> 
> --
> Matthew Weier O'Phinney           | WEBSITES:
> Webmaster and IT Specialist       | http://www.garden.org
> National Gardening Association    | http://www.kidsgardening.com
> 802-863-5251 x156                 | http://nationalgardenmonth.org
> mailto:[EMAIL PROTECTED]         | http://vermontbotanical.org
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
Hello Mary-Anne,

Monday, May 9, 2005, 5:15:27 PM, you wrote:
MAN> Check out Joe Clarkes website: http://joeclark.org. Joe is an
MAN> expert in web accessibility issues.

I'm not claiming to be even remotely as good as Joe, but looking at
his site, I didn't see much in the way of helpful examples (maybe I
didn't look hard enough).

Recently I decided to write a tutorial on Web Accessibility and XHTML
1.0 Strict so that I could learn them. If you're interested, it's at:

http://www.devtek.org/test


Cheers,
Leif Gregory 

-- 
TB Lists Moderator (and fellow registered end-user)
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site <http://www.PCWize.com>

--- End Message ---
--- Begin Message ---
Thanks to everybody for their comments, I now have more than enough ammo to
justify our decisions.

Regards,

Mikey

--- End Message ---
--- Begin Message ---
I have an existing PDF file that I want to add text to or make changes to
text with data from an HTML form via PHP.

The PDF looks like this:
20 0 obj<</Length 5586/Filter[/ASCII85Decode/FlateDecode]>>stream
8;X-DgMYb:(An746bc%oU,Mo*S<nfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV
-$2%Ipq]A
aoW>]"SN?epNo...

That is, not in plain text.

If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it
go and what would it look like?

Thanks

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

I am writing an internal full text search engine and do have trouble in outputting the text in an apropriate way.

Problem is that if there is more than one word I cant handle the text cropping.

For example:
Search term: php germany
Text from database: There is no such great language than php. Amongh those countries using this language is Germany with a good percentage of users.
Text output should be:
...language than php. Amongh... language is Germay with a good...

Similar to the way google does it. I tried it now with a couple of ways but failed for most (I tried with strpos and substr).

Is there a solution out of the box with php, or maybe anybody knows a good script which does that. This does sound like a standard feature to me.

Thank you for any help,

Merlin
--- End Message ---
--- Begin Message ---
Hi evryone,

  I want to implement a site where i would like to
encrypt the password of the users and store it into
mysql 
database. My question is that , In case if the user
has forgotten the password how can he retrieve the
password(which is already encrypted and stored...the
user should be able to get the decrypted password). 

Also which encryption method would you recommend. ie.
md5,crypt, etc....

Thanx,
..Deeps..

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

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

I want to make a page (on a webserver) which will be redirected to another page on another webserver and hence i want to know whether the another webserver is running or not so that if the webserver is not running it do something else.

is there any method to know whether the other webserver is running or not.

your help will be appreciated.


with best wishes balwant

--- End Message ---
--- Begin Message ---
Hey,
Since we are caught up in the templating season, I think its time for this
one;

We have just finished designing the software blueprint for a new PHP
product,
we usually used the "include() method" :-) to "template" U/I's for the
clients but
this one seems a bit bigger...
I really like Smarty we and use it for our templating needs, but it just
seems a bit
too much to bundle Smarty  with our software to the end user/client (esp
since
Smarty would be many times bigger than our scripts)

I have searched google and the classes site to find templating solutions,
fast template looks good but from the forums i have seen its not extremly
dependable....any suggestions?

Links to would be appreciated, I have no plans of writing a new templating
system
just for this.

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.7 - Release Date: 5/9/2005

--- End Message ---

Reply via email to