|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Fri Nov 29 2002 - 05:47:32 CST
php-general Digest 29 Nov 2002 11:47:32 -0000 Issue 1733
Topics (messages 126443 through 126464):
Werid problemswith mail() command: From address on sent messages
126443 by: C.F. Scheidecker Antunes
Suppressing X-Return-Path
126444 by: Darren Fehrmann
Re: Is it possible to do this in PHP ? If it is then, how ?
126445 by: Axis Computers
126461 by: Marek Kilimajer
file creation date
126446 by: Research and Development
126450 by: John W. Holmes
Re: Postnuke --- Meta keywords and title different for all the pages...
126447 by: Peter Houchin
Re: File handling
126448 by: Justin French
126454 by: Jeff RingRose
126456 by: Jeff RingRose
Help with login/redirect/insert to dbase
126449 by: Karl James
IRCG/PHP and Apache 1.3
126451 by: Sascha Schumann
Logging out and session ids
126452 by: Gerard Samuel
126459 by: Tom Rogers
how to use mssql_connect()?
126453 by: Kim
Can't recover data in php posted with a form tag.
126455 by: Luc Roettgers
126457 by: Jeff RingRose
126458 by: Bastian Vogt
Re: Detecting email bounces sent by the mail function?
126460 by: Chris Hewitt
Questions on PHPs openssl extensions
126462 by: Richard Rojas
images
126463 by: Craig
Re: dynamic arraynames
126464 by: Ford, Mike [LSS]
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hello All,
I wonder if is there anyone who ever had the same problem and know how to solve it.
I have a web site that does send e-mail to some users based on requests. The problem is that although I pass the right user/from address on the mail function, the message source shows From as beeing apache
localhost and therefore some messages bouce back due to anti spam filters.
This server is a Red Hat Linux 7.2 and it does not have apache 2.0 but 1.3. It does not have sendmail runnig or installed but another server on the same network does have it.
The problem is that I do not want and cannot have my message headers with a From: Apache
LocalHost as this copy bellow shows:
I've changed the header variable and put a From in it so it does displays the right FROM: address as bellow. But as you can see, the Received: (from apache
localhost) by servername, etc is there so the spam filters filter it.
Return-Path: <apache>
Received: (from apache
localhost)
by ns1.nando.net (8.11.2/8.11.2) id gASLtQM27458;
Thu, 28 Nov 2002 19:55:26 -0200
Date: Thu, 28 Nov 2002 19:55:26 -0200
Message-Id: <200211282155.gASLtQM27458
ns1.dataware-bi.net>
To: nando
antunes.eti.br
Subject: Order # 603 (511066220021128194052)
Content-Type: text/html
From: nando
antunes.eti.br
Reply-To: nando
antunes.eti.br
X-Mailer: PHP/
My php.ini has an smtp entry but no sendmail is running on the local machine. Do I have to have one running? I wish I did not have to do it. Any other way to fix this issue?
Carlos Fernando Scheidecker Antunes
Linux User #207984
attached mail follows:
Has anyone had experience with PHP or a mail server setting the X-Return-Path header on mail sent using PHP's mail() command?
Our tests indicate the X-Return-Path is being set to the "sendmail_from" address found in php.ini. Our code definately isn't doing it, as a hello-world mail() example proved.
The system is running Win 2K, all current service packs and hot fixes, IIS 5, php 4.2.3 (running as a CGI), and the Zend optimizer 2.0.1. The mail server is Microsoft Exhange Server.
Does anyone know why the webserver or mail server would set the X-Return-Path, and if it can be suppressed?
Regards,
Darren Fehrmann
Storefront.com
attached mail follows:
Thanks for replying,
Now I know it's possible to do it, but I still don't know how can I develop
such interface, I will do it in php and mysql, but I need a little guidance
with the way to do it I just can't figure out how ...
Thank you
Ricardo Fitzgerald
----- Original Message -----
From: "Marek Kilimajer" <kilimajer
webglobe.sk>
To: "PHP" <php-general
lists.php.net>
Sent: Wednesday, November 27, 2002 10:34 AM
Subject: Re: [PHP] Is it possible to do this in PHP ? If it is then, how ?
> Using javascript you can change the src of image. So you start with
> blank image, and if onchange
> event handler finds out the input field has two chars, changes the src
> of the image to say show_image.php?id=input.value
>
> Axis Computers wrote:
>
> >Hi,
> >
> >I was wondering if this is possible to in PHP ... I am developing an
> >application for a pizza place, where touch typing interface is much
faster
> >than using the mouse, so I was wondering if I can develop an interface
with
> >a calculator style keypad, and the codes entered (using something like
STDIN
> >in Perl), are automatically compared to the MySQL database to provide
> >realtime feedback to the user, such as code 32 is hawaian pizza, and
after
> >the user enters code 32 Hawaian pizza get's displayed as feedback ... and
> >then awaits for some other input such as size, etc...
> >
> >i.e.
> >
> >x-----------------
> >32 Hawaian pizza 14" $ 12
> >xx xxxxxxxxxxxxx xx xxxx
> >
> >Total = ....
> >
> >
> >Thanks in advance,
> >
> >Ricardo Fitzgerald
> >AXIS Computers
> >Web development
> >
> >
> >__________________________________________________________________ Omni
> >ICQ#: 37031810 Current ICQ status: + More ways to contact me
> >__________________________________________________________________
> >
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
In the browser it might look something like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pizza place</title>
<script>
function add(n) {
document.pizza.num.value=document.pizza.num.value + n;
if(document.pizza.num.value.length!=2) {
document.pizzaimage.src='blank.jpg';
} else {
// alert("Pizza is " + document.pizza.num.value);
document.pizzaimage.src='show_image.php?img_id=' +
document.pizza.num.value;
}
}
</script>
</head>
<body>
<img src="blank.jpg" alt="" name="pizzaimage" id="pizzaimage" border="0">
<form action="" name="pizza">
<input type="text" name="num" onchange="checkimg(this.value)"> <input
type="button" value=" Clear " onclick="this.form.num.value=''; add('')"><br>
<input type="button" value=" 7 " accesskey="7" onclick="add('7')">
<input type="button" value=" 8 " accesskey="8" onclick="add('8')">
<input type="button" value=" 9 " accesskey="9" onclick="add('9')"> <br>
<input type="button" value=" 4 " accesskey="4" onclick="add('4')">
<input type="button" value=" 5 " accesskey="5" onclick="add('5')">
<input type="button" value=" 6 " accesskey="6" onclick="add('6')"> <br>
<input type="button" value=" 1 " accesskey="1" onclick="add('1')">
<input type="button" value=" 2 " accesskey="2" onclick="add('2')">
<input type="button" value=" 3 " accesskey="3" onclick="add('3')"> <br>
<input type="button" value=" 0 " accesskey="0" onclick="add('0')">
<input type="submit"
value=" Order "> <br>
</form>
</body>
</html>
Additional information (size, weitht ...) can be provided in the image
Axis Computers wrote:
>Thanks for replying,
>
>Now I know it's possible to do it, but I still don't know how can I develop
>such interface, I will do it in php and mysql, but I need a little guidance
>with the way to do it I just can't figure out how ...
>
>Thank you
>
>Ricardo Fitzgerald
>
>
>>
>>
>
>
>
>
attached mail follows:
Is it possible to get the creation date of a file that is going to be
uploaded? I saw a function that returns the file creation date once on
the server, but is it possible to get that information from a file that
is not yet on the server?
Thanks in advance.
attached mail follows:
> Is it possible to get the creation date of a file that is going to be
> uploaded? I saw a function that returns the file creation date once on
> the server, but is it possible to get that information from a file
that
> is not yet on the server?
Not with PHP.
---John Holmes...
attached mail follows:
Howdy,
ummmmm what exactly do you want to do? add meta tag's to each individual
page?
> -----Original Message-----
> From: Manoj Nahar [mailto:manoj
interlink-marketing.net]
> Sent: Friday, 29 November 2002 5:26 AM
> To: php-general
lists.php.net
> Subject: [PHP] Postnuke --- Meta keywords and title different for all
> the pages...
>
>
> Hi there,
>
> I would like to know has anybody being able to do this.
>
> Each page has its own meta keywords and title.
>
> I have searched lot of information about it but no luck.
>
> any help or pointer with this would be greatly appreciated.
>
> Manoj
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
> Quick one, how do i read a file for a key word, say "TEXt", and the delete
> the rest of the remaining file?
Do you mean:
a) how do i make sure a word (eg "foo") is in a file, and if it is, delete
all contents of the file except the word "foo" OR
b) how do i search a file for the word "foo", and delete everything in the
file AFTER the word "foo"
??
Justin French
--------------------
http://Indent.com.au
Web Development &
Graphic Design
--------------------
attached mail follows:
Justin,
Option b. delete all AFTER "foo", I.E. truncate the file directly after
"foo". Leaving "foo" and all the data before "foo" untouched.
Jeff
-----Original Message-----
From: Justin French [mailto:justin
indent.com.au]
Sent: 29 November 2002 04:29
To: Jeff; php-general
lists.php.net
Subject: Re: [PHP] File handling
> Quick one, how do i read a file for a key word, say "TEXt", and the delete
> the rest of the remaining file?
Do you mean:
a) how do i make sure a word (eg "foo") is in a file, and if it is, delete
all contents of the file except the word "foo" OR
b) how do i search a file for the word "foo", and delete everything in the
file AFTER the word "foo"
??
Justin French
--------------------
http://Indent.com.au
Web Development &
Graphic Design
--------------------
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorised. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful. Please immediately contact the sender if you have received this
message in error. Thank you.
attached mail follows:
I've got this coed but it still don't do the business:
$MESSAGE_FILE="foobar.txt";
$handle=fopen("$MESSAGE_FILE","w");
$sizez= sizeof($handle);
$string= 'foo';
while ( fgets($handle,$sisez)
{ fputs($handle,$sizez);
if (strstr($handle,$string)){
break;
}
}
Any ideas?
"Jeff Ringrose" <JRingRose
atlasalu.ie> wrote in message
news:97E3260093E08D43A791F2DF1584C29705C807
ATLAS2K.atlasalu.ie...
> Justin,
> Option b. delete all AFTER "foo", I.E. truncate the file directly after
> "foo". Leaving "foo" and all the data before "foo" untouched.
>
> Jeff
>
> -----Original Message-----
> From: Justin French [mailto:justin
indent.com.au]
> Sent: 29 November 2002 04:29
> To: Jeff; php-general
lists.php.net
> Subject: Re: [PHP] File handling
>
>
> > Quick one, how do i read a file for a key word, say "TEXt", and the
delete
> > the rest of the remaining file?
>
>
> Do you mean:
>
> a) how do i make sure a word (eg "foo") is in a file, and if it is, delete
> all contents of the file except the word "foo" OR
>
> b) how do i search a file for the word "foo", and delete everything in the
> file AFTER the word "foo"
>
> ??
>
>
> Justin French
> --------------------
> http://Indent.com.au
> Web Development &
> Graphic Design
> --------------------
>
>
> DISCLAIMER: The information in this message is confidential and may be
> legally privileged. It is intended solely for the addressee. Access to
this
> message by anyone else is unauthorised. If you are not the intended
> recipient, any disclosure, copying, or distribution of the message, or any
> action or omission taken by you in reliance on it, is prohibited and may
be
> unlawful. Please immediately contact the sender if you have received this
> message in error. Thank you.
>
>
attached mail follows:
Hello guys
Happy thanksgiving!!!
My question is
I'm Trying to apply this code to what I have done already on my site
http://robouk.mchost.com/tuts/tutorial.php?tutorial=login1
my site is this.
http://www.ultimatefootballleague.com
<http://www.ultimatefootballleague.com/>
Im trying to do with login and if login is good
It takes you to the team page.
But I have some questions on this and need to talk to someone online
If possible, I can meet via MSN and IRC
Please email if interested in helping.
attached mail follows:
Hi!
For all of you who are interested in running IRCG together
with Apache 1.3, I suggest you have a look at this page.
<URL:http://schumann.cx/ircg/ircg4.php>
Spoiler: IRCG 4 will run inside Apache 1.3.
----------
About IRCG
IRCG is a revolutionary way for dispatching messages to huge
groups of users over an arbitrary number of separate
communication channels in real-time. IRCG provides message
streams over persistent HTTP connections and can interface
with a subsystem to produce static file snippets. All aspects
of IRCG are scriptable using PHP. IRCG is format and content
agnostic, and can produce any output format you require,
including XML, XHTML/HTML, and WML.
Typical applications of IRCG include online gaming/gambling
sites and web chat systems.
- Sascha
attached mail follows:
I was just going through the archive. Seems this comes up enough for me
to think I have something wrong.
A simplistic code flow of events...
<?php
session_start();
// user successfully logs in, set a session variable
$_SESSION['user_id'];
// when the user logs out, destroy session and redirect to top
$_SESSION = array();
setcookie(session_name(), '', time() - 3600);
session_destroy();
header('location: back_to_top');
?>
Ok, so when the user logs in, a session id is assigned to them.
When they log out and are redirected to the beginning, the session id is
the same (verified by the file name in /tmp and cookie manager in mozilla).
My question is, even though the session contains no data after its
destroyed, should the session id remain the same, after logging out,
or should another be assigned when session_start() is called after the
redirect???
Thanks
-- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/
attached mail follows:
Hi,
Friday, November 29, 2002, 4:58:02 PM, you wrote: GS> I was just going through the archive. Seems this comes up enough for me GS> to think I have something wrong. GS> A simplistic code flow of events... GS> <?php GS> session_start();
GS> // user successfully logs in, set a session variable GS> $_SESSION['user_id'];
GS> // when the user logs out, destroy session and redirect to top GS> $_SESSION = array(); GS> setcookie(session_name(), '', time() - 3600); GS> session_destroy();
GS> header('location: back_to_top');
?>>
GS> Ok, so when the user logs in, a session id is assigned to them. GS> When they log out and are redirected to the beginning, the session id is GS> the same (verified by the file name in /tmp and cookie manager in mozilla). GS> My question is, even though the session contains no data after its GS> destroyed, should the session id remain the same, after logging out, GS> or should another be assigned when session_start() is called after the GS> redirect???
The browser will send the old cookie and as the name is probably the same as the the old session it will get used again, or at least I think that is what is happening :) This should not be a problem as the data associated with the old session is gone. If you close the browser and start a fresh one you will get a new session id.
-- regards, Tom
attached mail follows:
when i using mssql_connect() function,that's show "Fatal error: Call to undefined function: mssql_connect()" on php page,i don't know why that it is! php 4.2.3 sql server 2000 apache 1.3.19 windows 2000 pro
"php.ini" had configurated ok.
attached mail follows:
I have 2 files runQuery.php and doSQL.php, where the first one is posting data entered by the user to the second page and displaying it but the data never arrives. Any idea why this would not work, maybe some configuration issue?? Any help is really appreciated...
<!--
<!-- runQuery.php --> <DIV align="left"> <FORM name="sql" method=post action="doSQL.php"> <INPUT type="text" name="clSQL" size="50"><BR><BR> <INPUT type="submit" name="submit" value="Lancer requète"> <INPUT type="reset" name="reset" value="Effacer"><BR> </FORM> <I class="normal">i.e. select * from scpsft</I> </DIV>
<!-- doSQL.php --> <HTML> <BODY bgcolor="#efefde"> <H1>Résultat de la requète:</H1> <?PHP echo ($clSQL); ?> </BODY> </HTML>
-->
attached mail follows:
<FORM action='doSQL.php' method='POST'>
try that
jeff
"Luc Roettgers" <rol
provencale.lu> wrote in message
news:002401c29782$8300de10$3b09c881
rolxp...
I have 2 files runQuery.php and doSQL.php, where the first one is posting
data entered by the user to the second page and displaying it but the data
never arrives. Any idea why this would not work, maybe some configuration
issue?? Any help is really appreciated...
<!--
<!-- runQuery.php --> <DIV align="left"> <FORM name="sql" method=post action="doSQL.php"> <INPUT type="text" name="clSQL" size="50"><BR><BR> <INPUT type="submit" name="submit" value="Lancer requète"> <INPUT type="reset" name="reset" value="Effacer"><BR> </FORM> <I class="normal">i.e. select * from scpsft</I> </DIV>
<!-- doSQL.php --> <HTML> <BODY bgcolor="#efefde"> <H1>Résultat de la requète:</H1> <?PHP echo ($clSQL); ?> </BODY> </HTML>
-->
attached mail follows:
hi,
you could try to fetch the value from the superglobal variable "$_POST" or "$HTTP_POST_VARS" (echo $_POST[clSQL]; echo $HTTP_POST_VARS[clSQL];)
regars, bastian
Luc Roettgers schrieb:
> I have 2 files runQuery.php and doSQL.php, where the first one is posting data entered by the user to the second page and displaying it but the data never arrives. Any idea why this would not work, maybe some configuration issue?? Any help is really appreciated... > > <!-- > > <!-- runQuery.php --> > <DIV align="left"> > <FORM name="sql" method=post action="doSQL.php"> > <INPUT type="text" name="clSQL" size="50"><BR><BR> > <INPUT type="submit" name="submit" value="Lancer requète"> > <INPUT type="reset" name="reset" value="Effacer"><BR> > </FORM> > <I class="normal">i.e. select * from scpsft</I> > </DIV> > > <!-- doSQL.php --> > <HTML> > <BODY bgcolor="#efefde"> > <H1>Résultat de la requète:</H1> > <?PHP > echo ($clSQL); > ?> > </BODY> > </HTML> >
attached mail follows:
scott wrote:
>What would php run as on a cobalt raq4 so I don't get the x header >warning >Best regards > As php is a web application, it is the webserver sending emails. Apache runs as user "httpd" on the raq on which I have an account. Get it to send you an email so that you can check.
HTH Chris
attached mail follows:
I've been looking on PHP.net's manual for openssl functions but it seems that they have very little information on the said functions. Ive tried posting on mailing lists for some help but I havent been receiving fruitful responses. Some even told me that it is very difficult to find a great deal of information on client authentication, simply because 99% of SSL implementations are only concerned with authenticating the server.
I have an idea but I couldnt implement it because there are things that I wanted to know first.
Is there a way where I can get or reference the certificate submitted by the client when they connect to the server? Coz I looked at the openssl_x509_read() function and the manual says that openssl_x509_read() parses the certificate supplied by x509certdata and returns a resource identifier for it. However, Im wondring what is this x509certdata or how would I assign the client's certificate to this. Ive seen some examples but they all point to a definite path to the harddisk and not by remote connection.
I was thinking of something like the pg_connect() in postgres or ldap_connect where you get the resource that you can later use for processing.
Coz like in this example, they say that $data and $signature are assumed to contain the data and the signature but I couldnt find the docs nor explanation on how the get $data and $signature.
// fetch public key from certificate and ready it $fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r"); $cert = fread($fp, 8192); fclose($fp); $pubkeyid = openssl_get_publickey($cert);
// state whether signature is okay or not $ok = openssl_verify($data, $signature, $pubkeyid); if ($ok == 1) echo "good"; elseif ($ok == 0) echo "bad"; else echo "ugly, error checking signature";
// free the key from memory openssl_free_key($pubkeyid);
Maybe, I just overlooked it or most likely, I just couldn't understand it, but one thing is for sure: Im really, really lost.
But I have a feeling that these openssl_x509_xxx set of functions are the answer so if only I can find a more elaborate information on this (not like on http://www.php.net/manual/en/function.openssl-x509-read.php which of course, doesnt contain much), I think I can pull this off.
Please help me.
Happy ThanksGiving, Richard
attached mail follows:
Not sure if this would be anyway possible, hopefull some of you GD gurus will have an idea.
Basically the scenario is, I have a dirtectory of images(5 to be exact).
What I want to be able to do is something similar to the script below, which randomizes a gif image selection. the file is called "image.php", the person calls it like they would an image: <img src="img.php"> and boom there ya have a nice gif image. But what I want to be able to do is join together a number of images, so based on certain conditions, a user could call <img src="img.php"> and this would show maybe two/three/four images joined together. I can do this with one fine, but I thought there may be some sort of GD function that would tackle this.
Thanks for any help,
Craig
<?php
Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); Header("Pragma: no-cache"); Header("Content-Type: image/gif");
srand((double)microtime()*1000000);
$i = 0; $dir = opendir("img"); while(($im = readdir($dir))) { if($im != ".." && $im != "."){ $image[$i] = $im; $i++; } }
closedir($dir);
$tot = count($image)-1; $n = rand(0,$tot);
readfile("img/".$image[$n]); ?>
attached mail follows:
> -----Original Message-----
> From: Floyd Baker [mailto:fbaker
olm1.com]
> Sent: 28 November 2002 17:09
OK, I think I'm finally beginning to understand what you're up to, and it seems to me everyine's been making rather heavy weather of it so far!
> The user's choice is made from a drop down list of available items, > prior to running the routine itself. The choices are predetermined > and kept in a personal table to be called by the routine. This part > is finished to the point of putting the needed column names at the top > of the input columns on the form. The choices are fixed spellings to > match formula if-then's, etc.
If this is the case, couldn't you use 2-dimensional arrays with the column names as the first dimension, and the values relating to it in the second dimension?
So you'd have something like
$user['colour'][0] $user['hobby'][0] $user['etc'][0] $user['colour'][1] $user['hobby'][1] $user['etc'][1] $user['colour'][2] $user['hobby'][2] $user['etc'][2] $user['colour'][3] $user['hobby'][3] $user['etc'][3]
etc.
Anyway, going back to your forms:
> >if ($start_button=="1") > > { > > print "<form action=$PHP_SELF method=get>"; > > print "Input the following information"; > > // these are your fixed cells and they now contain user input > > print "Name: <input type=text name=name value=\"$name\" > size=20><br>"; > > print "Temp: <input type=text name=temp value=\"$temp\" > size=20><br>"; > > print "Time: <input type=text name=time value=\"$time\" > size=20><br>"; > > print "Offset: <input type=text name=offset value=\$offset\" > >size=20><br>"; > > print "Input the names of the desired additional cells in the spaces > >provided."; > > // this is where your user will name the cells he asked to create > > for($i=1;$i<=$additional_cells;$i++) > > { > > print "$i <input type=text name=user_added[$i] size=20><br>"; > > }
OK, this looks good -- it will give you your array of column names. But you really should quote all those attributes, so:
print "$i <input type=\"text\" name=\"user_added[$i]\" size=\"20\"><br>";
The next bit is where I'd do the clever stuff to build the 2-dimensional array:
> >> Name Temp Time Offset Etc. As needed... > >> process 1 [input] [input] [input] [input] [inputs] > >> process 2 [input] [input] [input] [input] [inputs] > >> process 3 [input] [input] [input] [input] [inputs] > >> process 4 [input] [input] [input] [input] [inputs] > >> > >> Right now, for the three *basic* columns, I have the lines > below in a > >> 'while' loop. > >> > >> <INPUT TYPE='text' NAME='temp[]' VALUE='$temp' SIZE='10' > >> MAXLENGTH='10'> > >> <INPUT TYPE='text' NAME='time[]' VALUE='$time' SIZE='10' > >> MAXLENGTH='10'> > >> <INPUT TYPE='text' NAME='offs[]' VALUE='$offs' SIZE='10' > >> MAXLENGTH='10'>
So, you just need additional lines in your while loop to add the entries for the user columns, named in such a way that you'll get back the 2-dimensional array I described earlier. As you already have those column namers in the $user_added[] array built above, we can do it like this:
foreach ($user_added as $user_col): echo "<input type='text' name=\"user['$user_col'][]\" size='10' maxlength='10'>"; endforeach;
and, bingo, you have your user's input being submitted into a 2-dimensional array indexable by column name and row number.
(Actually, to be absolutely sure all the row numbers match, I'd be outputting those into the form field names as well.)
Additionally, having gone this far I'd consider doing the same sort of thing with your standard columns, something like this:
$std_cols = array('temp', 'time', 'offs');
// now fill the $user_added[] array from database or wherever
echo "<form ......>";
for ($n=0; $n<ROWS_NEEDED; $n++):
foreach ($std_cols as $col_id): echo "<input type='text' name=\"$col_id[$n]\" size='10' ....>"; endforeach;
foreach ($user_added as $col_id): echo "<input type='text' name=\"user['$col_id'][$n]\" size='10' ....>"; endforeach;
endfor;
You could even 2-dimensionalize your standard columns, so you get:
$std['temp'][0] $std['time'][0] $std['offs'][0] $std['temp'][1] $std['time'][1] $std['offs'][1]
etc., with the corresponding form fields being written using:
foreach ($std_cols as $col_id): echo "<input type='text' name=\"std['$col_id'][$n]\" size='10' ....>"; endforeach;
And, then, of course, you might well wonder why you should bother having two separate sets of very similar arrays, when you could merge them and just keep track of how many are standard ones (with the rest automatically treated as user added ones). So you'd start off something like:
$cols = array('temp', 'time', 'offs'); define('N_STD_COLS', 3);
and build from there -- but I leave that as an exercise for the reader!!!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]