php-general Digest 29 Jan 2003 10:07:34 -0000 Issue 1851

Topics (messages 133445 through 133473):

Re: register_globals
        133445 by: Mike.Kent.indystar.com
        133450 by: Justin French

Re: Get command line output
        133446 by: Jeff Warrington

Re: Good XML/XSLT mailing list?
        133447 by: Jeff Warrington

Re: best way to save form data on user side
        133448 by: Mike.Kent.indystar.com
        133449 by: Justin French
        133461 by: Hugh Danaher

Advice on uploaded files
        133451 by: Manuel Ochoa
        133452 by: Justin French

content type header for downloading files
        133453 by: Dara Dowd
        133456 by: Evan Nemerson
        133462 by: Dara Dowd
        133464 by: Ernest E Vogelsinger

php and sql problem with mysql_query and insert
        133454 by: Sunfire
        133465 by: Ernest E Vogelsinger

Remembering which option in a SELECT tag the user had chosen
        133455 by: Webapprentice
        133463 by: Jason Wong

best way to pass variables to <iframe>
        133457 by: Mantas Kriauciunas
        133460 by: Justin French

Functions and arguments
        133458 by: Blaine von Roeder
        133459 by: Jason Wong

using custom "button" instead of standard "submit" form element
        133466 by: Durwood Gafford
        133469 by: Justin French
        133471 by: Ernest E Vogelsinger

Using custom "button" form element instead of standard "submit"?
        133467 by: Durwood Gafford

[ANN] TemplateTamer - release candidate
        133468 by: rush

Re: Found a PHP bug!!!!!!!!!
        133470 by: Alexander Skwar

Re: Masive mail Advice
        133472 by: Alexander Skwar

Last error: how to get?
        133473 by: Jean-Christian Imbeault

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
Depending on whether you're using GET or POST, try

If($_GET['id'] == 1)
or
if($_POST['id'] == 1)

Check out http://www.php.net/manual/en/print/reserved.variables.php



                                                                                       
                                                
                      "Kiswa"                                                          
                                                
                      <[EMAIL PROTECTED]>        To:       [EMAIL PROTECTED]     
                                                
                                               cc:                                     
                                                
                      01/28/2003 02:41         Subject:  [PHP] register_globals        
                                                
                      PM                                                               
                                                
                                                                                       
                                                
                                                                                       
                                                




I know its stupid but i´ve been writing a site for a register_globals = on
enviroment
now i need to convert all the code to an off setting

the page is built by sending a whole lot off vars to diferent pages.
as you can see below the hyperlink sends the id var to the same page and
then echos the code.
can anyone help humpty dumpty?




<font size="2"><a href="left.php?id=1" target="_self">Finansiering</a><BR>
<?
 If($id==1){
 echo "<a href=info/leas.htm target=\"mainFrame\"><font
color=\"#00CCCC\">Leasing</font></a><BR>
 <a href=info/avb.htm target=\"mainFrame\"><font color=\"#00CCCC\">Räntefri
avbet.</font></a><BR>
 <a href=info/stul.htm target=\"mainFrame\"><font
color=\"#00CCCC\">Studentlån</font></a><BR>";
};
?>



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





--- End Message ---
--- Begin Message ---
on 29/01/03 6:41 AM, Kiswa ([EMAIL PROTECTED]) wrote:


change If($id==1){ to If($_GET['id']==1){

or put this line near the top of your script:

$id = $_GET['id'];

or, a little more anal:

if(isset($_GET['id'])) { $id = $_GET['id']; }


Justin




> <font size="2"><a href="left.php?id=1" target="_self">Finansiering</a><BR>
> <?
> If($id==1){
> echo "<a href=info/leas.htm target=\"mainFrame\"><font
> color=\"#00CCCC\">Leasing</font></a><BR>
> <a href=info/avb.htm target=\"mainFrame\"><font color=\"#00CCCC\">Räntefri
> avbet.</font></a><BR>
> <a href=info/stul.htm target=\"mainFrame\"><font
> color=\"#00CCCC\">Studentlån</font></a><BR>";
> };
> ?>
> 
> 

--- End Message ---
--- Begin Message ---
On Thu, 23 Jan 2003 00:14:07 +0800, Jason Wong wrote:

either use PHP to parse out the entirety of 
the output or make your command pipe its
output to other commands such as sed & awk
before it gets to PHP.

> w | tail +3 | awk '{print $1,$3,$5}'

Jeff


> On Thursday 23 January 2003 00:10, Greg Chagnon wrote:
>> Does anyone know how to get certain parts of the output from an exec of
>> a certain command?  For example...if I run "w" I get this output:
>>
>> [root@Lunar]:~> w
>>  11:02am  up 56 days, 17:39,  1 user,  load average: 0.07, 0.02, 0.00
>> USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU  WHAT
>> root pts/0    brpt-sh6-port214 11:01am  0.00s  0.27s  0.06s  w
>>
>> Now what if I just want the infor on the 3rd line, and info about anyone
>> else who is logged in, such as the username, the host, and the time
>> without getting all the uptime and the header info?  Thanks!
> 
> exec() 'returns' the output of the command in an array. Just extract from
> the array whatever line(s) you need.

--- End Message ---
--- Begin Message ---
On Wed, 22 Jan 2003 10:21:36 -0600, Chris Boget wrote:

This is a good Q&A site:

http://www.dpawson.co.uk/xsl/sect2/sect21.html

and XSLT-list here:

http://www.dpawson.co.uk/xsl/list.html

Jeff

> Sorry for the OT post but I know many of you use the above.  I subscribed
> the the PHP-XML mailing list but alas, haven't seen activity on it since
> the middle of last year.  Could you guys recommend a good (quality over
> quantity) XML/XSLT mailing list?  If it's a list geared more towards
> newbies, all the better but that wouldn't be a requirement.
> 
> Thanks for any assistance you can provide.
> 
> Chris

--- End Message ---
--- Begin Message ---
I agree on leveraging your position to guide this thing. Here you've added
the requirement of being able to revisit the data in a year.

Why not simply have them fill out the form, put it in the database and then
use another page with queries to draw the data into a similar template and
change it as needed? Simple forms should handle this just fine, and you can
require passwords to the data.

As far as filling it out online, let them pull up the form, fill it out and
reconnect, then press submit.

Wouldn't this cover what you want?



                                                                                       
                                                
                      Petre Agenbag                                                    
                                                
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]              
                                                
                      za>                      cc:       [EMAIL PROTECTED]     
                                                
                                               Subject:  Re: [PHP] best way to save 
form data on user side                             
                      01/28/2003 03:17                                                 
                                                
                      PM                                                               
                                                
                                                                                       
                                                
                                                                                       
                                                




Hi Chris

On Tue, 2003-01-28 at 22:09, Chris Shiflett wrote:
> --- Petre Agenbag <[EMAIL PROTECTED]> wrote:
> > I have a rather annoying problem regarding forms.
> > I have built an app that allows the users to fill
> > in a rather large form (much like a claim form)
> > and then have the data pumped into a mysql db.
> > The problem is: the users want to be able to
> > "save" their forms on their systems as a)
> > backup/proof that they have filled it in and b)
> > for their records for future use and c) the hope
> > is that it would also allow for a reliable method
> > to complete the form off-line and then submit it
> > when online again.
>
> Well, this sounds like a bad idea in general, but if you
> have no choice in the matter, I suppose cookies can fulfill
> the need.
>
> Anything you implement like this is going to lessen the
> security of the data, because rather than the client
> sending it to you once, you are going to expose it over the
> Internet several times. If this risk is acceptable for
> whatever reason, then cookies are probably no less secure
> for this data than anything else.
>
> Normally, I would highly recommend *not* storing client
> data on cookies, because that opens you up to several types
> of attacks, but you can accomplish what you want to do with
> this method. Only "punish" those who want this feature by
> setting these cookies only for those who choose to save
> this data locally. You could help the situation by
> encrypting the data in your cookies, so that only
> presentation attacks are a concern, but your users wouldn't
> be able to easily look at their data as verification of
> anything.
>
> My recommendation is to leverage your position as the
> technical expert to advise a more proper solution, one that
> you agree to, not them. They should not be consulted
> regarding application design unless they have experience
> with it. Rather, they should be describing their needs and
> let you (or the technical lead / project manager) do the
> technical design.
This is exactly what I'm looking to do; but my problem remains: I don't
know what the best solution is.
The problem is clear: the users actually need an electronic copy of the
data they submit; they must revisit certain issues annually, and would
need to access the data they submitted the previous year; either for
review purposes, or to make the new submission a speedy matter of simply
changing the details that are different from last year.
It's much like a normal office scenario: each person works on Word docs
that need to be shared with others, yet needs to be editable and must be
saved etc, BUT the difference here is that the data of all the
collective sources must be entered into a central db. So the "non
technical" solution would be for the users to do the forms in "word",
then fax it to the central office, where you have a temp type the data
into the db... we can't have that now...
Any ideas?

PS, I don't think cookies are going to do this. Remember, the user needs
to be able to access and re-submit the form at any stage.
>
> Good luck to you.
>
> Chris



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





--- End Message ---
--- Begin Message ---
on 29/01/03 6:35 AM, Petre Agenbag ([EMAIL PROTECTED]) wrote:

> Hi
> I have a rather annoying problem regarding forms.
> I have built an app that allows the users to fill in a rather large form
> (much like a claim form) and then have the data pumped into a mysql db.
> The problem is: the users want to be able to "save" their forms on their
> systems as a) backup/proof that they have filled it in and b) for their
> records for future use and c) the hope is that it would also allow for a
> reliable method to complete the form off-line and then submit it when
> online again.
> 
> So, I'm not sure what the best way is to tackle this situation. My gutt
> says it would need some kind of client stand alone app, but I wouldn't
> want to go there unless I am proven beyond reasonable doubt that it is
> the only way.


There are different issues here

If they want to save a half-completed form, you *could* save that data
server side in either a table, temporary table, or file, and have them
log-in to continue using it.  I have done this many times.  You could also
save the data client-side with cookies, but there's no guarantee that
cookies will work on a specific client.

If they want back-up/proof of doing it, then they can print the browser
screen as they fill it in, AND, you can give them a confirmation page which
prints all the form values back to the browser as a printable HTML page
which they can either print or save as TEXT or HTML.

Writing something that works offline for completion online later sounds like
you're trying to make the web do something it wasn't designed for.  The only
solution I can think of is client-side javascript saving the form
information as a browser cookie, but there's no way I'd bother, because it
would require the user to have both javascript and cookies enabled, and I
think there's also issues with the issuing domain of the cookie.


> The users are mostly in computer limbo, and if they had their way, they
> would want to use "Word or Excel" to complete the forms, save it to
> their hard drive and "click to send it away"...


You can create a form inside a PDF document, and it can POST the completed
data to a URL.  So they could complete the form offline, print it, whatever,
then connect, and hit submit.  It would open a browser window with a URL
like http://yourdomain.com/parseThePDFForm.php and then you would have your
submitted data.


Whilst not as a elegant, they COULD fill in an excel file, and upload it via
a browser.

Same with word.

I'm not sure if wither excel or word has any method of POSTing data.


With all these client-side options, there's zero hope of getting them to
correct missing fields though :)



Decide if this is something you want to achieve on the web, or offline.  If
on the web, keep it basic, with perhaps a save to server option and a
printable thankyou/proof page.  If offline, I think PDF forms are the best
of a bad bunch.


Justin French

--- End Message ---
--- Begin Message ---
You could use the mail() function to automatically send an email to your
user.  In the email could be an html page with the same form they'd filled
out plus some hidden input fields which would tell you that they are
updating their stored information.  With this, your user gets confirmation
of what was submitted, a way to edit their initial input and a record which
they can keep on their own computer.
Hope this helps,
Hugh

----- Original Message -----
From: "Petre Agenbag" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 28, 2003 11:35 AM
Subject: [PHP] best way to save form data on user side


> Hi
> I have a rather annoying problem regarding forms.
> I have built an app that allows the users to fill in a rather large form
> (much like a claim form) and then have the data pumped into a mysql db.
> The problem is: the users want to be able to "save" their forms on their
> systems as a) backup/proof that they have filled it in and b) for their
> records for future use and c) the hope is that it would also allow for a
> reliable method to complete the form off-line and then submit it when
> online again.
>
> So, I'm not sure what the best way is to tackle this situation. My gutt
> says it would need some kind of client stand alone app, but I wouldn't
> want to go there unless I am proven beyond reasonable doubt that it is
> the only way.
>
> The users are mostly in computer limbo, and if they had their way, they
> would want to use "Word or Excel" to complete the forms, save it to
> their hard drive and "click to send it away"...
>
> Help!, Please?!
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I writting a php program for a small insurance company and they want to receive 
uploaded digital photos.

Should I store the photos in a mysql database or in a directory on the hard drive?

If you have experience with this any advice would be appreciated.
--- End Message ---
--- Begin Message ---
on 29/01/03 11:16 AM, Manuel Ochoa ([EMAIL PROTECTED]) wrote:

> I writting a php program for a small insurance company and they want to
> receive uploaded digital photos.
> 
> Should I store the photos in a mysql database or in a directory on the hard
> drive?
> 
> If you have experience with this any advice would be appreciated.


I prefer storing them in the filesystem, and using the MySQL database to
keep track of WHERE they are (link).  There of course are SOME problems with
that... mainly because the two are not joined at the hip... someone could
accidently trash the file, or the MYSQL record, without deleting the other.

Storing the image directly in MySQL has never appealed to me, because you
have to do a little more work to get the image out (sending headers, having
an image script, etc), and mainly because the size of the DB increases
dramatically... which makes backing up more difficult/time consuming.

Each to their own though :)


Justin

--- End Message ---
--- Begin Message ---
I have the following headers in download.php which forces a download dialog box to be 
opened when a user clicks on a desired file:

header("Content-type: application/octet");
header("Content-Length: $filelength");  header("Content-Disposition: attachment; 
filename=".basename($fname).";");

This works fine with IE, but Mozilla adds a '.php' extension to the filename if i 
choose the save option, and asks me to choose which application to use if I want to 
open the file. The files are binary.
Do I need to change the content-type header? If so, to what? If not, what do I do?
Thanks, Dara
-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Change
header("Content-Disposition: attachment; filename=".basename($fname).";");
to
header("Content-Disposition: inline; filename=".basename($fname).";");


On Tuesday 28 January 2003 06:27 pm, Dara Dowd wrote:
> I have the following headers in download.php which forces a download dialog
> box to be opened when a user clicks on a desired file:
>
> header("Content-type: application/octet");
> header("Content-Length: $filelength");        header("Content-Disposition:
> attachment; filename=".basename($fname).";");
>
> This works fine with IE, but Mozilla adds a '.php' extension to the
> filename if i choose the save option, and asks me to choose which
> application to use if I want to open the file. The files are binary. Do I
> need to change the content-type header? If so, to what? If not, what do I
> do? Thanks, Dara
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+N2aH/rncFku1MdIRAvilAKCn7xrFd+TeIYYCr99xyH59fih16wCfTCHI
+7dGxJJU5ikFk/H+zhkZ9hw=
=bwBj
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
No, that doesn't change anything with Mozilla, and as for IE the file is automatically 
displayed in the browser. I actually want the Dialog Box to appear. I think Mozilla 
doesn't know what to do with 'application/octet.'

Dara
----- Original Message -----
From: Evan Nemerson <[EMAIL PROTECTED]>
Date: Tue, 28 Jan 2003 21:28:19 -0800
To: "Dara Dowd" <[EMAIL PROTECTED]>
Subject: Re: [PHP] content type header for downloading files 

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Change
> header("Content-Disposition: attachment; filename=".basename($fname).";");
> to
> header("Content-Disposition: inline; filename=".basename($fname).";");
> 
> 
> On Tuesday 28 January 2003 06:27 pm, Dara Dowd wrote:
> > I have the following headers in download.php which forces a download dialog
> > box to be opened when a user clicks on a desired file:
> >
> > header("Content-type: application/octet");
> > header("Content-Length: $filelength");      header("Content-Disposition:
> > attachment; filename=".basename($fname).";");
> >
> > This works fine with IE, but Mozilla adds a '.php' extension to the
> > filename if i choose the save option, and asks me to choose which
> > application to use if I want to open the file. The files are binary. Do I
> > need to change the content-type header? If so, to what? If not, what do I
> > do? Thanks, Dara
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
> 
> iD8DBQE+N2aH/rncFku1MdIRAvilAKCn7xrFd+TeIYYCr99xyH59fih16wCfTCHI
> +7dGxJJU5ikFk/H+zhkZ9hw=
> =bwBj
> -----END PGP SIGNATURE-----
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
For the largest free email in Ireland (25MB) & 
File Storage space (20MB), visit http://www.campus.ie

Powered by Outblaze
--- End Message ---
--- Begin Message ---
At 03:27 29.01.2003, Dara Dowd said:
--------------------[snip]--------------------
>I have the following headers in download.php which forces a download dialog 
>box to be opened when a user clicks on a desired file:
>
>header("Content-type: application/octet");
>header("Content-Length: $filelength"); header("Content-Disposition: 
>attachment; filename=".basename($fname).";");
--------------------[snip]-------------------- 

The correct Content-type is "application/octet-stream". Should work with that.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
hi ...

im having a little problem with mysql_query("insert into members
('$company', '$name1', '$name2', '$address1', '$address2', ''$ac1', '$ext2',
'$num1', '$ac2', '$ext2', '$num2', '$city', '$state', '$zip', '$desc',
'$flags')");

for some reason those variables are empty by the time they get into the
table...
im running mysql 3.2.3.x, php 4 used as module in apache, windows me and
apache 1.3.4xxxx  the variables come from a form and then posted to a
comfirmation page where all the contents of the variables are printed in a
table before  user would click the continue link at the bottum of the
page... after that the link would call a file called addtolist.php which
would add the var list to a table and return either an error message or a
success message.. i havent yet found how to have a php script load a new web
page other than include() or require() and dont know if that is making my
problem or just what it is... i will include the test file called
addtolist.php below...:
<?php
mysql_db_query("wata", "insert into members VALUES('$company', '$name1',
'$name2', '$address1', '$address2', '$city', '$state', '$zip', '$ac1',
'$ext1', '$num1', '$ac2', '$ext2', '$num2', '$desc', '$flags')");
echo "\n";
echo mysql_error();

echo <<<ENDOF_BLOCK
$post['name1']
your entry was added!!!!

go back to the main menu by clicking <a href="main.htm">here</a>.
ENDOF_BLOCK;
?>
tnx for the help



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003

--- End Message ---
--- Begin Message ---
At 05:17 29.01.2003, Sunfire said:
--------------------[snip]--------------------
>hi ...
>
>im having a little problem with mysql_query("insert into members
>('$company', '$name1', '$name2', '$address1', '$address2', ''$ac1', '$ext2',
>'$num1', '$ac2', '$ext2', '$num2', '$city', '$state', '$zip', '$desc',
>'$flags')");
>
>for some reason those variables are empty by the time they get into the
>table...

Are these variables received by handling a form submit? You should use the
$_REQUEST array if you have register_globals off:

mysql_query("insert into members
('{$_REQUEST['company']}', '{$_REQUEST['name1']}', '{$_REQUEST['name2']}',
'{$_REQUEST['address1']}', '{$_REQUEST['address2']}', '{$_REQUEST['ac1']}',
'{$_REQUEST['ext2']}', '{$_REQUEST['num1']}', '{$_REQUEST['ac2']}',
'{$_REQUEST['ext2']}', '{$_REQUEST['num2']}', '{$_REQUEST['city']}',
'{$_REQUEST['state']}', '{$_REQUEST['zip']}', '{$_REQUEST['desc']}',
'{$_REQUEST['flags']}')");

Two other 'littles' I see:
- your original statement comes with two single quotes before "$ac1", this
will break the query if it's not a message typo here.
- the "ext2" value is inserted twice
- I personally prefer to explicitly name the columns on any insert, even if
I populate all columns. If by chance your table structure will change
(using ALTER TABLE) your insert statement will break.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message --- Hi,
I have a SELECT on a web form.

<select name="TimeChoice">
<option value="Friday August 22, 04:00 PM - 06:00 PM">Friday August 22, 04:00 PM - 06:00 PM</option>
<option value="Friday August 22, 06:00 PM - 08:00 PM">Friday August 22, 06:00 PM - 08:00 PM</option>
<option value="Friday August 22, 08:00 PM - 10:00 PM">Friday August 22, 08:00 PM - 10:00 PM</option>
<option value="Friday August 22, 10:00 PM - 12:00 AM">Friday August 22, 10:00 PM - 12:00 AM</option>
<option value="Saturday August 23, 12:00 AM - 02:00 AM">Saturday August 23, 12:00 AM - 02:00 AM</option>
<option value="Saturday August 23, 12:00 PM - 02:00 PM">Saturday August 23, 12:00 PM - 02:00 PM</option>
<option value="Saturday August 23, 02:00 PM - 04:00 PM">Saturday August 23, 02:00 PM - 04:00 PM</option>
<option value="Saturday August 23, 04:00 PM - 06:00 PM">Saturday August 23, 04:00 PM - 06:00 PM</option>
<option value="Saturday August 23, 06:00 PM - 08:00 PM">Saturday August 23, 06:00 PM - 08:00 PM</option>
<option value="Saturday August 23, 08:00 PM - 10:00 PM">Saturday August 23, 08:00 PM - 10:00 PM</option>
<option value="Saturday August 23, 10:00 PM - 12:00 AM">Saturday August 23, 10:00 PM - 12:00 AM</option>
<option value="Sunday August 24, 12:00 AM - 02:00 AM">Sunday August 24, 12:00 AM - 02:00 AM</option>
<option value="Sunday August 24, 12:00 PM - 02:00 PM">Sunday August 24, 12:00 PM - 02:00 PM</option>
<option value="Sunday August 24, 02:00 PM - 04:00 PM">Sunday August 24, 02:00 PM - 04:00 PM</option>
</select>

Only one option may be chosen

When I submit this form, there could be errors. When I have errors, I wish to reprint the form with the user's values remembered. In the reprinted SELECT tag, one of the OPTION tags will now have a SELECTED attribute. Is there any elegant way to insert the SELECTED attribute on the right option?

Thanks,
Stephen



--- End Message ---
--- Begin Message ---
On Wednesday 29 January 2003 12:48, Webapprentice wrote:

> I have a SELECT on a web form.
>
> <select name="TimeChoice">
> <option value="Friday August 22, 04:00 PM - 06:00 PM">Friday August 22,
> 04:00 PM - 06:00 PM</option> <option value="Friday August 22, 06:00 PM -
> 08:00 PM">Friday August 22, 06:00 PM - 08:00 PM</option> <option
> value="Friday August 22, 08:00 PM - 10:00 PM">Friday August 22, 08:00 PM -
> 10:00 PM</option> <option value="Friday August 22, 10:00 PM - 12:00
> AM">Friday August 22, 10:00 PM - 12:00 AM</option> <option value="Saturday
> August 23, 12:00 AM - 02:00 AM">Saturday August 23, 12:00 AM - 02:00
> AM</option> <option value="Saturday August 23, 12:00 PM - 02:00
> PM">Saturday August 23, 12:00 PM - 02:00 PM</option> <option

[snip]

> Only one option may be chosen
>
> When I submit this form, there could be errors.  When I have errors, I
> wish to reprint the form with the user's values remembered.  In the
> reprinted SELECT tag, one of the OPTION tags will now have a SELECTED
> attribute.  Is there any elegant way to insert the SELECTED attribute on
> the right option?

The way to do it is to programmatically output the <SELECT> element. 

Store the options in an array, then step through the array building up the 
<SELECT> and <OPTION> tags inserting "selected" where appropriate. 

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
You seek to shield those you love and you like the role of the provider.
*/

--- End Message ---
--- Begin Message ---
Hey!
I believe there was question like this, but I was wondering if someone
could point me with useful information about passing variables to
<iframe>.
Is there some tutorials about that? Or some help files about that, ways
to do it.
Thanks!
 
-mNTKz
--- End Message ---
--- Begin Message ---
on 29/01/03 4:35 PM, Mantas Kriauciunas ([EMAIL PROTECTED]) wrote:

> I believe there was question like this, but I was wondering if someone
> could point me with useful information about passing variables to
> <iframe>.

To point out the obvious, you can pass variables to any URL by using GET:
<iframe src="page.php?var1=foo&var2=bah"></iframe>

iframes can be targeted with links just like a regular frame, using
target="frameName"

Other options would be to have variables stored in sessions, in cookies, or
via POST variables (I think).

But (to the best of my knowledge), since PHP is server-side, these pretty
much all rely on reading/acting on the variables whilst the page is being
processed and sent by the server.

I get the feeling you perhaps want to have an existing page in an existing
iframe react in relation to things happening elsewhere... correct?

I don't think it REALLY can, since once the frame's content is server-side,
it has nothing to do with PHP.  You basically need to force the frame's
contents to refresh, perhaps with new variables passed in with either GET,
POST, sessions or Cookies.

Javascript can read cookies, but I don't think this is your answer at all.


You need to be more specific about what you want to achieve.


Justin

--- End Message ---
--- Begin Message ---
Greetings,
I'm working on a system to track homework and assignments for
teachers/students. I'm in high school, and I decided I was sick of writing
down the homework for the day, so I'm building a site that will allow
teachers to post assignments/homework for each of their classes. Students
can then go online and view it, but I digress.

I'm working on the part of the site to parse your session for student id,
check the students table for your class listing(named period1, period2,
period3, etc), and then check the classes table based on the id numbers in
your students.period1(etc) fields. I've created a function for parsing the
assignments table against your session id and such, and pulling up the
posted assignments. However this is where I hit a brick wall.

I need to pass the class_id argument to the function. I.e. class_id 1234 to
pull up all the matching assignments on class 1234. I don't know how to pass
it dynamically though, based upon the settings in your
students.user.period1.

I was thinking along the lines of using a for statement, with a nested
switch. Here's what I've rather conjured up thusfar, which I can't get to
work.

:::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::
for($i = 0;$i < 7;$i++) {
  switch ($i) {
   case 0:
   $class_info = mysql_query("SELECT * FROM classes WHERE $id =
".$classes_array[period0]);
   $class_info_array = mysql_fetch_array($classes);
   $class_id = $class_info_array[id];
   display_class_assign($class_id)
:::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::

The cases are all the same, except period0 is replaced with period1,
period2, etc. up to case 7 which is periodpaws. Classes_array refers to
this:

:::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::
$classes = mysql_query("SELECT period1, period2, period3, period4, period5,
period6, periodpaws, period0 FROM students WHERE id = $id");

$classes_array = mysql_fetch_array($classes);
:::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::

I can post the code for the function if I need to, but I don't think that's
where the problem lies. The way I've set it up it works fine if i do
display_class_assigns(1234) and it pulls up the fields, displays, etc
perfectly.

Thanks for your time,
Blaine von Roeder

PS: I'm sort of new to the entire PHP scene(learning as I go) so if there
are any tweaks or optimizations I can use(such as not using that unwieldy
switch with lots of nearly identical code), please let me know.


--- End Message ---
--- Begin Message ---
On Wednesday 29 January 2003 13:31, Blaine von Roeder wrote:

> I'm working on the part of the site to parse your session for student id,
> check the students table for your class listing(named period1, period2,
> period3, etc), and then check the classes table based on the id numbers in
> your students.period1(etc) fields. I've created a function for parsing the
> assignments table against your session id and such, and pulling up the
> posted assignments. However this is where I hit a brick wall.
>
> I need to pass the class_id argument to the function. I.e. class_id 1234 to
> pull up all the matching assignments on class 1234. I don't know how to
> pass it dynamically though, based upon the settings in your
> students.user.period1.
>
> I was thinking along the lines of using a for statement, with a nested
> switch. Here's what I've rather conjured up thusfar, which I can't get to
> work.
>
> :::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::
>
> for($i = 0;$i < 7;$i++) {
>   switch ($i) {
>    case 0:
>    $class_info = mysql_query("SELECT * FROM classes WHERE $id =
> ".$classes_array[period0]);
>    $class_info_array = mysql_fetch_array($classes);
>    $class_id = $class_info_array[id];
>    display_class_assign($class_id)
>
> :::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::
>
> The cases are all the same, except period0 is replaced with period1,
> period2, etc. up to case 7 which is periodpaws. Classes_array refers to
>
> this:
> :::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::
>
> $classes = mysql_query("SELECT period1, period2, period3, period4, period5,
> period6, periodpaws, period0 FROM students WHERE id = $id");
>
> $classes_array = mysql_fetch_array($classes);
>
> :::::::::::::::::::::::::::::CODE:::::::::::::::::::::::::::::
>
> I can post the code for the function if I need to, but I don't think that's
> where the problem lies. The way I've set it up it works fine if i do
> display_class_assigns(1234) and it pulls up the fields, displays, etc
> perfectly.

What happens when you run this?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Swipple's Rule of Order:
        He who shouts the loudest has the floor.
*/

--- End Message ---
--- Begin Message ---
I can't figure out how to tell which button was pressed by a user when i'm
using a "button" instead of a standard "submit" form element.

This works:

<input type="submit" name="parent" value="foo">
$parent will equal "foo"

This doesn't work:

<button type="submit" name="parent" value="foo"><img
src="icon.gif"></button>
$parent will equal "<img src="icon.gif"> NOT "foo"

How do I get the value of "foo" to be returned in $parent and still use a
graphical icon instead of a standard submit button?

thanks,
durwood ([EMAIL PROTECTED])


--- End Message ---
--- Begin Message ---
The W3.org site is down at the moment, so I can't confirm this, but I'm
pretty sure...

<input type="submit" name="parent" value="foo" src="icon.gif" />

... is correct, but I've never done it :)

I think the page you want to look at is:
http://www.w3.org/TR/html401/interact/forms.html#edef-INPUT

Cheers,

Justin


on 27/01/03 1:02 PM, Durwood Gafford ([EMAIL PROTECTED]) wrote:

> I can't figure out how to tell which button was pressed by a user when i'm
> using a "button" instead of a standard "submit" form element.
> 
> This works:
> 
> <input type="submit" name="parent" value="foo">
> $parent will equal "foo"
> 
> This doesn't work:
> 
> <button type="submit" name="parent" value="foo"><img
> src="icon.gif"></button>
> $parent will equal "<img src="icon.gif"> NOT "foo"
> 
> How do I get the value of "foo" to be returned in $parent and still use a
> graphical icon instead of a standard submit button?
> 
> thanks,
> durwood ([EMAIL PROTECTED])
> 
> 

--- End Message ---
--- Begin Message ---
At 10:08 29.01.2003, Justin French said:
--------------------[snip]--------------------
>The W3.org site is down at the moment, so I can't confirm this, but I'm
>pretty sure...
>
><input type="submit" name="parent" value="foo" src="icon.gif" />

<input type="image" name="parent" value="foo" src="icon.gif" />

AFAIR


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
I can't figure out how to tell which button was pressed by a user when i'm
using a "button" instead of a standard "submit" form element.

This works:

<input type="submit" name="parent" value="foo">
$parent will equal "foo"

This doesn't work:

<button type="submit" name="parent" value="foo"><img
src="icon.gif"></button>
$parent will equal "<img src="icon.gif"> NOT "foo"

How do I get the value of "foo" to be returned in $parent and still use a
graphical icon instead of a standard submit button?

thanks,
durwood ([EMAIL PROTECTED])



--- End Message ---
--- Begin Message ---
TemplateTamer is a tool for creating and maintaining a template based
dynamic PHP web applications, with clearly and completely separated code
from the html design. As such it is a great tool for complex dynamic sites,
especially where Designers and Programmers work together on the creation of
the site.

It's main parts are:

* Integrated development environment (IDE)
* Framework for development of template based applications
* Code generator
* Template engine

The release candidate can be downloaded from TemplateTamer site:

http://www.templatetamer.com/

rush
--
http://www.templatetamer.com/



--- End Message ---
--- Begin Message ---
So sprach 1LT John W. Holmes am 2003-01-27 um 15:49:33 -0500 :
> Actually, "08" is equal to 8 in PHP. PHP will convert the string to an

No, that's not true:

if ("08" == 8){ echo "equal"; }
if ("08" === 8){ echo "more equal"; }

This will only print "equal" and not "more equal".

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:       http://www.iso-top.biz     |    Jabber: [EMAIL PROTECTED]
   iso-top.biz - Die günstige Art an Linux Distributionen zu kommen
                       Uptime: 1 day 15 hours 46 minutes
--- End Message ---
--- Begin Message ---
So sprach Maciek Ruckgaber Bielecki am 2003-01-25 um 23:17:14 -0500 :
> mail() function is not a good option for this purpose. (the amount of mail
> to be sent may vary from 50 to 800 messages). I have considered using some

Have a look at the PHPMailer classes.  It's supposed to be ultra fast.

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:       http://www.iso-top.biz     |    Jabber: [EMAIL PROTECTED]
   iso-top.biz - Die günstige Art an Linux Distributionen zu kommen
                       Uptime: 1 day 16 hours 2 minutes
--- End Message ---
--- Begin Message --- Is there a simple way for me to programmatically know if an error has occurred during my script? (besides from writing a custom error handler?)

I want to be able to know at the end of my script if any errors where thrown and then show a simple message. I know that if the error is fatal my script won't run to completion but that is ok as a fatal error in this case should be fatal.

Is there some function like get_last_error()?

Thanks,

Jc

--- End Message ---

Reply via email to