php-general Digest 5 Feb 2010 22:49:21 -0000 Issue 6575

Topics (messages 301827 through 301837):

Re: Facebook PHP compiler
        301827 by: German Geek
        301831 by: ebhakt

Re: HTML & plain text in Outlook 2007
        301828 by: Phpster
        301829 by: Ashley Sheridan
        301832 by: Robert Cummings

Re: How to change a filename for download (e.g. jpeg, pdf etc.)
        301830 by: SED

PHP generated HTML has submit button which picks up the wrong url.
        301833 by: Mary Anderson
        301834 by: Joseph Thayne
        301836 by: Ashley Sheridan
        301837 by: Joseph Thayne

Re: Appalling Dreamweaver performance
        301835 by: Lenin

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 ---
Yes. Totally agree. Would like to try asap.
++Tim Hinnerk Heuer++

http://www.ihostnz.com


On 3 February 2010 10:15, Adam Richardson <simples...@gmail.com> wrote:

> Looks very promising !!!
>
> On Tue, Feb 2, 2010 at 1:12 PM, Robert Cummings <rob...@interjinn.com
> >wrote:
>
> > Cesar D. Rodas wrote:
> >
> >> Hello,
> >>
> >> Have you guys checked this PHP to C++ converter from the Facebook
> People?
> >>
> >> http://developers.facebook.com/news.php?blog=1&story=358
> >>
> >
> > Very interesting... I heard about this a few days ago on Slashdot. Most
> > people figured it would be a compiler of some sort, though it's
> interesting
> > they chose C++ instead of C as Roadsend has done. I also wonder why they
> > didn't just jump on board with Roadsend, but perhaps they wanted full
> > control (which makes sense from the perspective of their needs).
> >
> > Either way, it's another tool that can only be good for PHP.
> >
> > Cheers,
> > Rob.
> > --
> > http://www.interjinn.com
> > Application and Templating Framework for PHP
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>

--- End Message ---
--- Begin Message ---
Thanks for th einfo man!!

On Fri, Feb 5, 2010 at 3:35 AM, German Geek <geek...@gmail.com> wrote:

> Yes. Totally agree. Would like to try asap.
> ++Tim Hinnerk Heuer++
>
> http://www.ihostnz.com
>
>
> On 3 February 2010 10:15, Adam Richardson <simples...@gmail.com> wrote:
>
> > Looks very promising !!!
> >
> > On Tue, Feb 2, 2010 at 1:12 PM, Robert Cummings <rob...@interjinn.com
> > >wrote:
> >
> > > Cesar D. Rodas wrote:
> > >
> > >> Hello,
> > >>
> > >> Have you guys checked this PHP to C++ converter from the Facebook
> > People?
> > >>
> > >> http://developers.facebook.com/news.php?blog=1&story=358
> > >>
> > >
> > > Very interesting... I heard about this a few days ago on Slashdot. Most
> > > people figured it would be a compiler of some sort, though it's
> > interesting
> > > they chose C++ instead of C as Roadsend has done. I also wonder why
> they
> > > didn't just jump on board with Roadsend, but perhaps they wanted full
> > > control (which makes sense from the perspective of their needs).
> > >
> > > Either way, it's another tool that can only be good for PHP.
> > >
> > > Cheers,
> > > Rob.
> > > --
> > > http://www.interjinn.com
> > > Application and Templating Framework for PHP
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> > --
> > Nephtali:  PHP web framework that functions beautifully
> > http://nephtaliproject.com
> >
>



-- 
Bhaskar Tiwari
GTSE Generalist
Directory Services
Microsoft

\____________________________________________________________
All we have to decide is what to do with the time that has been given to us

bhaskartiw...@officeliveusers.com

http://www.ebhakt.com/
http://fytclub.net/

http://bhaskartiwari.web.officelive.com/
http://ebhakt.spaces.live.com/

--- End Message ---
--- Begin Message --- Ire ently needed to do this for a client as well. I took their word doc and converted it to HTML with open office. This created a template that I just do some search and replace to fill in the criteria.

This has worked very well with outlook and hotmail and gmail.

Not sure if it will fit your needs, but it could be worth a try.

Bastien

Sent from my iPod

On Feb 5, 2010, at 5:32 AM, Richard Quadling <rquadl...@googlemail.com> wrote:

On 4 February 2010 16:44, Skip Evans <s...@bigskypenguin.com> wrote:
Hey all,

First, let me say thanks for all the advice on Magento, and especially to Ryan who has used the beast and gave some great advice on skinning, links to some good docs and a book just for my designer. We'll be using and I'm
looking forward to learning it.

But anyway...

I'm doing some maintenance work on a system that sends an email message using the multi-part boundaries to include both a plain text version and an
HTML version of an email.

I've read up on this before, but never actually done it. So implementing the code was not a big issue, and in fact it works perfectly when tested on my Ubuntu machine using Thunderbird to test the HTML and Evolution to test the plain text version. In fact, I can switch formats on both of these and all
looks great.

Enter Microsoft (Insert opening of Bach's Toccata and Fugue in D minor to
send chills up my readers' spines.)

On Outlook 2007 in HTML mode it renders, how can I put this... half- assedly. In text mode the whole things a bust. There is the HTML code all stuffed up
at the top, boundary codes are visible, just plain awful.

Googling around I see articles from 2007 when that version of Outlook came out lamenting the fact that MS pulled the IE rendering engine from it and replaced it with MS Word's renderer to plug security holes expoitable via
email.

Does anyone have any experience with HTML & plain text multi-part messages and Outlook 2007, or any tips how I can get this working? Still Googling,
but any tips would be greatly appreciated.

Skip
--
====================================
Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
 -- Kurt Vonnegut

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



I create HTML.Mime based emails in PHP with a plain text part which is
basically a cop out saying that they should upgrade.

The HTML part is a fax form. They print it out, add some stickers
relating to work carried out and then fax it back (or email it as a
TIFF or PDF if they have the skills/tech to do that).

I use Outlook 2003 (work) and GMail via Chrome (personal).

The form includes embedded images (essentially their logo as the forms
are passed to their clients) and have a PDF attached ( a report from
our systems about the email they are receiving).

All fairly simple.

1 - Plain Text - (Please upgrade)
2 - Alternative HTML
3 -          Embedded images
4 - Attachment

For this, I use RMail from phpguru.org (previously known as
html_mime_mail5) http://www.phpguru.org/static/Rmail

The HTML I used contains limited CSS and is table based.

I initially did it "properly", or so I thought.

I'd used IE7/FireFox/Safari/Opera as a test of a proper HTML page with
CSS to produce a nice looking form. Scaled nicely, limited shrink,
etc.

Looked OK in Outlook 2003 too!

But when I sent them for approval to the line manager, who uses
Outlook 2007, well, let's just say he didn't understand the form at
all!

Even when I redid it with tables, I'd used <thead>, <tfoot>, <tbody>
(proper HTML at least). In O2K7? It renders in order - header, footer,
body. Great!

So, the HTML I ended up with REALLY looks like something from when I
was first learning HTML (I just worked it out as being 13 years ago!).

So, yes. The code is horribly old fashioned. But it works.


--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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


--- End Message ---
--- Begin Message ---
On Fri, 2010-02-05 at 08:03 -0500, Phpster wrote:

> Ire ently needed to do this for a client as well. I took their word  
> doc and converted it to HTML with open office. This created a template  
> that I just do some search and replace to fill in the criteria.
> 
> This has worked very well with outlook and hotmail and gmail.
> 
> Not sure if it will fit your needs, but it could be worth a try.
> 
> Bastien
> 
> Sent from my iPod
> 
> On Feb 5, 2010, at 5:32 AM, Richard Quadling  
> <rquadl...@googlemail.com> wrote:
> 
> > On 4 February 2010 16:44, Skip Evans <s...@bigskypenguin.com> wrote:
> >> Hey all,
> >>
> >> First, let me say thanks for all the advice on Magento, and  
> >> especially to
> >> Ryan who has used the beast and gave some great advice on skinning,  
> >> links to
> >> some good docs and a book just for my designer. We'll be using and  
> >> I'm
> >> looking forward to learning it.
> >>
> >> But anyway...
> >>
> >> I'm doing some maintenance work on a system that sends an email  
> >> message
> >> using the multi-part boundaries to include both a plain text  
> >> version and an
> >> HTML version of an email.
> >>
> >> I've read up on this before, but never actually done it. So  
> >> implementing the
> >> code was not a big issue, and in fact it works perfectly when  
> >> tested on my
> >> Ubuntu machine using Thunderbird to test the HTML and Evolution to  
> >> test the
> >> plain text version. In fact, I can switch formats on both of these  
> >> and all
> >> looks great.
> >>
> >> Enter Microsoft (Insert opening of Bach's Toccata and Fugue in D  
> >> minor to
> >> send chills up my readers' spines.)
> >>
> >> On Outlook 2007 in HTML mode it renders, how can I put this... half- 
> >> assedly.
> >> In text mode the whole things a bust. There is the HTML code all  
> >> stuffed up
> >> at the top, boundary codes are visible, just plain awful.
> >>
> >> Googling around I see articles from 2007 when that version of  
> >> Outlook came
> >> out lamenting the fact that MS pulled the IE rendering engine from  
> >> it and
> >> replaced it with MS Word's renderer to plug security holes  
> >> expoitable via
> >> email.
> >>
> >> Does anyone have any experience with HTML & plain text multi-part  
> >> messages
> >> and Outlook 2007, or any tips how I can get this working? Still  
> >> Googling,
> >> but any tips would be greatly appreciated.
> >>
> >> Skip
> >> --
> >> ====================================
> >> Skip Evans
> >> PenguinSites.com, LLC
> >> 503 S Baldwin St, #1
> >> Madison WI 53703
> >> 608.250.2720
> >> http://penguinsites.com
> >> ------------------------------------
> >> Those of you who believe in
> >> telekinesis, raise my hand.
> >>  -- Kurt Vonnegut
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> > I create HTML.Mime based emails in PHP with a plain text part which is
> > basically a cop out saying that they should upgrade.
> >
> > The HTML part is a fax form. They print it out, add some stickers
> > relating to work carried out and then fax it back (or email it as a
> > TIFF or PDF if they have the skills/tech to do that).
> >
> > I use Outlook 2003 (work) and GMail via Chrome (personal).
> >
> > The form includes embedded images (essentially their logo as the forms
> > are passed to their clients) and have a PDF attached ( a report from
> > our systems about the email they are receiving).
> >
> > All fairly simple.
> >
> > 1 - Plain Text - (Please upgrade)
> > 2 - Alternative HTML
> > 3 -          Embedded images
> > 4 - Attachment
> >
> > For this, I use RMail from phpguru.org (previously known as
> > html_mime_mail5) http://www.phpguru.org/static/Rmail
> >
> > The HTML I used contains limited CSS and is table based.
> >
> > I initially did it "properly", or so I thought.
> >
> > I'd used IE7/FireFox/Safari/Opera as a test of a proper HTML page with
> > CSS to produce a nice looking form. Scaled nicely, limited shrink,
> > etc.
> >
> > Looked OK in Outlook 2003 too!
> >
> > But when I sent them for approval to the line manager, who uses
> > Outlook 2007, well, let's just say he didn't understand the form at
> > all!
> >
> > Even when I redid it with tables, I'd used <thead>, <tfoot>, <tbody>
> > (proper HTML at least). In O2K7? It renders in order - header, footer,
> > body. Great!
> >
> > So, the HTML I ended up with REALLY looks like something from when I
> > was first learning HTML (I just worked it out as being 13 years ago!).
> >
> > So, yes. The code is horribly old fashioned. But it works.
> >
> >
> > -- 
> > -----
> > Richard Quadling
> > "Standing on the shoulders of some very clever giants!"
> > EE : http://www.experts-exchange.com/M_248814.html
> > EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> > ZOPA : http://uk.zopa.com/member/RQuadling
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 


It's the testing part that takes the time though. You've got the email
clients that are only available on Windows, the ones that are only
available on Macs, those that are only around on Linux, and then those
that are only accessible online. There are companies that test emails
for you and send you back screenshots of your emails, but to my
knowledge, they all charge for this service.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
On Thu, 2010-02-04 at 13:44 -0500, Robert Cummings wrote:

What about signing yourself up to some newsletters to see how they do
it?

Looking at the ones I get from Facebook as an example, they use the
boundary codes you mentioned, and I can't see anything particularly
special that's been added. What order are you sending the two message
parts by the way? I think the traditional way is to send the plain/text
part first, so that UA's that don't understand or support multipart
messages only use the first one. As you mentioned that you're seeing
HTML code at the top, I'd hazard a guess that you're sending the HTML
first?
The problem is most likely NOT his email structure, but the fact that Microsoft in all their lock-in, make things difficult, non standard, monopolistic philosophy chose to switch out the IE HTML renderer (which was getting pretty decent with IE7 and IE8) with the Office HTML renderer... so now basic things like CSS padding of something as simple as a <p> tag is not possible. You now need to use margins instead. The full list of supported attributes / CSS can be found here:

     http://msdn.microsoft.com/en-us/library/aa338201.aspx

Obviously creating HTML emails was getting too easy (like it is with Thunderbird). Of course... I guess it could be as bad as Google stripping out the stylesheets entirely when viewing HTML content which forces you to put the styles on the tags themselves.

... actually I'm not sure what's worse... at least you can use standard styles with Google's gmail. Either way... making nice looking HTML emails that work across Outlook, Thunderbird, Gmail, Yahoo, and Hotmail is a pain in the ass.

Cheers,
Rob.


If he's getting HTML output at the top of the email, I would think that
did suggest that MS Word didn't like the structure. Making HTML emails
is now such a difficult job, as the email clients rendering engines tend
to not get updated as often as browsers, and there doesn't seem to be
any effort in bringing the rendering of the email clients together.

Whenever I create these emails I try to make sure I try no to get too
creative in the design, and use not only CSS styles, but properties of
the HTML tags themselves. It means I end up writing the CSS essentially
twice and backing it up with old deprecated HTML attributes, but it
usually does the trick.

Is there any effort by some standards group that email clients could
benefit from?

I think I skipped over some relevant information in the original post :)

Still... as you've said... email HTML sucks... and MS made it worse.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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

I finally got the time to test your solutions, the following is the best
solution and causes a minimum stress on the server and a decent security.

        header('Content-type: application/pdf');
        header('Content-Disposition: attachment;
filename="downloaded.pdf"');
        readfile('original.pdf');
        header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
        header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the
past

(Script from php.net based on your hints.)

I have tested this in many ways, but before I did not know how this was
simple.

SED


-----Original Message-----
From: richard.he...@gmail.com [mailto:richard.he...@gmail.com] On Behalf Of
Richard
Sent: 25. janĂșar 2010 10:16
To: SED
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] How to change a filename for download (e.g. jpeg, pdf
etc.)

Hi,

> Can anyone point me to tutorials on how to change a filename for each
> download? My goal is to give the downloader a random name for a picture or
a
> document, so he will never know what the original filename is.

Try adding a Content-Disposition header:

<?php
    header('Content-disposition: attachment; filename=fname.ext');
?>

-- 
Richard Heyes
HTML5 canvas graphing: RGraph - http://www.rgraph.net (updated 16th January)
Follow me on Twitter: http://twitter.com/_rgraph
Lots of PHP and Javascript code - http://www.phpguru.org




--- End Message ---
--- Begin Message ---
Hi,
I am writing code in PHP which generates HTML script. My app is fairly complex. Twice in the development of the application I have run into a problem with submit buttons which pick up the wrong url. Instead of call the url for that submit button, it appears to call the url for the first submit button on the page. The problem may be intermittent, which seems to suggest that something funny is happening with the cache. Clearing the cache did not help in the last go around. I am including the generated html code. Hitting the button 'Retrieve all ...' should call up the url get_query_forms.php. Instead it calls up the url query_form_display_data.php, which is the url for the first submit button on the page.

  Any clues to clear up this mystery would be greatly appreciated!

Mary Anderson

------------------------------------------------------------------------





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<LINK href="./DMEM.css" type=text/css rel=stylesheet>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Display Data</title>
</head>
<body> <form id="display_data" name="display_data" method="POST" action=./query_form_display_data.php?perm_batch_file=perm&pg_query_form_id=518&data_table_id=255&data_batch_id=&query_form_schema=permanent_queries&batch_input_file_id=&create_tmp_data_tables=0">

<p >
<big>72 rows have been returned by this query</big>
</p><br>
<p >

<table >

<tr >

<th >

</th>

<td >
<input type='text' name='max_row_count' size='3' value='0' ></input>

</td>

</tr>

</table>
<br><br>
<p >
<input type='submit'  name='worksheet_join_element_initialize' value='Change worksheet : Change max row count' 
onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'"
 ></input>
<input type='submit'  name='display_results' value='Display query results' 
onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'"
 ></input>
<input type='submit'  name='generate_csv_file' value='Generate csv file' 
onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'"
 ></input>

<p >
<input type='submit'  name='edit_existing_query_form' value='Revise query' 
onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'"
 ></input>
<input type='submit'  name='retrieve_existing_query_forms' value='Retrieve all permanent query forms for this 
table type' 
onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=permanent_queries&user_name=&data_table_type_id='"
 ></input>
<input type='submit'  name='retrieve_existing_query_forms' value='Retrieve all temporary query forms for this 
table type' 
onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=temporary_queries&user_name=&data_table_type_id='"
 ></input>
<input type='submit'  name='select_table_type' value='Change data table type' 
onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=perm&user_name='"
 ></input>

</p>
<p >
<input type='submit'  name='home' value='Home' 
onClick="form.action='http://unproto.demog.berkeley.edu/memdemo'" ></input>

</p><input type='hidden' id='perm_batch_file' name='perm_batch_file' value='perm'><input type='hidden' id='tmp_data_values_table' 
name='tmp_data_values_table' value='display.perm_tmp_data_values_518'><input type='hidden' id='pg_query_form_id' name='pg_query_form_id' 
value='518'><input type='hidden' id='query_form_schema' name='query_form_schema' value='permanent_queries'><input type='hidden' 
id='data_table_id' name='data_table_id' value='255'><input type='hidden' id='data_batch_id' name='data_batch_id' value='218'><input type='hidden' 
id='batch_input_file_id' name='batch_input_file_id' value=''><input type='hidden' id='tf_directory' name='tf_directory' value=''><input 
type='hidden' id='tf_filename' name='tf_filename' value=''><input type='hidden' id='data_table_type_id' name='data_table_type_id' value=''><input 
type='hidden' id='user_name' name='user_name' value=''></form>
</body>
</html>


--- End Message ---
--- Begin Message --- This is actually a javascript issue rather than a PHP issue. What is happening is that the action of the form is what is being submitted. The action never changes. What you need to do is have the javascript change the action as well as submit the form (which means you will need to move it to a function). It would also help to empty out the form action as well.

Example JS function:
function retrieveAllPerm()
{
document.display_data.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries';
document.display_data.submit();
}

Example submit button:
<button name='edit_existing_query_form' onClick="javascript:retrieveAllPerm();" >Revise query</button>

Joseph

Mary Anderson wrote:
Hi,
I am writing code in PHP which generates HTML script. My app is fairly complex. Twice in the development of the application I have run into a problem with submit buttons which pick up the wrong url. Instead of call the url for that submit button, it appears to call the url for the first submit button on the page. The problem may be intermittent, which seems to suggest that something funny is happening with the cache. Clearing the cache did not help in the last go around. I am including the generated html code. Hitting the button 'Retrieve all ...' should call up the url get_query_forms.php. Instead it calls up the url query_form_display_data.php, which is the url for the first submit button on the page.

  Any clues to clear up this mystery would be greatly appreciated!

Mary Anderson

------------------------------------------------------------------------





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<LINK href="./DMEM.css" type=text/css rel=stylesheet>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Display Data</title>
</head>
<body> <form id="display_data" name="display_data" method="POST" action=./query_form_display_data.php?perm_batch_file=perm&pg_query_form_id=518&data_table_id=255&data_batch_id=&query_form_schema=permanent_queries&batch_input_file_id=&create_tmp_data_tables=0">

<p >
<big>72 rows have been returned by this query</big>
</p><br>
<p >

<table >

<tr >

<th >

</th>

<td >
<input type='text' name='max_row_count' size='3' value='0' ></input>

</td>

</tr>

</table>
<br><br>
<p >
<input type='submit' name='worksheet_join_element_initialize' value='Change worksheet : Change max row count' onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'" ></input> <input type='submit' name='display_results' value='Display query results' onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'" ></input> <input type='submit' name='generate_csv_file' value='Generate csv file' onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'" ></input>

<p >
<input type='submit' name='edit_existing_query_form' value='Revise query' onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'" ></input> <input type='submit' name='retrieve_existing_query_forms' value='Retrieve all permanent query forms for this table type' onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=permanent_queries&user_name=&data_table_type_id='" ></input> <input type='submit' name='retrieve_existing_query_forms' value='Retrieve all temporary query forms for this table type' onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=temporary_queries&user_name=&data_table_type_id='" ></input> <input type='submit' name='select_table_type' value='Change data table type' onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=perm&user_name='" ></input>

</p>
<p >
<input type='submit' name='home' value='Home' onClick="form.action='http://unproto.demog.berkeley.edu/memdemo'" ></input>

</p><input type='hidden' id='perm_batch_file' name='perm_batch_file' value='perm'><input type='hidden' id='tmp_data_values_table' name='tmp_data_values_table' value='display.perm_tmp_data_values_518'><input type='hidden' id='pg_query_form_id' name='pg_query_form_id' value='518'><input type='hidden' id='query_form_schema' name='query_form_schema' value='permanent_queries'><input type='hidden' id='data_table_id' name='data_table_id' value='255'><input type='hidden' id='data_batch_id' name='data_batch_id' value='218'><input type='hidden' id='batch_input_file_id' name='batch_input_file_id' value=''><input type='hidden' id='tf_directory' name='tf_directory' value=''><input type='hidden' id='tf_filename' name='tf_filename' value=''><input type='hidden' id='data_table_type_id' name='data_table_type_id' value=''><input type='hidden' id='user_name' name='user_name' value=''></form>
</body>
</html>



--- End Message ---
--- Begin Message ---
On Fri, 2010-02-05 at 14:33 -0600, Joseph Thayne wrote:

> This is actually a javascript issue rather than a PHP issue.  What is 
> happening is that the action of the form is what is being submitted.  
> The action never changes.  What you need to do is have the javascript 
> change the action as well as submit the form (which means you will need 
> to move it to a function).  It would also help to empty out the form 
> action as well.
> 
> Example JS function:
> function retrieveAllPerm()
> {
> document.display_data.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries';
> document.display_data.submit();
> }
> 
> Example submit button:
> <button name='edit_existing_query_form' 
> onClick="javascript:retrieveAllPerm();" >Revise query</button>
> 
> Joseph
> 
> Mary Anderson wrote:
> > Hi,
> >   I am writing code in PHP which generates HTML script.  My app is 
> > fairly complex.  Twice in the development of the application I have 
> > run into a problem with submit buttons which pick up the wrong url.  
> > Instead of call the url for that submit button, it appears to call the 
> > url for the first submit button on the page.  The problem may be 
> > intermittent, which seems to suggest that something funny is happening 
> > with the cache.  Clearing the cache did not help in the last go around.
> > I am including the generated html code.  Hitting the button 'Retrieve 
> > all ...' should call up the url get_query_forms.php.  Instead it calls 
> > up the url query_form_display_data.php, which is the url for the first 
> > submit button on the page.
> >
> >   Any clues to clear up this mystery would be greatly appreciated!
> >
> > Mary Anderson
> >
> > ------------------------------------------------------------------------
> >
> >
> >
> >
> >
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > <html xmlns="http://www.w3.org/1999/xhtml";>
> > <LINK href="./DMEM.css" type=text/css rel=stylesheet>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> > <title>Display Data</title>
> > </head>
> > <body> <form id="display_data" name="display_data" method="POST"      
> > action=./query_form_display_data.php?perm_batch_file=perm&pg_query_form_id=518&data_table_id=255&data_batch_id=&query_form_schema=permanent_queries&batch_input_file_id=&create_tmp_data_tables=0">
> >  
> >
> >
> > <p >
> > <big>72 rows have been returned by this query</big>
> > </p><br>
> > <p >
> >
> > <table >
> >
> > <tr >
> >
> > <th >
> >
> > </th>
> >
> > <td >
> > <input type='text' name='max_row_count' size='3' value='0' ></input>
> >
> > </td>
> >
> > </tr>
> >
> > </table>
> > <br><br>
> > <p >
> > <input type='submit'  name='worksheet_join_element_initialize' 
> > value='Change worksheet : Change max row count' 
> > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'"
> >  
> > ></input>
> > <input type='submit'  name='display_results' value='Display query 
> > results' 
> > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'"
> >  
> > ></input>
> > <input type='submit'  name='generate_csv_file' value='Generate csv 
> > file' 
> > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'"
> >  
> > ></input>
> >
> > <p >
> > <input type='submit'  name='edit_existing_query_form' value='Revise 
> > query' 
> > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'"
> >  
> > ></input>
> > <input type='submit'  name='retrieve_existing_query_forms' 
> > value='Retrieve all permanent query forms for this table type' 
> > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=permanent_queries&user_name=&data_table_type_id='"
> >  
> > ></input>
> > <input type='submit'  name='retrieve_existing_query_forms' 
> > value='Retrieve all temporary query forms for this table type' 
> > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=temporary_queries&user_name=&data_table_type_id='"
> >  
> > ></input>
> > <input type='submit'  name='select_table_type' value='Change data 
> > table type' 
> > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=perm&user_name='"
> >  
> > ></input>
> >
> > </p>
> > <p >
> > <input type='submit'  name='home' value='Home' 
> > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo'" 
> > ></input>
> >
> > </p><input type='hidden' id='perm_batch_file' name='perm_batch_file' 
> > value='perm'><input type='hidden' id='tmp_data_values_table' 
> > name='tmp_data_values_table' 
> > value='display.perm_tmp_data_values_518'><input type='hidden' 
> > id='pg_query_form_id' name='pg_query_form_id' value='518'><input 
> > type='hidden' id='query_form_schema' name='query_form_schema' 
> > value='permanent_queries'><input type='hidden' id='data_table_id' 
> > name='data_table_id' value='255'><input type='hidden' 
> > id='data_batch_id' name='data_batch_id' value='218'><input 
> > type='hidden' id='batch_input_file_id' name='batch_input_file_id' 
> > value=''><input type='hidden' id='tf_directory' name='tf_directory' 
> > value=''><input type='hidden' id='tf_filename' name='tf_filename' 
> > value=''><input type='hidden' id='data_table_type_id' 
> > name='data_table_type_id' value=''><input type='hidden' id='user_name' 
> > name='user_name' value=''></form>
> > </body>
> > </html>
> >
> >
> 


Bit of advice though, don't use Javascript to submit a form. Firstly,
Javascript isn't available on all browsers, and on those it is available
on, not everyone has it turned on. The W3C has the stats for Javascript
being unavailable in a browser at about 5%. Imagine that your site is
only aimed at the population of the UK, 5% of 61 million is still over 3
million people. Obviously that doesn't take into consideration the ages
of people who'd be using your site, but it's worth stopping and thinking
about. Also, anyone using a mobile is unlikely to have Javascript
enabled too, and a lot of people use mobiles these days for browsing and
such whilst on the move.

Secondly, you're using the onclick handler to submit a form. This is
very bad, as you totally alienate anyone who visits your site that has a
disability that prevents them using a mouse. So, anyone with hand
problems like severe arthritis or missing hands, or anyone who is blind
is shut out from your site.

What you maybe ought to consider is using several submit buttons, and
give each a name and a value. That way, your PHP script can check for a
specifically named variable sent from the form. That way, you keep many
people happy, and your site still works perfectly.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message --- "What you maybe ought to consider is using several submit buttons, and give each a name and a value. That way, your PHP script can check for a specifically named variable sent from the form. That way, you keep many people happy, and your site still works perfectly."

The problem with doing it that way is that IE is not happy with multiple submit buttons in a single form. To get around that, you can use image input types or buttons. Also, a return key does not send values the same way as a mouse click. I can't remember which browser does what, but the three possible submitted values are (providing the name of the button is submit):

submit
submit_x and submit_y
submit_x, submit_y, and submit

Just something to be aware of if you are looking for the value of the submit button -- not 100% reliable. It would be better to use a hidden form value or just check to see if submit or submit_x is set.

Joseph

Ashley Sheridan wrote:
On Fri, 2010-02-05 at 14:33 -0600, Joseph Thayne wrote:
This is actually a javascript issue rather than a PHP issue. What is happening is that the action of the form is what is being submitted. The action never changes. What you need to do is have the javascript change the action as well as submit the form (which means you will need to move it to a function). It would also help to empty out the form action as well.

Example JS function:
function retrieveAllPerm()
{
document.display_data.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'
 
<http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries%27>;
document.display_data.submit();
}

Example submit button:
<button name='edit_existing_query_form' onClick="javascript:retrieveAllPerm();" >Revise query</button>

Joseph

Mary Anderson wrote:
> Hi,
> I am writing code in PHP which generates HTML script. My app is > fairly complex. Twice in the development of the application I have > run into a problem with submit buttons which pick up the wrong url. > Instead of call the url for that submit button, it appears to call the > url for the first submit button on the page. The problem may be > intermittent, which seems to suggest that something funny is happening > with the cache. Clearing the cache did not help in the last go around. > I am including the generated html code. Hitting the button 'Retrieve > all ...' should call up the url get_query_forms.php. Instead it calls > up the url query_form_display_data.php, which is the url for the first > submit button on the page.
>
>   Any clues to clear up this mystery would be greatly appreciated!
>
> Mary Anderson
>
> ------------------------------------------------------------------------
>
>
>
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <LINK href="./DMEM.css" type=text/css rel=stylesheet>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> <title>Display Data</title>
> </head>
> <body> <form id="display_data" name="display_data" method="POST" > action=./query_form_display_data.php?perm_batch_file=perm&pg_query_form_id=518&data_table_id=255&data_batch_id=&query_form_schema=permanent_queries&batch_input_file_id=&create_tmp_data_tables=0"> >
>
> <p >
> <big>72 rows have been returned by this query</big>
> </p><br>
> <p >
>
> <table >
>
> <tr >
>
> <th >
>
> </th>
>
> <td >
> <input type='text' name='max_row_count' size='3' value='0' ></input>
>
> </td>
>
> </tr>
>
> </table>
> <br><br>
> <p >
> <input type='submit' name='worksheet_join_element_initialize' > value='Change worksheet : Change max row count' > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries' <http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries%27>" > ></input> > <input type='submit' name='display_results' value='Display query > results' > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries' <http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries%27>" > ></input> > <input type='submit' name='generate_csv_file' value='Generate csv > file' > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries' <http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries%27>" > ></input>
>
> <p >
> <input type='submit' name='edit_existing_query_form' value='Revise > query' > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries' <http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries%27>" > ></input> > <input type='submit' name='retrieve_existing_query_forms' > value='Retrieve all permanent query forms for this table type' > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=permanent_queries&user_name=&data_table_type_id=' <http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=%27perm%27&query_form_schema=permanent_queries&user_name=&data_table_type_id=%27>" > ></input> > <input type='submit' name='retrieve_existing_query_forms' > value='Retrieve all temporary query forms for this table type' > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=temporary_queries&user_name=&data_table_type_id=' <http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=%27perm%27&query_form_schema=temporary_queries&user_name=&data_table_type_id=%27>" > ></input> > <input type='submit' name='select_table_type' value='Change data > table type' > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=perm&user_name=' <http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=perm&user_name=%27>" > ></input>
>
> </p>
> <p >
> <input type='submit' name='home' value='Home' > onClick="form.action='http://unproto.demog.berkeley.edu/memdemo' <http://unproto.demog.berkeley.edu/memdemo%27>" > ></input>
>
> </p><input type='hidden' id='perm_batch_file' name='perm_batch_file' > value='perm'><input type='hidden' id='tmp_data_values_table' > name='tmp_data_values_table' > value='display.perm_tmp_data_values_518'><input type='hidden' > id='pg_query_form_id' name='pg_query_form_id' value='518'><input > type='hidden' id='query_form_schema' name='query_form_schema' > value='permanent_queries'><input type='hidden' id='data_table_id' > name='data_table_id' value='255'><input type='hidden' > id='data_batch_id' name='data_batch_id' value='218'><input > type='hidden' id='batch_input_file_id' name='batch_input_file_id' > value=''><input type='hidden' id='tf_directory' name='tf_directory' > value=''><input type='hidden' id='tf_filename' name='tf_filename' > value=''><input type='hidden' id='data_table_type_id' > name='data_table_type_id' value=''><input type='hidden' id='user_name' > name='user_name' value=''></form>
> </body>
> </html>
>
>


Bit of advice though, don't use Javascript to submit a form. Firstly, Javascript isn't available on all browsers, and on those it is available on, not everyone has it turned on. The W3C has the stats for Javascript being unavailable in a browser at about 5%. Imagine that your site is only aimed at the population of the UK, 5% of 61 million is still over 3 million people. Obviously that doesn't take into consideration the ages of people who'd be using your site, but it's worth stopping and thinking about. Also, anyone using a mobile is unlikely to have Javascript enabled too, and a lot of people use mobiles these days for browsing and such whilst on the move.

Secondly, you're using the onclick handler to submit a form. This is very bad, as you totally alienate anyone who visits your site that has a disability that prevents them using a mouse. So, anyone with hand problems like severe arthritis or missing hands, or anyone who is blind is shut out from your site.

What you maybe ought to consider is using several submit buttons, and give each a name and a value. That way, your PHP script can check for a specifically named variable sent from the form. That way, you keep many people happy, and your site still works perfectly.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Try the NetBeans then

--- End Message ---

Reply via email to