php-general Digest 4 May 2012 12:43:41 -0000 Issue 7800

Topics (messages 317763 through 317772):

Re: PHP Mailto() - Google now displaying HTML as Plain Text
        317763 by: Terry Ally (Gmail)

Re: PHP & Database Problems -- Code Snippets
        317764 by: Ethan Rosenberg

PDF Form Field
        317765 by: Dan Joseph
        317766 by: David OBrien
        317767 by: David OBrien
        317768 by: Dan Joseph

function
        317769 by: Ron Piggott
        317770 by: Dan Joseph
        317771 by: Simon Schick

Re: PHP & Emacs
        317772 by: Gerardo Benitez

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi all,

This question is now closed.

There is nothing wrong with my script.

It was an error by Google when they switched over to the new-look email and
have since rectified the issue and all is back to normal.

Thanks to all who have responded.

Terry



On 3 May 2012 21:05, Gerardo Benitez <gerardobeni...@gmail.com> wrote:

> Do you know if the mailto script allow set headers?
>
> Probably you must set a html header, something like this
> $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
>
>
> Regards,
> Gerardo.
>
> On Tue, May 1, 2012 at 5:14 PM, Marco Behnke <ma...@behnke.biz> wrote:
>
> >
> >
> > Am 29.04.2012 22:31, schrieb Terry Ally (Gmail):
> >
> >> Hi all,
> >>
> >> I have been using a mailto() script for the last three years and from
> >> April
> >> 25, 2012 incoming HTML email in Goggle mail is displaying as Plain Text.
> >>  Something clearly changed with Google. Perhaps there is some change I
> >> need
> >> to make with my script??
> >>
> >> $message .= "<p><b>Message:</b><**blockquote>  ".$m."</blockquote></p>";
> >>
> >>
> > As far as I can see your main html tags are missing?
> >
> > $message = '<html><body>' . $message . '</body></html>';
> >
> >
> > --
> > Marco Behnke
> > Dipl. Informatiker (FH), SAE Audio Engineer
> > Zend Certified Engineer PHP 5.3
> >
> > Tel.: 0174 / 9722336
> > e-Mail: ma...@behnke.biz
> >
> > Softwaretechnik Behnke
> > Heinrich-Heine-Str. 7D
> > 21218 Seevetal
> >
> > http://www.behnke.biz
> >
> >
> >
>
>
> --
> Gerardo Benitez
> -------------------------
> Programador Web Freelance
>



-- 
*Terry Ally*
Twitter.com/terryally
Facebook.com/terryally
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
To print or not to print this email is the environmentally-searching
question!
Which has the highest ecological cost? A sheet of paper or constantly
switching on your computer and connecting to the Internet to read your
email?

--- End Message ---
--- Begin Message ---
At 06:47 PM 5/2/2012, Matijn Woudt wrote:
On Wed, May 2, 2012 at 11:43 PM, Ethan Rosenberg <eth...@earthlink.net> wrote: > Dear list - > > Sorry for the attachment.  Here are code snippets --- Ethan, I don't want to sound rude, but it appears to me you don't have any understanding of what you're doing. It might help if you understand what the code is doing... Let me explain. > > GET THE DATA FROM INTAKE3: > >   function handle_data() >   { >    global $cxn; >    $query = "select * from Intake3 where  1"; > > > >    if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' ) $_Request does not exists, you're looking for $_REQUEST. And why are you mixing $_REQUEST and $_POST here? >    { >       if ($_REQUEST['Sex'] === "0") >       { >        $sex = 'Male'; >       } >       else >       { >        $sex = 'Female'; >       } >    } > >   } What is the point of the handle_data function above? It doesn't do anything. >   $allowed_fields = array >    (  'Site' =>$_POST['Site'], 'MedRec' => $_POST['MedRec'], 'Fname' => > $_POST['Fname'], 'Lname' => $_POST['Lname'] , >       'Phone' => $_POST['Phone'] , 'Sex' => $_POST['Sex']  , 'Height' > => $_POST['Height']  ); > >   if(empty($allowed_fields)) >   { >      echo "ouch"; >   } > >   $query = "select * from Intake3  where  1 "; > >   foreach ( $allowed_fields as $key => $val ) >   { >    if ( (($val != '')) ) > >   { >    $query .= " AND ($key  = '$val') "; >   } >    $result1 = mysqli_query($cxn, $query); >   } First, this will allow SQL injections, because you insert the values directly from the browser. Second, you should move the last line ($result1=...), outside of the foreach loop, now you're executing the query multiple times. Third, you should check if $result1 === FALSE, in case the query fails > >   $num = mysqli_num_rows($result1); >   if(($num = mysqli_num_rows($result1)) == 0) Doing the same thing twice? >   { > ?> >   <br /><br /><center><b><p style="color: red; font-size:14pt;" >No Records > Retrieved #1</center></b></style></p> > <?php >   exit(); >   } > > DISPLAY THE INPUT3 DATA: > >>>> THIS SEEMS TO BE THE ROUTINE THAT IS FAILING <<< > >   <center><b>Search Results</b></center><br /> > >   <center><table border="4" cellpadding="5" cellspacing="55"  rules="all" >  frame="box"> >   <tr class=\"heading\"> >   <th>Site</th> >   <th>Medical Record</th> >   <th>First Name</th> >   <th>Last Name</th> >   <th>Phone</td> >   <th>Height</td> >   <th>Sex</td> >   <th>History</td> >   </tr> > > <?php > >    while ($row1 = mysqli_fetch_array($result1, MYSQLI_BOTH)) >    { >       print_r($_POST); Doesn't really make sense to print $_POST here.. >        global $MDRcheck; >        $n1++; >        echo "<br />n1 <br />";echo $n1; >       { >        if (($n1 > 2) && ($MDRcheck == $row1[1])) >        { >           echo ">2==  "; >           echo $MDRcheck; >           echo "<td> $row1[0] </td>\n"; >           echo "<td> $row1[1] </td>\n"; >           echo "<td> $row1[2] </td>\n"; >           echo "<td> $row1[3] </td>\n"; >           echo "<td> $row1[4] </td>\n"; >           echo "<td> $row1[5] </td>\n"; >           echo "<td> $row1[6] </td>\n"; >           echo "<td> $row1[7] </td>\n"; >           echo "</tr>\n"; >        } >        elseif (($n1 > 2) && ($MDRcheck != $row1[1])) >        { >           echo ">2!=  "; > >           echo $MDRcheck; > > >           continue; continue doesn't do anything here. >        } >        elseif ($n1 == 2) >        { > >           define( "MDR" ,  $row1[1]); >           echo "<br />row1 <br>";echo $row1[1]; >           echo "<tr>\n"; > >           $_GLOBALS['mdr']= $row1[1]; >           $_POST['MedRec'] = $row1[1]; You're not supposed to set variables in $_POST... >           $MDRold = $_GLOBALS['mdr']; It appears you want the old value of mdr, if so, then you should do this before you set it again 2 lines above.. >           echo "<td> $row1[0] </td>\n"; >           echo "<td> $row1[1] </td>\n"; >           echo "<td> $row1[2] </td>\n"; >           echo "<td> $row1[3] </td>\n"; >           echo "<td> $row1[4] </td>\n"; >           echo "<td> $row1[5] </td>\n"; >           echo "<td> $row1[6] </td>\n"; >           echo "<td> $row1[7] </td>\n"; >           echo "</tr>\n"; >        } > >       } >    } > > ?> You say this routine is probably the one that is failing.. but what is going wrong? And how the heck are we supposed to know what this function should do? > > SELECT AND DISPLAY DATA FROM VISIT3 DATABASE > > <?php >   $query2 = "select * from Visit3 where  1 AND (Site = 'AA')  AND (MedRec = > $_GLOBALS[mdr])"; You're using mdr as a constant here, this will generate a warning, but sadly enough it works. >   $result2 = mysqli_query($cxn, $query2); You should check if $result2 === FALSE, in case the query fails. >   $num = mysqli_num_rows($result2); You're counting the rows here, but you don't do anything with the result? > << Snip the rest of this crappy code >> > > I hope this helps. > > Ethan > > I think I made my point. I guess if I continued on the rest of the code there will be tons of other bugs. Try to understand what you're doing. Break things down in smaller pieces, check if they work, then write another piece. If something breaks, you know where it was because you just added that part. - Matijn


Martijn -

Thank you for your insights into my poorly written code. I am very much of a newbie, and therefore am asking for help.

Would you please look at the routine that is failing. I stripped out all the echo and print_r statements, but I had a large number of them in the code. Everything that I can think of has been tried to no avail. Any help that you can render would be deeply appreciated.

Thanks again,

Ethan




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

I've spent hours researching this with no luck.  I have a PDF with a form
field that I want to populate and output the PDF.  Can someone point me in
the right direction?  Can FPDF do this natively, or I need something else?
 My host doesn't have PDFLib installed, so that's not an option.  Thanks.

-- 
-Dan Joseph

http://www.danjoseph.me

--- End Message ---
--- Begin Message ---
On May 3, 2012 8:53 PM, "Dan Joseph" <dmjos...@gmail.com> wrote:
>
> Hi,
>
> I've spent hours researching this with no luck.  I have a PDF with a form
> field that I want to populate and output the PDF.  Can someone point me in
> the right direction?  Can FPDF do this natively, or I need something else?
>  My host doesn't have PDFLib installed, so that's not an option.  Thanks.
>
> --
> -Dan Joseph
>
> http://www.danjoseph.me

Yeah you can load the pdf and overlay the text on top of it with fpdf there
should be an example of that on the fpdf site

--- End Message ---
--- Begin Message ---
On May 3, 2012 9:08 PM, "David OBrien" <dgobr...@gmail.com> wrote:
>
>
> On May 3, 2012 8:53 PM, "Dan Joseph" <dmjos...@gmail.com> wrote:
> >
> > Hi,
> >
> > I've spent hours researching this with no luck.  I have a PDF with a
form
> > field that I want to populate and output the PDF.  Can someone point me
in
> > the right direction?  Can FPDF do this natively, or I need something
else?
> >  My host doesn't have PDFLib installed, so that's not an option.
 Thanks.
> >
> > --
> > -Dan Joseph
> >
> > http://www.danjoseph.me
>
> Yeah you can load the pdf and overlay the text on top of it with fpdf
there should be an example of that on the fpdf site

I just found fpdfi using Google. It looks like what you need

--- End Message ---
--- Begin Message ---
On Thu, May 3, 2012 at 9:13 PM, David OBrien <dgobr...@gmail.com> wrote:

> I just found fpdfi using Google. It looks like what you need
>

Wow, you said the key phrase in your last e-mail, 'text on top'.  I didn't
think of that.  fpdi/fpdf does that like a charm, thanks!

-- 
-Dan Joseph

http://www.danjoseph.me

--- End Message ---
--- Begin Message ---
I need to access a FUNCTION I programmed within a different FUNCTION.  Are 
these able to be passed like a variable?  Or are they able to become like a 
$_SESSION variable in nature?  How am I able to do this?  

I am essentially programming:

===
function name( $flag1, $flag2 ) {

# some PHP

echo name_of_a_different_function( $flag1 , $flag2 );

}
===

The error I am receiving is “Call to undefined function 
name_of_a_different_function”

Thanks, Ron

Ron Piggott


www.TheVerseOfTheDay.info 

--- End Message ---
--- Begin Message ---
On Thu, May 3, 2012 at 10:12 PM, Ron Piggott <ron.pigg...@actsministries.org
> wrote:

> I need to access a FUNCTION I programmed within a different FUNCTION.  Are
> these able to be passed like a variable?  Or are they able to become like a
> $_SESSION variable in nature?  How am I able to do this?
>
> I am essentially programming:
>
> ===
> function name( $flag1, $flag2 ) {
>
> # some PHP
>
> echo name_of_a_different_function( $flag1 , $flag2 );
>
> }
> ===
>
> The error I am receiving is “Call to undefined function
> name_of_a_different_function”
>
>
Are these inside classes or anything?  If they're just functions, they
should work fine together, example of 2 working functions together:

<?php

hellotwo();

function helloone()
{
        echo "hi 1";
}

function hellotwo()
{
        helloone();
}

?>

This results in "hi 1" being echoed to the screen.

-- 
-Dan Joseph

http://www.danjoseph.me

--- End Message ---
--- Begin Message ---
On Fri, May 4, 2012 at 4:29 AM, Dan Joseph <dmjos...@gmail.com> wrote:
>
> Are these inside classes or anything?  If they're just functions, they
> should work fine together, example of 2 working functions together:
>
> <?php
>
> hellotwo();
>
> function helloone()
> {
>        echo "hi 1";
> }
>
> function hellotwo()
> {
>        helloone();
> }
>
> ?>
>
> This results in "hi 1" being echoed to the screen.
>
> --
> -Dan Joseph
>
> http://www.danjoseph.me

Hi, Ron

Another hint:
Maybe the other function (you want to call inside your first function)
is not defined at that time but in a file that's included later on ...

Bye
Simon

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

I think that a few number of people use Emacs to write Php, in fact for
proffesionals porpuse the people use a IDE for Php, like Netbeams, Eclipse
PDT or Zend Studio.

Regards,
Gerardo

On Wed, May 2, 2012 at 8:21 AM, Mihamina Rakotomandimby
<miham...@rktmb.org>wrote:

> Hi all,
>
> For curiosity, are there people here using Emacs to code in PHP?
> What modes do you add? cedet, ecb,...
>
> I see (just for the example) that Drupal has a short documentation page
> for Emacs http://drupal.org/node/59868
>
> Have you got some in your bookmarks for general PHP coding?
>
> --
> RMA.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Gerardo Benitez
-------------------------
Programador Web Freelance

--- End Message ---

Reply via email to