[PHP-DB] Forms submitting to a session array
I'm trying to create a shopping cart where users can visit a product page (called from a MySQL database depending on the url ending in ?product_id=#). On the product page users can select options from dropdown lists (such as color, etc.) These dropdown lists are also dynamically generated from the database. I need to store what the user has selected while the user browses the site. I want to also display what they've selected on a cart page. I believe my best option is to store what they've selected in a session array. I'm not sure how to do this with the dropdown lists, etc. Any help would be greatly appreciated! -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms submitting to a session array
Thomas wrote: I'm trying to create a shopping cart where users can visit a product page (called from a MySQL database depending on the url ending in ?product_id=#). On the product page users can select options from dropdown lists (such as color, etc.) These dropdown lists are also dynamically generated from the database. I need to store what the user has selected while the user browses the site. I want to also display what they've selected on a cart page. I believe my best option is to store what they've selected in a session array. I'm not sure how to do this with the dropdown lists, etc. In exactly the same way as any other data. If you want to save it per-product, you could do something like this. ?php session_start(); if (empty($_SESSION['products'])) { $_SESSION['products'] = array(); } // appropriate checking for form submission here. // and also making sure proper colors or whatever are posted. // $session_product = array(); $session_product['product_id'] = $_POST['product_id']; $session_product['color'] = $_POST['color']; // add the new array of info to the session. array_push($_SESSION['products'], $session_product); now if you print_r($_SESSION['products']) you'll see a big array of info with each product having a color. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] forms and method POST - variables
Hi, I have one question about forms and php (which I use for Mysql too). Do I need for variables from any form in html and method POST (then in php script) to set these variables with: $variable=$_POST['variable']; For example: html head title FORM/title /head body form action=do_something.php method=POST Input something br input type=text name=variable input type=submit value=submit /FORM /body /html And then.in do_something.php html head titleDO SOMETHING/title /head body ?php $variable=$_POST['variable']; echo brbVariable: /b.$variable; ? /body /html Because I got some old scripts where I don´t have this setting.they worked on MS Win2000 - PWS and PHP 4.0 but now - with Apache 2.2.6, PHP 5.2 on WIN XP it doesn´t work. Thank you for any advice. Lukas
RE: [PHP-DB] forms and method POST - variables
Well, it depends if you use an old version of PHP, in the latest version both arrays $_POST and $_GET are used to get passed variables!! I can't remember since what version PHP started to use these arrays!! MG -Original Message- From: Lukáš Moravec [mailto:[EMAIL PROTECTED] Sent: Miércoles, 09 de Enero de 2008 10:26 a.m. To: php-db@lists.php.net Subject: [PHP-DB] forms and method POST - variables Hi, I have one question about forms and php (which I use for Mysql too). Do I need for variables from any form in html and method POST (then in php script) to set these variables with: $variable=$_POST['variable']; For example: html head title FORM/title /head body form action=do_something.php method=POST Input something br input type=text name=variable input type=submit value=submit /FORM /body /html And then.in do_something.php html head titleDO SOMETHING/title /head body ?php $variable=$_POST['variable']; echo brbVariable: /b.$variable; ? /body /html Because I got some old scripts where I don´t have this setting.they worked on MS Win2000 - PWS and PHP 4.0 but now - with Apache 2.2.6, PHP 5.2 on WIN XP it doesn´t work. Thank you for any advice. Lukas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] forms and method POST - variables
On Jan 9, 2008 11:25 AM, Lukáš Moravec [EMAIL PROTECTED] wrote: Hi, I have one question about forms and php (which I use for Mysql too). Do I need for variables from any form in html and method POST (then in php script) to set these variables with: $variable=$_POST['variable']; [snip!] That's a question that should be asked on the PHP-General list, actually. I'm forwarding the response to that list with this message. Are you receiving any errors? Are any messages displayed when you have the following at the beginning of the script? ?php error_reporting(E_ALL); ? $_GET and $_POST are predefined superglobal variables, which have been available in PHP since dinosaurs roamed the Earth. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since 1979.
[PHP-DB] Forms with letter verification
You know forms which have a security field where the user reads back the letters that are displayed? I am wondering if someone has the time to coach me in writing this --- or if you know of a web page that shows how to create this feature. I have already created a set of graphical letters. Ron
Re: [PHP-DB] Forms with letter verification
You mean a CAPTCHA script? On 7/29/06, Ron Piggott (PHP) [EMAIL PROTECTED] wrote: You know forms which have a security field where the user reads back the letters that are displayed? I am wondering if someone has the time to coach me in writing this --- or if you know of a web page that shows how to create this feature. I have already created a set of graphical letters. Ron -- Dave W
[PHP-DB] Forms with letter security
I have a set of graphical letters A to Z. I want some displayed and then keyed into a security field to verify a person is submitting the form. I have seen these used before on shopping carts. I know about creating salts to select which letters to choose. What I am wondering is if there is a way to join the letters together instead of having 6 different images displayed. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms...
At 07:52 10/03/2005 +, you wrote: Message-ID: [EMAIL PROTECTED] Date: Wed, 09 Mar 2005 20:37:36 +0100 From: Jochem Maas [EMAIL PROTECTED] if your into XHTML: input name=right_eye type=checkbox value=1 checked=checked value=1 / Actually that's invalid XHTML (it won't validate) due to a typo I guess. Each XML (aka XHTML) DOM element can only have a ~single~ attribute with a particular name. The typo above has two copies if the 'value' attribute which would prevent the XHTML being valid XML. HTH Cheers - Neil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms...
Neil Smith [MVP, Digital media] wrote: At 07:52 10/03/2005 +, you wrote: Message-ID: [EMAIL PROTECTED] Date: Wed, 09 Mar 2005 20:37:36 +0100 From: Jochem Maas [EMAIL PROTECTED] if your into XHTML: input name=right_eye type=checkbox value=1 checked=checked value=1 / Actually that's invalid XHTML (it won't validate) due to a typo I guess. true, yeah I added an extra value attr. wasn't paying enought attention. Each XML (aka XHTML) DOM element can only have a ~single~ attribute with a particular name. The typo above has two copies if the 'value' attribute which would prevent the XHTML being valid XML. HTH Cheers - Neil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Forms...
Does anyone know if it is possible to have 'checkbox' elements in a form appear 'checked' or 'unchecked' when a page loads data from a MySQL data source? Can I use an attribute in the input tag to switch that? -- Mark Benson AIM - SilValleyPirate MSN - [EMAIL PROTECTED] Visit FlatPackMacs online: http://fpm.68kmac.com Visit my Homepage: http://homepage.mac.com/markbenson Introducing Macintosh Classic II - pick one out on your way past the trash! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Forms...
I use this format input name=right_eye type=checkbox value=1 ? if ($rows['right_eye']==1) { echo CHECKED ; } ?nbsp;Right Eye(s) Bastien From: Mark Benson [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Forms... Date: Wed, 9 Mar 2005 19:12:31 + Does anyone know if it is possible to have 'checkbox' elements in a form appear 'checked' or 'unchecked' when a page loads data from a MySQL data source? Can I use an attribute in the input tag to switch that? -- Mark Benson AIM - SilValleyPirate MSN - [EMAIL PROTECTED] Visit FlatPackMacs online: http://fpm.68kmac.com Visit my Homepage: http://homepage.mac.com/markbenson Introducing Macintosh Classic II - pick one out on your way past the trash! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms...
Bastien Koert wrote: I use this format input name=right_eye type=checkbox value=1 ? if ($rows['right_eye']==1) { echo CHECKED ; } ?nbsp;Right Eye(s) if your into XHTML: input name=right_eye type=checkbox value=1 checked=checked value=1 / (Bastien already showed how to dynamically determine whether the chkbox is checked :-) ... all attribs in lower case, and every one must have a value set, in the case of the 'checked' attrib the value is 'checked'. I haven't tried it out but I assume the following html would result in an unchecked box - I also imagine that that may depend on the DOCTYPE of the output page - and I may just be plain wrong :). input name=right_eye type=checkbox value=1 checked= value=1 / Bastien From: Mark Benson [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Forms... Date: Wed, 9 Mar 2005 19:12:31 + Does anyone know if it is possible to have 'checkbox' elements in a form appear 'checked' or 'unchecked' when a page loads data from a MySQL data source? Can I use an attribute in the input tag to switch that? -- Mark Benson AIM - SilValleyPirate MSN - [EMAIL PROTECTED] Visit FlatPackMacs online: http://fpm.68kmac.com Visit my Homepage: http://homepage.mac.com/markbenson Introducing Macintosh Classic II - pick one out on your way past the trash! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Forms list from database
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 01 November 2004 21:11, Jason T. Davidson wrote: Here is the code: form name=form1 method=post action=staff_code/add_code.php table width=600 border=0 align=center cellpadding=0 cellspacing=0 tr bgcolor=#CC td colspan=3 bgcolor=#FFdiv align=center select name=controller id=controller option /option option ? while ($check=mysql_fetch_array($result)){ print $check[LNAME],$check[FNAME]($check[CID]); } /option /select /div/td /tr I think you're missing some option/option tags -- these should be present around each value extracted from the database, so: while ($check=mysql_fetch_array($result)){ print option{$check['LNAME']},{$check['FNAME']}({$check['CID']})/option\n; } Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Forms list from database
I am trying to take information from a database and show that info in a forms list. I have been trying this with while(), but it never comes out and displays correctly. Any help would be appreciated. -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms list from database
It might be usefull to see the code you are using to show the query results. --- Jason T. Davidson [EMAIL PROTECTED] escribió: I am trying to take information from a database and show that info in a forms list. I have been trying this with while(), but it never comes out and displays correctly. Any help would be appreciated. -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ ¡Llevate a Yahoo! en tu Unifón! Ahora podés usar Yahoo! Messenger en tu Unifón, en cualquier momento y lugar. Encontrá más información en: http://ar.mobile.yahoo.com/sms.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms list from database
Here is the code: form name=form1 method=post action=staff_code/add_code.php table width=600 border=0 align=center cellpadding=0 cellspacing=0 tr bgcolor=#CC td colspan=3 bgcolor=#FFdiv align=center select name=controller id=controller option /option option ? while ($check=mysql_fetch_array($result)){ print $check[LNAME],$check[FNAME]($check[CID]); } ? /option /select /div/td /tr -- Jason Davidson Juan Stiller wrote: It might be usefull to see the code you are using to show the query results. --- Jason T. Davidson [EMAIL PROTECTED] escribió: I am trying to take information from a database and show that info in a forms list. I have been trying this with while(), but it never comes out and displays correctly. Any help would be appreciated. -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ ¡Llevate a Yahoo! en tu Unifón! Ahora podés usar Yahoo! Messenger en tu Unifón, en cualquier momento y lugar. Encontrá más información en: http://ar.mobile.yahoo.com/sms.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Forms list from database
Assuming, for the moment, that there's more code above that to actually support this... You want to be quoting the keys in the array, and containing each array 'lookup' in {}s: print $check[LNAME],$check[FNAME]($check[CID]); Should be print {$check['LNAME']},{$check['FNAME']}({$check['CID']}); However - in the future, try to include all relevant code. The surrounding table code isn't important, but the code you're using for your query and to connect to the database/etc. is. - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -Original Message- From: Jason T. Davidson [mailto:[EMAIL PROTECTED] Sent: Monday, November 01, 2004 3:11 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Forms list from database Here is the code: form name=form1 method=post action=staff_code/add_code.php table width=600 border=0 align=center cellpadding=0 cellspacing=0 tr bgcolor=#CC td colspan=3 bgcolor=#FFdiv align=center select name=controller id=controller option /option option ? while ($check=mysql_fetch_array($result)){ print $check[LNAME],$check[FNAME]($check[CID]); } ? /option /select /div/td /tr -- Jason Davidson Juan Stiller wrote: It might be usefull to see the code you are using to show the query results. --- Jason T. Davidson [EMAIL PROTECTED] escribió: I am trying to take information from a database and show that info in a forms list. I have been trying this with while(), but it never comes out and displays correctly. Any help would be appreciated. -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ ¡Llevate a Yahoo! en tu Unifón! Ahora podés usar Yahoo! Messenger en tu Unifón, en cualquier momento y lugar. Encontrá más información en: http://ar.mobile.yahoo.com/sms.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and more forms?
On Friday 05 March 2004 17:10, [EMAIL PROTECTED] wrote: TO enable multiple deletions, I must place the whole table in another form. What happens is that no matter how many deletions I select, it only picks up the one at the top of the page, or none, if the top one isn't selected. print_r() or var_dump() every significant variable. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Planet Claire has pink hair. All the trees are red. No one ever dies there. No one has a head */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and more forms?
Cheers, I'll swing by php.net to learn about these functions... Tris... Jason Wong [EMAIL PROTECTED] 05/03/2004 10:42 To [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Forms and more forms? On Friday 05 March 2004 17:10, [EMAIL PROTECTED] wrote: TO enable multiple deletions, I must place the whole table in another form. What happens is that no matter how many deletions I select, it only picks up the one at the top of the page, or none, if the top one isn't selected. print_r() or var_dump() every significant variable. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Planet Claire has pink hair. All the trees are red. No one ever dies there. No one has a head */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE:[PHP-DB] Forms and more forms?
What does your HTML look like? Have you defined the delete checkbox as an array? For example: input type=checkbox name=select[] value=rowid / Notice the brackets to indicate an array. --Nicole --- Nicole Swan Web Programming Specialist Carroll College CCIT (406)447-4310 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, March 05, 2004 2:11 AM To: [EMAIL PROTECTED] Subject: Spam:[PHP-DB] Forms and more forms? I'm talking to a MySQL database that contains info on all downloads from our site. I list all these entries, on a PHP page. The table structure etc, are static, but the fields retrieved, are dynamic, based on the users search criteria. Within each result, I've added a small form, that posts that data, to an external site (salesforce.com). Each field looks like this: http://www.risk.sungard.com/del.gif But one can have entries on a page.. At present, a user can submit a field to salesforce one at a time, no probs, and I'll probably wanna keep it that way. However.. TO enable multiple deletions, I must place the whole table in another form. What happens is that no matter how many deletions I select, it only picks up the one at the top of the page, or none, if the top one isn't selected. I'm using the following PHP... if ($submit == 'DELETE SELECTED') { foreach($_POST[select] as $del) { $res = mysql_query(DELETE FROM $table_name WHERE id='$del'); } } But I presume that the embedded forms that talk to sales force, are disrupting it... So I need to either: 1. find out how to let the page detect what's selected anotehr way.. OR 2. enable multiple post to salesforce.com, WITHOUT opening potentially dozens of new windows (one for each submision) Any takers on a unique way to acheive this? Tris.. (P.S. Glad you asked ;-) ) * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php-db Forms-Radio problems
Hello I'm having a devil of a time with my form. I'm able to process checkboxes and fields but am having trouble with radio buttons. Here's how I'm doing the fields which works: snippet Your Last Name input type=text name=last value= size=30 maxlength=40 Title input type=text name=title value= size=30 maxlength=40 /snippet which produces: ( [last] = Smith [title] = Vice President ) But when I try: snippet input type=radio name=job value=oper Operation Maintenance input type=radio name=job value=eng Engineering (Including Project Management) input type=radio name=job value=mgmt Management (other than corporate) input type=radio name=job value=other Other - Please Specify input name=job type=text size=30 /snippet and one is selected, I get: ( [job] = ) I have searched archives, books, tutorials...cant figure it out. Are radio buttons handled differently? Can someone please enlighten me? Thx Mignon Hunter Webmaster Toshiba International Corporation (713) 466-0277 x 3461 (800) 466-0277 x 3461 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php-db Forms-Radio problems
Mignon Hunter wrote: input type=radio name=job value=oper Operation Maintenance input type=radio name=job value=eng Engineering (Including Project Management) input type=radio name=job value=mgmt Management (other than corporate) input type=radio name=job value=other Other - Please Specify input name=job type=text size=30 This last field will overwrite the radio setting when PHP reads the form fields. Remove it. It's not needed. -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php-db- Forms radion buttons
Hello I'm having a devil of a time with my form. I'm able to process checkboxes and fields but am having trouble with radio buttons. Here's how I'm doing the fields which works: snippet Your Last Name input type=text name=last value= size=30 maxlength=40 Title input type=text name=title value= size=30 maxlength=40 /snippet which produces: ( [last] = Smith [title] = Vice President ) But when I try: snippet input type=radio name=job value=oper Operation Maintenance input type=radio name=job value=eng Engineering (Including Project Management) input type=radio name=job value=mgmt Management (other than corporate) input type=radio name=job value=other Other - Please Specify input name=job type=text size=30 /snippet and one is selected, I get: ( [job] = ) I have searched archives, books, tutorials...cant figure it out. Are radio buttons handled differently? Can someone please enlighten me? Thx Mignon Hunter Webmaster Toshiba International Corporation (713) 466-0277 x 3461 (800) 466-0277 x 3461 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php-db Forms-Radio problems
THANK YOU duh me I knew it was something simple :( Mignon Hunter Webmaster Toshiba International Corporation (713) 466-0277 x 3461 (800) 466-0277 x 3461 Stuart [EMAIL PROTECTED] 01/27/04 11:41AM Mignon Hunter wrote: input type=radio name=job value=oper Operation Maintenance input type=radio name=job value=eng Engineering (Including Project Management) input type=radio name=job value=mgmt Management (other than corporate) input type=radio name=job value=other Other - Please Specify input name=job type=text size=30 This last field will overwrite the radio setting when PHP reads the form fields. Remove it. It's not needed. -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php-db Forms-Radio problems
It appears the intention of the text input is to provide an other job type. Instead of removing it, rename it to job_other or something. Then test for the value of job, if other use job_other value. -Original Message- From: Stuart [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 11:42 AM To: Mignon Hunter Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] php-db Forms-Radio problems Mignon Hunter wrote: input type=radio name=job value=oper Operation Maintenance input type=radio name=job value=eng Engineering (Including Project Management) input type=radio name=job value=mgmt Management (other than corporate) input type=radio name=job value=other Other - Please Specify input name=job type=text size=30 This last field will overwrite the radio setting when PHP reads the form fields. Remove it. It's not needed. -- Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] forms with php/mysql
Thanks for your concern, but I put there the files for people to look at and not the running ones. And as you can notice there are no passwd or username in the connection.php that I put in a non accessible folder fr security reasons. Philippe Le Lundi 9 Juin 2003 20:48, Matthew Moldvan a écrit : FYI, you should keep your connection.txt as connection.php so we can't all read the database password and host and put what we want in it. :) Regards, Matt. -Original Message- From: Philippe Rousselot [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 4:18 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] forms with php/mysql done you can find the files at www.alcatorda.com/jcp/test/files.html and try it at www.alctorda.com/jcp/test/enregistrer.php I am sure it is full of bad codding but it works. I just have to make it nice now. Philippe Le Jeudi 5 Juin 2003 06:15, Peter Beckman a écrit : 1. Search the archives, they are here: http://www.php.net/mailing-lists.php 2. If you aren't a coder, you probably cannot do what you ask; there aren't any pre-built simple systems that do exactly what you ask. You could look on freshmeat.net or sourceforge.com, but I doubt you'd find what you are looking for. Peter On Thu, 5 Jun 2003, Philippe Rousselot wrote: Hi, I need for an association to create a form using php/mysql. If I can understand php, I am not a coder, so if someone had the code I need, I would really be greatful. I need : 1. on a page someone identify himself or register to the service using a form where the person enter name, email(username) and password. 2. once registered, the person can access a secured zone containing a form 3. the persone can fill the form, abandon half way and save the result, then come back and have the previously recorded information appearing again. all data need to be in a Mysql database. Thank you very much for your help. Philippe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] forms with php/mysql
Hi, Thanks all for your answers. What I mean by I am not a coder is that it will take me 3 month to do it while doing only that, because I code in PHP once a month. And since I help an association I cannot really spend my time doing this. What I can do is to take bits of code and put them toggether without too much trouble. I just found php classes repository, it is not bad at all. I got most of the elements. Philippe Le Jeudi 5 Juin 2003 12:02, Becoming Digital a écrit : If you aren't a coder, you probably cannot do what you ask; there aren't any pre-built simple systems that do exactly what you ask. Yes and no. I agree that someone without coding experience (or a desire to learn) cannot tackle this problem, but what Philippe has requested is a simple user authentication system with sessions, of which there are many. Still, customization to fit his system will require an understanding of the code, which will likely prove problematic. To the poster, check out the PHP Classes Repository for a number of authentication classes. Don't expect them to work if you don't understand the code, though. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: Philippe Rousselot [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, 05 June, 2003 00:15 Subject: Re: [PHP-DB] forms with php/mysql 1. Search the archives, they are here: http://www.php.net/mailing-lists.php 2. If you aren't a coder, you probably cannot do what you ask; there aren't any pre-built simple systems that do exactly what you ask. You could look on freshmeat.net or sourceforge.com, but I doubt you'd find what you are looking for. Peter On Thu, 5 Jun 2003, Philippe Rousselot wrote: Hi, I need for an association to create a form using php/mysql. If I can understand php, I am not a coder, so if someone had the code I need, I would really be greatful. I need : 1. on a page someone identify himself or register to the service using a form where the person enter name, email(username) and password. 2. once registered, the person can access a secured zone containing a form 3. the persone can fill the form, abandon half way and save the result, then come back and have the previously recorded information appearing again. all data need to be in a Mysql database. Thank you very much for your help. Philippe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] forms with php/mysql
done you can find the files at www.alcatorda.com/jcp/test/files.html and try it at www.alctorda.com/jcp/test/enregistrer.php I am sure it is full of bad codding but it works. I just have to make it nice now. Philippe Le Jeudi 5 Juin 2003 06:15, Peter Beckman a écrit : 1. Search the archives, they are here: http://www.php.net/mailing-lists.php 2. If you aren't a coder, you probably cannot do what you ask; there aren't any pre-built simple systems that do exactly what you ask. You could look on freshmeat.net or sourceforge.com, but I doubt you'd find what you are looking for. Peter On Thu, 5 Jun 2003, Philippe Rousselot wrote: Hi, I need for an association to create a form using php/mysql. If I can understand php, I am not a coder, so if someone had the code I need, I would really be greatful. I need : 1. on a page someone identify himself or register to the service using a form where the person enter name, email(username) and password. 2. once registered, the person can access a secured zone containing a form 3. the persone can fill the form, abandon half way and save the result, then come back and have the previously recorded information appearing again. all data need to be in a Mysql database. Thank you very much for your help. Philippe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] forms with php/mysql
If you aren't a coder, you probably cannot do what you ask; there aren't any pre-built simple systems that do exactly what you ask. Yes and no. I agree that someone without coding experience (or a desire to learn) cannot tackle this problem, but what Philippe has requested is a simple user authentication system with sessions, of which there are many. Still, customization to fit his system will require an understanding of the code, which will likely prove problematic. To the poster, check out the PHP Classes Repository for a number of authentication classes. Don't expect them to work if you don't understand the code, though. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: Philippe Rousselot [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, 05 June, 2003 00:15 Subject: Re: [PHP-DB] forms with php/mysql 1. Search the archives, they are here: http://www.php.net/mailing-lists.php 2. If you aren't a coder, you probably cannot do what you ask; there aren't any pre-built simple systems that do exactly what you ask. You could look on freshmeat.net or sourceforge.com, but I doubt you'd find what you are looking for. Peter On Thu, 5 Jun 2003, Philippe Rousselot wrote: Hi, I need for an association to create a form using php/mysql. If I can understand php, I am not a coder, so if someone had the code I need, I would really be greatful. I need : 1. on a page someone identify himself or register to the service using a form where the person enter name, email(username) and password. 2. once registered, the person can access a secured zone containing a form 3. the persone can fill the form, abandon half way and save the result, then come back and have the previously recorded information appearing again. all data need to be in a Mysql database. Thank you very much for your help. Philippe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] forms with php/mysql
Hi, I need for an association to create a form using php/mysql. If I can understand php, I am not a coder, so if someone had the code I need, I would really be greatful. I need : 1. on a page someone identify himself or register to the service using a form where the person enter name, email(username) and password. 2. once registered, the person can access a secured zone containing a form 3. the persone can fill the form, abandon half way and save the result, then come back and have the previously recorded information appearing again. all data need to be in a Mysql database. Thank you very much for your help. Philippe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] forms with php/mysql
1. Search the archives, they are here: http://www.php.net/mailing-lists.php 2. If you aren't a coder, you probably cannot do what you ask; there aren't any pre-built simple systems that do exactly what you ask. You could look on freshmeat.net or sourceforge.com, but I doubt you'd find what you are looking for. Peter On Thu, 5 Jun 2003, Philippe Rousselot wrote: Hi, I need for an association to create a form using php/mysql. If I can understand php, I am not a coder, so if someone had the code I need, I would really be greatful. I need : 1. on a page someone identify himself or register to the service using a form where the person enter name, email(username) and password. 2. once registered, the person can access a secured zone containing a form 3. the persone can fill the form, abandon half way and save the result, then come back and have the previously recorded information appearing again. all data need to be in a Mysql database. Thank you very much for your help. Philippe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Forms question..
Hi all... When I have an input form I must click on the first input field. Is there anyway to have it active when the form loads? #2 When I tab down to the next input field, is there anyway to have it highlight what is in the field (ie the default data) so that it will overwrite it? #3 How can I get the form to submit when I hit the return button? Right now I have to click on the button with my mouse. #4 How can I get a column of numbers to left justify? Thanks JIM -- Jim Hatridge Linux User #88484 -- BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Forms question..
When I have an input form I must click on the first input field. Is there anyway to have it active when the form loads? Javascript, not PHP. Something like document.form.element.setfocus(), I think. #2 When I tab down to the next input field, is there anyway to have it highlight what is in the field (ie the default data) so that it will overwrite it? Client side...not PHP. #3 How can I get the form to submit when I hit the return button? Right now I have to click on the button with my mouse. Client side, depends on the browser, not PHP #4 How can I get a column of numbers to left justify? HTML, not PHP. Align=left ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms question..
1. document.formname.elementname.focus(); Example: if my form has a name of testform and the first element is fname... then in the body tag i would do this... body onload=document.testform.fname.focus(); 2. Yeah, you need to use the select() method... so document.testform.element.select(); Example: input name=example value=N/A onfocus=document.testform.example.select(); That should work...or it might have to be in a function... 3. It should do that for you with the submit button...what browser are you using? 4. use the align attributealign=left On Sun, 2002-10-20 at 12:27, James Hatridge wrote: Hi all... When I have an input form I must click on the first input field. Is there anyway to have it active when the form loads? #2 When I tab down to the next input field, is there anyway to have it highlight what is in the field (ie the default data) so that it will overwrite it? #3 How can I get the form to submit when I hit the return button? Right now I have to click on the button with my mouse. #4 How can I get a column of numbers to left justify? Thanks JIM -- Jim Hatridge Linux User #88484 -- BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .: B i g D o g :. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Forms and mysql
Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. Anyway here is what I have. This is items.php: form action='buyitem.php' method='post' ? $query = SELECT id, image, name, quantity, price FROM {$config[prefix]}_items where id = 1; $ret = mysql_query($query); $return = mysql_fetch_array($ret); echo input type='image' src='images/blueholo.gif'br; echo b$return[name]/bbr; echo Quantity $return[quantity]br; echo Cost: $return[price] SCbr; echo input type='hidden' name='ItemID' value='$id'; ? /form What I need to accomplish is that when the submit button is clicked the quantity is subtracted by 1 and then the item is placed in the users item list in mysql. This is what I have in buyitem.php but I cant seem to get it to work. $return[quantity]=(UPDATE {$config[prefix]}_items set quantity = quantity - 1 WHERE id = '$ItemID'); $result=mysql_query($db[quantity]); Would someone be kind enough to help with this? Thanks for all your help so far. And thanks in advance. Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
On Friday 05 April 2002 07:55, Jennifer Downey wrote: Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. If this has been answered before then search in the archives: http://marc.theaimsgroup.com/?l=php-db -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Love Were Oil, I'd Be About A Quart Low -- Book title by Lewis Grizzard */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
If you had read more carefully you'd see that I don't have THE email sent to me. The replies were never in the archives. I guess since I am a woman everyone feels they need to send private email instead of replying with a post. Jennifer Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 05 April 2002 07:55, Jennifer Downey wrote: Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. If this has been answered before then search in the archives: http://marc.theaimsgroup.com/?l=php-db -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Love Were Oil, I'd Be About A Quart Low -- Book title by Lewis Grizzard */ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
Jennifer Downey a écrit : If you had read more carefully you'd see that I don't have THE email sent to me. The replies were never in the archives. I guess since I am a woman everyone feels they need to send private email instead of replying with a post. maybe... maybe not... on my NS when i press reply he tries to reply to sender, not to [EMAIL PROTECTED] ... Jennifer Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 05 April 2002 07:55, Jennifer Downey wrote: Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. If this has been answered before then search in the archives: http://marc.theaimsgroup.com/?l=php-db -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Love Were Oil, I'd Be About A Quart Low -- Book title by Lewis Grizzard */ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ \|/ @'/ ,. \`@ /_| \__/ |_\ \__U_/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
In any case the email or replies are not in the archives. I have searched them and came up empty. Marius Ursache [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jennifer Downey a écrit : If you had read more carefully you'd see that I don't have THE email sent to me. The replies were never in the archives. I guess since I am a woman everyone feels they need to send private email instead of replying with a post. maybe... maybe not... on my NS when i press reply he tries to reply to sender, not to [EMAIL PROTECTED] ... Jennifer Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 05 April 2002 07:55, Jennifer Downey wrote: Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. If this has been answered before then search in the archives: http://marc.theaimsgroup.com/?l=php-db -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Love Were Oil, I'd Be About A Quart Low -- Book title by Lewis Grizzard */ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ \|/ @'/ ,. \`@ /_| \__/ |_\ \__U_/ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
if you have full access to internet (no proxy or something) try to search on news servers (alt.php or oher php related newsgroups) news server: news2.euro.net or other... Jennifer Downey a écrit : In any case the email or replies are not in the archives. I have searched them and came up empty. Marius Ursache [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jennifer Downey a écrit : If you had read more carefully you'd see that I don't have THE email sent to me. The replies were never in the archives. I guess since I am a woman everyone feels they need to send private email instead of replying with a post. maybe... maybe not... on my NS when i press reply he tries to reply to sender, not to [EMAIL PROTECTED] ... Jennifer Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 05 April 2002 07:55, Jennifer Downey wrote: Hi all, I know I've asked this before and wouldn't be asking again if I had the email that you people replied back with. Windows took a you know what on me and I had to format the hard drive. If this has been answered before then search in the archives: http://marc.theaimsgroup.com/?l=php-db -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Love Were Oil, I'd Be About A Quart Low -- Book title by Lewis Grizzard */ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ \|/ @'/ ,. \`@ /_| \__/ |_\ \__U_/ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marius Ursache (3563 || 3494) \|/ \|/ @'/ ,. \`@ /_| \__/ |_\ \__U_/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms and mysql
On Friday 05 April 2002 13:42, Jennifer Downey wrote: If you had read more carefully you'd see that I don't have THE email sent to me. The replies were never in the archives. Email posts, many people don't know/don't differentiate/don't care about the difference. Obviously you're not one of them :) I guess since I am a woman everyone feels they need to send private email instead of replying with a post. How enviable. What I need to accomplish is that when the submit button is clicked the quantity is subtracted by 1 and then the item is placed in the users item list in mysql. You don't say what the problem is. I'm assuming your form works correctly. This is what I have in buyitem.php but I cant seem to get it to work. $return[quantity]=(UPDATE {$config[prefix]}_items set quantity = quantity - 1 WHERE id = '$ItemID'); Your use of variable names is most confusing. $return[quantity] was holding a quantity when in your form, now it's being assigned a query ?? $result=mysql_query($db[quantity]); Is $db[quantity] meant to be $return[quantity] ? Or vice-versa? Or is it a typo? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Why must you tell me all your secrets when it's hard enough to love you knowing nothing? -- Lloyd Cole and the Commotions */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Forms
I know this is suppose to be databases, but the most knowledgeable people seem to be in here. This is the first time that I have tried to conquer a form in PHP(which I obviously am not doing) so that I can have a total PHP script page and move away from HTML. Here is my code as followed by my book (PHP Black Book) some variables have been changed ? $group[] = Communications; $group[] = Network Section; $group[] = Wire Section; $group[] = Phones; $question[section] = array(type = radio, question = What section is this Trouble Ticket being opened for?, list = $group); function form($page, $question) { $text = ; while(list($group, $v) = each($question)) { if(strlen($text)) {$text .= BR;} $function = form_ . $v[type]; $text .= $function($name. $v); } return(form action=\ttsubmit.php . $page . \ method=\post\ . $text . input type=\submit\ name=\submit\ . value=\Submit\ . /form); } function form_radio($group, $parameters) { $output = ; while(list($k, $v) = each($parameters[list])) { if(strlen($output)) { $output .= BR; } $output .= input name=\itsumit.php . $group . \ . type=\radio\ . value=\ . $v . \; if(isset($paramater[default]) and $v == $paramater[default]) { $output .= checked; } $output .= . $v . \n; } return($output); } //print(form (tt.php, form_radio(group,parameters)); When the last line is commented out there is no output at all. When I uncomment the last line I get a parsing error. I have been trying to figure this out, but I really lost here! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms
(((Point taken))) no harm intended Parse error: parse error in C:\**\*\tt.php on line 53 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms
Line 53 is the line that is commented out Ron [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... (((Point taken))) no harm intended Parse error: parse error in C:\**\*\tt.php on line 53 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Forms
First: cross-posting to multiple lists...not nice. Most PHP folks are on both lists. Second: your first sentence seems to indicate that unknowledgeable people inhabit the PHP list, vice the PHP-DB list. H GRIN Third: what error do you get when you get the parsing error? -Original Message- From: Ron [mailto:[EMAIL PROTECTED]] Sent: Friday, March 22, 2002 7:05 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Forms I know this is suppose to be databases, but the most knowledgeable people seem to be in here. This is the first time that I have tried to conquer a form in PHP(which I obviously am not doing) so that I can have a total PHP script page and move away from HTML. Here is my code as followed by my book (PHP Black Book) some variables have been changed ? $group[] = Communications; $group[] = Network Section; $group[] = Wire Section; $group[] = Phones; $question[section] = array(type = radio, question = What section is this Trouble Ticket being opened for?, list = $group); function form($page, $question) { $text = ; while(list($group, $v) = each($question)) { if(strlen($text)) {$text .= BR;} $function = form_ . $v[type]; $text .= $function($name. $v); } return(form action=\ttsubmit.php . $page . \ method=\post\ . $text . input type=\submit\ name=\submit\ . value=\Submit\ . /form); } function form_radio($group, $parameters) { $output = ; while(list($k, $v) = each($parameters[list])) { if(strlen($output)) { $output .= BR; } $output .= input name=\itsumit.php . $group . \ . type=\radio\ . value=\ . $v . \; if(isset($paramater[default]) and $v == $paramater[default]) { $output .= checked; } $output .= . $v . \n; } return($output); } //print(form (tt.php, form_radio(group,parameters)); When the last line is commented out there is no output at all. When I uncomment the last line I get a parsing error. I have been trying to figure this out, but I really lost here! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Forms carrying values.
Hi list, hope someone can help me here. I have content management system I have designed. I am still learning php so help here would be appreciated. The user logs into the system, and we carry there user name over the pages using a link to each page with the value of their name carried over as follows: ../index.php?name=?echo($name)? This works fine for the whole site, except when a user makes changes to a entry. Once they submit adding a new entry or modifying an existing one, the value of : ../index.php?name=My Name ends up being ./index.php?name=My It deletes the end of the name of the url, so that when the user clicks the link it does not really know who they are. I have used a hidden field to carry the value of the name over the pages, but it does not work on forms. I hope this makes some sort of sense. If anyone knows of a workaround. Thanks Barry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forms error in a catalog by Greenspan Bulger
Hi If you get yourself any decent text editor, it will have an option to show line numbers. Plenty of free editors here: http://download.cnet.com/downloads/0,10151,0-4003619-106-0-1-0,00.html?tag=d ir Personally I use and would recommend 'Ultra-edit' It would probably be a good idea to just post the line in question, due to line wrapping in mail it is difficult to figure out without going through the entire script where your error is. HTH Paul - Original Message - From: Darren [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 03, 2001 8:49 AM Subject: [PHP-DB] Forms error in a catalog by Greenspan Bulger : Greetings All! : : I am working on making a catalog from the example used in MySQL/PHP : Databases Applications by Jay Greenspan andBrad Bulger. I am using : php3 on the remote unix server. I had to remain all the php files : and there references in the documents from .php to .php3. I am : editing the code in a simple texteditor. : : Here is the problem. I keep getting a Parse error on line 33. : Question 1) How are you suposed count the lines? What is the exact : definition of a line? : Question 2) Can anybody tell me where the error is and or how to fix : it? Enclosed is the code. : : Thanks very much in advance for any help or comments. : : Darren : : Here Tis... : : ?php : /* : : *** This script from MySQL/PHP Database Applications *** : *** by Jay Greenspan and Brad Bulger *** : *** *** : *** You are free to resuse the material in this*** : *** script in any manner you see fit. There is *** : *** no need to ask for permission or provide *** : *** credit.*** : : */ : : // string start_form ([string action [, array attributes]]) : : // This function returns an HTML form tag. If the first argument : // is empty, the value of the global Apache variable SCRIPT_NAME : // is used for the 'action' attribute of the form tag. Other : // attributes for the form can be specified in the optional second : // argument; the default method of the form is post. : : // The behavior of this function on servers other than Apache is : // not known. It's likely that it will work, as SCRIPT_NAME is : // part of the CGI 1.1 specification. : : function start_form ($action=, $atts=) : { : global $SCRIPT_NAME; : : if (empty($action)) { $action = $SCRIPT_NAME; } : : $attlist = get_attlist($atts,array(method=post)); : $output = EOQ : form action=$action $attlist : EOQ; : return $output; : } : : // string end_form(void) : : // This function returns an HTML /form tag. : : function end_form () : { : $output = EOQ : /form : EOQ; : return $output; : } : : // string text_field ([string name [, string value [, int size [, : int maximum length) : : // This function returns an HTML text input field. The default size : // of the field is 10. A value and maximum data length for the field : // may be supplied. : : function text_field ($name=, $value=, $size=10, $maxlen=) : { : $maxatt = empty($maxlen) ? : maxlength=\$maxlen\; : $output = EOQ : input type=text name=$name value=$value size=$size $maxatt : EOQ; : return $output; : } : : // string textarea_field([string name [, string value [, int cols [, : int rows [, string wrap mode]) : : // This function returns an HTML textarea field. The default size is : // 50 columns and 10 rows, and the default wrap mode is 'soft', : which means : // no hard newline characters will be inserted after line breaks in what : // the user types into the field. The alternative wrap mode is 'hard', : // which means that hard newlines will be inserted. : : function textarea_field ($name=, $value=, $cols=50, $rows=10, : $wrap=soft) : { : $output = EOQ : textarea name=$name cols=$cols rows=$rows : wrap=$wrap$value/textarea : EOQ; : return $output; : } : : // string password_field ([string name [, string value [, int size : [, int maximum length) : : // This function returns an HTML password field. This is like a text : field, : // but the value of the field is obscured (only stars or bullets are : visible : // for each character). The default size of the field is 10. A : starting : // value and maximum data length may be supplied. : : function password_field ($name=, $value=, $size=10, $maxlen=) : { : $output = EOQ : input type=password name=$name value=$value size=$size : maxlength=$maxlen : EOQ; : return $output; : } : : // string hidden_field ([string name [, string value]]) : : // This function returns an HTML hidden field. A value may be supplied. : : function hidden_field ($name=, $value=) : { : $output = EOQ : input type=hidden name=$name value=$value : EOQ; : return $output; : } : : // string file_field ([string name]) : : // This function returns an HTML file field. These are used to specify : // files
Re: [PHP-DB] Forms error in a catalog by Greenspan Bulger
Excellent!! I'll do it! I didn't know about the editors. I'll let you know. Thank you very much! Darren P.Whiter wrote: Hi If you get yourself any decent text editor, it will have an option to show line numbers. Plenty of free editors here: http://download.cnet.com/downloads/0,10151,0-4003619-106-0-1-0,00.html?tag=d ir Personally I use and would recommend 'Ultra-edit' It would probably be a good idea to just post the line in question, due to line wrapping in mail it is difficult to figure out without going through the entire script where your error is. HTH Paul - Original Message - From: Darren [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 03, 2001 8:49 AM Subject: [PHP-DB] Forms error in a catalog by Greenspan Bulger : Greetings All! : : I am working on making a catalog from the example used in MySQL/PHP : Databases Applications by Jay Greenspan andBrad Bulger. I am using : php3 on the remote unix server. I had to remain all the php files : and there references in the documents from .php to .php3. I am : editing the code in a simple texteditor. : : Here is the problem. I keep getting a Parse error on line 33. : Question 1) How are you suposed count the lines? What is the exact : definition of a line? : Question 2) Can anybody tell me where the error is and or how to fix : it? Enclosed is the code. : : Thanks very much in advance for any help or comments. : : Darren : : Here Tis... : : ?php : /* : : *** This script from MySQL/PHP Database Applications *** : *** by Jay Greenspan and Brad Bulger *** : *** *** : *** You are free to resuse the material in this*** : *** script in any manner you see fit. There is *** : *** no need to ask for permission or provide *** : *** credit.*** : : */ : : // string start_form ([string action [, array attributes]]) : : // This function returns an HTML form tag. If the first argument : // is empty, the value of the global Apache variable SCRIPT_NAME : // is used for the 'action' attribute of the form tag. Other : // attributes for the form can be specified in the optional second : // argument; the default method of the form is post. : : // The behavior of this function on servers other than Apache is : // not known. It's likely that it will work, as SCRIPT_NAME is : // part of the CGI 1.1 specification. : : function start_form ($action=, $atts=) : { : global $SCRIPT_NAME; : : if (empty($action)) { $action = $SCRIPT_NAME; } : : $attlist = get_attlist($atts,array(method=post)); : $output = EOQ : form action=$action $attlist : EOQ; : return $output; : } : : // string end_form(void) : : // This function returns an HTML /form tag. : : function end_form () : { : $output = EOQ : /form : EOQ; : return $output; : } : : // string text_field ([string name [, string value [, int size [, : int maximum length) : : // This function returns an HTML text input field. The default size : // of the field is 10. A value and maximum data length for the field : // may be supplied. : : function text_field ($name=, $value=, $size=10, $maxlen=) : { : $maxatt = empty($maxlen) ? : maxlength=\$maxlen\; : $output = EOQ : input type=text name=$name value=$value size=$size $maxatt : EOQ; : return $output; : } : : // string textarea_field([string name [, string value [, int cols [, : int rows [, string wrap mode]) : : // This function returns an HTML textarea field. The default size is : // 50 columns and 10 rows, and the default wrap mode is 'soft', : which means : // no hard newline characters will be inserted after line breaks in what : // the user types into the field. The alternative wrap mode is 'hard', : // which means that hard newlines will be inserted. : : function textarea_field ($name=, $value=, $cols=50, $rows=10, : $wrap=soft) : { : $output = EOQ : textarea name=$name cols=$cols rows=$rows : wrap=$wrap$value/textarea : EOQ; : return $output; : } : : // string password_field ([string name [, string value [, int size : [, int maximum length) : : // This function returns an HTML password field. This is like a text : field, : // but the value of the field is obscured (only stars or bullets are : visible : // for each character). The default size of the field is 10. A : starting : // value and maximum data length may be supplied. : : function password_field ($name=, $value=, $size=10, $maxlen=) : { : $output = EOQ : input type=password name=$name value=$value size=$size : maxlength=$maxlen : EOQ; : return $output; : } : : // string hidden_field ([string name [, string value]]) : : // This function returns an HTML hidden field. A value may
Re: [PHP-DB] Forms error in a catalog by Greenspan Bulger
Thanks for the help on the free editors. Line 31 is blank The section is as follows: // string start_form ([string action [, array attributes]]) // This function returns an HTML form tag. If the first argument // is empty, the value of the global Apache variable SCRIPT_NAME // is used for the 'action' attribute of the form tag. Other // attributes for the form can be specified in the optional second // argument; the default method of the form is post. // The behavior of this function on servers other than Apache is // not known. It's likely that it will work, as SCRIPT_NAME is // part of the CGI 1.1 specification. function start_form ($action=, $atts=) { global $SCRIPT_NAME; if (empty($action)) { $action = $SCRIPT_NAME; } //this is line 31// $attlist = get_attlist($atts,array(method=post)); $output = EOQ form action=$action $attlist EOQ; return $output; } What do you think? Thanks Darren P.Whiter wrote: Hi If you get yourself any decent text editor, it will have an option to show line numbers. Plenty of free editors here: http://download.cnet.com/downloads/0,10151,0-4003619-106-0-1-0,00.html?tag=d ir Personally I use and would recommend 'Ultra-edit' It would probably be a good idea to just post the line in question, due to line wrapping in mail it is difficult to figure out without going through the entire script where your error is. HTH Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms error in a catalog by Greenspan Bulger (sorry line 33)
Sorry for the last post it is line 33 As follows // string start_form ([string action [, array attributes]]) // This function returns an HTML form tag. If the first argument // is empty, the value of the global Apache variable SCRIPT_NAME // is used for the 'action' attribute of the form tag. Other // attributes for the form can be specified in the optional second // argument; the default method of the form is post. // The behavior of this function on servers other than Apache is // not known. It's likely that it will work, as SCRIPT_NAME is // part of the CGI 1.1 specification. function start_form ($action=, $atts=) { global $SCRIPT_NAME; if (empty($action)) { $action = $SCRIPT_NAME; } $attlist = get_attlist($atts,array(method=post)); $output = EOQ //this is line 33// form action=$action $attlist EOQ; return $output; } * Remember I'm running php3 I'm going to look at the manuel from switching php3 to 4 and see if it mentions anything. I'm still very new to php Thanks Darren -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Forms error in a catalog by Greenspan Bulger
Greetings All! I am working on making a catalog from the example used in MySQL/PHP Databases Applications by Jay Greenspan andBrad Bulger. I am using php3 on the remote unix server. I had to remain all the php files and there references in the documents from .php to .php3. I am editing the code in a simple texteditor. Here is the problem. I keep getting a Parse error on line 33. Question 1) How are you suposed count the lines? What is the exact definition of a line? Question 2) Can anybody tell me where the error is and or how to fix it? Enclosed is the code. Thanks very much in advance for any help or comments. Darren Here Tis... ?php /* *** This script from MySQL/PHP Database Applications *** *** by Jay Greenspan and Brad Bulger *** *** *** *** You are free to resuse the material in this*** *** script in any manner you see fit. There is *** *** no need to ask for permission or provide *** *** credit.*** */ // string start_form ([string action [, array attributes]]) // This function returns an HTML form tag. If the first argument // is empty, the value of the global Apache variable SCRIPT_NAME // is used for the 'action' attribute of the form tag. Other // attributes for the form can be specified in the optional second // argument; the default method of the form is post. // The behavior of this function on servers other than Apache is // not known. It's likely that it will work, as SCRIPT_NAME is // part of the CGI 1.1 specification. function start_form ($action=, $atts=) { global $SCRIPT_NAME; if (empty($action)) { $action = $SCRIPT_NAME; } $attlist = get_attlist($atts,array(method=post)); $output = EOQ form action=$action $attlist EOQ; return $output; } // string end_form(void) // This function returns an HTML /form tag. function end_form () { $output = EOQ /form EOQ; return $output; } // string text_field ([string name [, string value [, int size [, int maximum length) // This function returns an HTML text input field. The default size // of the field is 10. A value and maximum data length for the field // may be supplied. function text_field ($name=, $value=, $size=10, $maxlen=) { $maxatt = empty($maxlen) ? : maxlength=\$maxlen\; $output = EOQ input type=text name=$name value=$value size=$size $maxatt EOQ; return $output; } // string textarea_field([string name [, string value [, int cols [, int rows [, string wrap mode]) // This function returns an HTML textarea field. The default size is // 50 columns and 10 rows, and the default wrap mode is 'soft', which means // no hard newline characters will be inserted after line breaks in what // the user types into the field. The alternative wrap mode is 'hard', // which means that hard newlines will be inserted. function textarea_field ($name=, $value=, $cols=50, $rows=10, $wrap=soft) { $output = EOQ textarea name=$name cols=$cols rows=$rows wrap=$wrap$value/textarea EOQ; return $output; } // string password_field ([string name [, string value [, int size [, int maximum length) // This function returns an HTML password field. This is like a text field, // but the value of the field is obscured (only stars or bullets are visible // for each character). The default size of the field is 10. A starting // value and maximum data length may be supplied. function password_field ($name=, $value=, $size=10, $maxlen=) { $output = EOQ input type=password name=$name value=$value size=$size maxlength=$maxlen EOQ; return $output; } // string hidden_field ([string name [, string value]]) // This function returns an HTML hidden field. A value may be supplied. function hidden_field ($name=, $value=) { $output = EOQ input type=hidden name=$name value=$value EOQ; return $output; } // string file_field ([string name]) // This function returns an HTML file field. These are used to specify // files on the user's local hard drive, typically for uploading as // part of the form. (See http://www.zend.com/manual/features.file-upload.php // for more information about this subject.) function file_field ($name=) { $output = EOQ input type=file name=$name EOQ; return $output; } // string submit_field ([string name [, string value]]) // This function returns an HTML submit field. The value of the field // will be the string displayed by the button displayed by the user's // browser. The default value is Submit. function submit_field ($name=, $value=) { if (empty($value)) { $value = Submit; } $output = EOQ input type=submit name=$name value=$value EOQ; return $output; } // string image_field
Re: [PHP-DB] Forms Question
Hi there, Take a look at the following snippet below. It is similar to what you're looking for without having to bugger about duplicating loads of lines for each store. Just add a new one to the array if required. Best Regards, - Paul - select name=MonthSelected size=1 ?php $MonthArr = array ( January, February, March, April, May, June, July, August, September, October, November, December, ); reset($MonthArr); foreach ($MonthArr as $MonthName) { echo option VALUE=\$MonthName\; if ($MonthName == $MonthSelected) echo selected; echo ; echo $MonthName; } ? /select - Original Message - From: Steve Cayford [EMAIL PROTECTED] To: Jeff Grossman [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, September 05, 2001 11:36 PM Subject: Re: [PHP-DB] Forms Question On Wednesday, September 5, 2001, at 04:50 PM, Jeff Grossman wrote: Hello, Here is the code I have: while ($row=mysql_fetch_array($result)) { $store=$row[store]; $jobdesc=$row[jobdesc]; echo FORM METHOD=post ACTION=update.php; echo PStore: Select NAME=\$store\ option VALUE=\Signal Hill\Signal Hill option VALUE=\Reseda\Reseda option VALUE=\Orange\Orange option VALUE=\West Covina\West Covina option VALUE=\Riverside\Riverside option VALUE=\Norwalk\Norwalk option VALUE=\Fountain Valley\Fountain Valley option VALUE=\Pasadena\Pasadena option VALUE=\Redondo Beach\Redondo Beach option VALUE=\San Bernardino\San Bernardino option VALUE=\Kearny Mesa\Kearny Mesa option VALUE=\San Marcos\San Marcos option VALUE=\Chino\Chino option VALUE=\Coporate Office\Corporate Office /select/P; echo PINPUT TYPE=text SIZE=35 NAME=\Jobdesc\ VALUE=\$jobdesc\/P; echo pINPUT TYPE=submit VALUE=\submit\ LABEL=\Save Changes\/P; } Is want I am trying to do possible? I want the value which is stored in $store to automatically fill in on the drop down list. But, for some reason it is defaulting to the first option, and not using the value that is in the database. Can I use a drop down menu, or should I just go to radio buttons? Thanks, Jeff If I understand your question... In order to have your value preset in the drop down list you need indicate that with option value=\blahblah\ selectedblahblah What I've been using for this is a hash like this: while ($row=mysql_fetch_array($result)) { $selected = array(); $selected[$row[store]] = selected; $store=$row[store]; $jobdesc=$row[jobdesc]; echo FORM METHOD=post ACTION=update.php; echo PStore:; echo Select NAME=NameOfVariableToBePosted echo option VALUE=\Signal Hill\ . $selected[Signal Hill] . Signal Hill; echo option VALUE=\Reseda\ . $selected[Reseda] . Reseda; ...etc, etc., etc. something along those lines, anyway. So, if $row[store] == Signal Hill, then $selected[Signal Hill] will be set to selected, while $selected[Reseda] and all the others will be blank. This is a very keen thing about php. -Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Forms Question
Hello, Here is the code I have: while ($row=mysql_fetch_array($result)) { $store=$row[store]; $jobdesc=$row[jobdesc]; echo FORM METHOD=post ACTION=update.php; echo PStore: Select NAME=\$store\ option VALUE=\Signal Hill\Signal Hill option VALUE=\Reseda\Reseda option VALUE=\Orange\Orange option VALUE=\West Covina\West Covina option VALUE=\Riverside\Riverside option VALUE=\Norwalk\Norwalk option VALUE=\Fountain Valley\Fountain Valley option VALUE=\Pasadena\Pasadena option VALUE=\Redondo Beach\Redondo Beach option VALUE=\San Bernardino\San Bernardino option VALUE=\Kearny Mesa\Kearny Mesa option VALUE=\San Marcos\San Marcos option VALUE=\Chino\Chino option VALUE=\Coporate Office\Corporate Office /select/P; echo PINPUT TYPE=text SIZE=35 NAME=\Jobdesc\ VALUE=\$jobdesc\/P; echo pINPUT TYPE=submit VALUE=\submit\ LABEL=\Save Changes\/P; } Is want I am trying to do possible? I want the value which is stored in $store to automatically fill in on the drop down list. But, for some reason it is defaulting to the first option, and not using the value that is in the database. Can I use a drop down menu, or should I just go to radio buttons? Thanks, Jeff -- Jeff Grossman ([EMAIL PROTECTED]) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms Question
Hello, Here is the code I have: sure, your query is something like: select ..., store, jobdesc .. FROM .. why using: $store=$row[store]; $jobdesc=$row[jobdesc]; echodhdhdh.$row[store].blabla would also work i should use: while (LIST($store,$jobdesc)=mysql_fetch_row($result)) { . - Original Message - From: Jeff Grossman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 05, 2001 11:50 PM Subject: [PHP-DB] Forms Question Hello, Here is the code I have: while ($row=mysql_fetch_array($result)) { $store=$row[store]; $jobdesc=$row[jobdesc]; echo FORM METHOD=post ACTION=update.php; echo PStore: Select NAME=\$store\ option VALUE=\Signal Hill\Signal Hill option VALUE=\Reseda\Reseda option VALUE=\Orange\Orange option VALUE=\West Covina\West Covina option VALUE=\Riverside\Riverside option VALUE=\Norwalk\Norwalk option VALUE=\Fountain Valley\Fountain Valley option VALUE=\Pasadena\Pasadena option VALUE=\Redondo Beach\Redondo Beach option VALUE=\San Bernardino\San Bernardino option VALUE=\Kearny Mesa\Kearny Mesa option VALUE=\San Marcos\San Marcos option VALUE=\Chino\Chino option VALUE=\Coporate Office\Corporate Office /select/P; echo PINPUT TYPE=text SIZE=35 NAME=\Jobdesc\ VALUE=\$jobdesc\/P; echo pINPUT TYPE=submit VALUE=\submit\ LABEL=\Save Changes\/P; } Is want I am trying to do possible? I want the value which is stored in $store to automatically fill in on the drop down list. But, for some reason it is defaulting to the first option, and not using the value that is in the database. Can I use a drop down menu, or should I just go to radio buttons? Thanks, Jeff -- Jeff Grossman ([EMAIL PROTECTED]) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms Question
On Wednesday, September 5, 2001, at 04:50 PM, Jeff Grossman wrote: Hello, Here is the code I have: while ($row=mysql_fetch_array($result)) { $store=$row[store]; $jobdesc=$row[jobdesc]; echo FORM METHOD=post ACTION=update.php; echo PStore: Select NAME=\$store\ option VALUE=\Signal Hill\Signal Hill option VALUE=\Reseda\Reseda option VALUE=\Orange\Orange option VALUE=\West Covina\West Covina option VALUE=\Riverside\Riverside option VALUE=\Norwalk\Norwalk option VALUE=\Fountain Valley\Fountain Valley option VALUE=\Pasadena\Pasadena option VALUE=\Redondo Beach\Redondo Beach option VALUE=\San Bernardino\San Bernardino option VALUE=\Kearny Mesa\Kearny Mesa option VALUE=\San Marcos\San Marcos option VALUE=\Chino\Chino option VALUE=\Coporate Office\Corporate Office /select/P; echo PINPUT TYPE=text SIZE=35 NAME=\Jobdesc\ VALUE=\$jobdesc\/P; echo pINPUT TYPE=submit VALUE=\submit\ LABEL=\Save Changes\/P; } Is want I am trying to do possible? I want the value which is stored in $store to automatically fill in on the drop down list. But, for some reason it is defaulting to the first option, and not using the value that is in the database. Can I use a drop down menu, or should I just go to radio buttons? Thanks, Jeff If I understand your question... In order to have your value preset in the drop down list you need indicate that with option value=\blahblah\ selectedblahblah What I've been using for this is a hash like this: while ($row=mysql_fetch_array($result)) { $selected = array(); $selected[$row[store]] = selected; $store=$row[store]; $jobdesc=$row[jobdesc]; echo FORM METHOD=post ACTION=update.php; echo PStore:; echo Select NAME=NameOfVariableToBePosted echo option VALUE=\Signal Hill\ . $selected[Signal Hill] . Signal Hill; echo option VALUE=\Reseda\ . $selected[Reseda] . Reseda; ...etc, etc., etc. something along those lines, anyway. So, if $row[store] == Signal Hill, then $selected[Signal Hill] will be set to selected, while $selected[Reseda] and all the others will be blank. This is a very keen thing about php. -Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms Question
The solution is easier than you think. You'll need to insert an if statement in your option html tag that says echo option VALUE=\Signal Hill\Signal Hill\n; should become: echo option VALUE=\Signal Hill\; if ($store == 'Signal Hill') { print selected; } echo Signal Hill/option\n; Jeff Grossman wrote: Hello, Here is the code I have: while ($row=mysql_fetch_array($result)) { $store=$row[store]; $jobdesc=$row[jobdesc]; echo FORM METHOD=post ACTION=update.php; echo PStore: Select NAME=\$store\ option VALUE=\Signal Hill\Signal Hill option VALUE=\Reseda\Reseda option VALUE=\Orange\Orange option VALUE=\West Covina\West Covina option VALUE=\Riverside\Riverside option VALUE=\Norwalk\Norwalk option VALUE=\Fountain Valley\Fountain Valley option VALUE=\Pasadena\Pasadena option VALUE=\Redondo Beach\Redondo Beach option VALUE=\San Bernardino\San Bernardino option VALUE=\Kearny Mesa\Kearny Mesa option VALUE=\San Marcos\San Marcos option VALUE=\Chino\Chino option VALUE=\Coporate Office\Corporate Office /select/P; echo PINPUT TYPE=text SIZE=35 NAME=\Jobdesc\ VALUE=\$jobdesc\/P; echo pINPUT TYPE=submit VALUE=\submit\ LABEL=\Save Changes\/P; } Is want I am trying to do possible? I want the value which is stored in $store to automatically fill in on the drop down list. But, for some reason it is defaulting to the first option, and not using the value that is in the database. Can I use a drop down menu, or should I just go to radio buttons? Thanks, Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Forms and PHP
I am using PHP4.0.0 on Mysql3.23.31 on a RH6.2(kernel2.4). I am unsuccessful in attempting to have the FORM work with POST method, while there is a select with option alongwith other variables that I am accepting directly from text fields. Its something like this form action=analyse.php method=post select name= ?php / / I try to populate from a table in MySQL (which works)-- / / like this, which is in a loop--getting tableid and tablefield option value=$tableid$tablefield/option ? /select My problem starts here when I accept other variables before posting the form contents. eg: input name=xxx type=text input type="submit" name="submit" value="Proceed" /form In my analyse.php, when I try to list out the various variables posted from here, it doesn't show up. I even tried adding all the variables as input type=hidden before submitting the form, but it still doesn't show up. When there is no select /select section, the whole variables show up. Where could I be wrong ? Raju --
Re: [PHP-DB] Forms : Validating user input is integer
Manuel, Manuel Lemos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... | Hello boclair, | | On 05-Apr-01 01:58:24, you wrote: | | I have a problem with a user input in a form required to be an | integer, creating a variable for a mysql query. | | I have instances where integer, 0, is being typed as letter,o. | | You may want to try this PHP form generation and validation class that does | exactly what you need and more. | | http://phpclasses.UpperDesign.com/browse.html/package/1 | | | It does both client and server side validation. For the client side it | uses the isNaN(parseInt(value)) Javascript functions. For the server side | it uses the strcmp($value,strval(intval($value))) PHP functions . | | | Regards, | Manuel Lemos | | Web Programming Components using PHP Classes. | Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED] | -- | E-mail: [EMAIL PROTECTED] | URL: http://www.mlemos.e-na.net/ | PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp I downloaded the files and am studying them. Certainly comprehensive. Many thanks Tim Morris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms : Validating user input is integer
Hello boclair, On 05-Apr-01 01:58:24, you wrote: I have a problem with a user input in a form required to be an integer, creating a variable for a mysql query. I have instances where integer, 0, is being typed as letter,o. The last discussion of validating the input was http://marc.theaimsgroup.com/?l=php-dbm=97207172003983w=2 There it was suggested that the only way to validate the input was using javascript. I have a case where clients have disabled javascript. I tried fiddling with is_int($input) but of cause it does not serve this purpose. Does anybody know if such validation can be done server side or definitely must be done client side? You may want to try this PHP form generation and validation class that does exactly what you need and more. http://phpclasses.UpperDesign.com/browse.html/package/1 It does both client and server side validation. For the client side it uses the isNaN(parseInt(value)) Javascript functions. For the server side it uses the strcmp($value,strval(intval($value))) PHP functions . Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED] -- E-mail: [EMAIL PROTECTED] URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE : [PHP-DB] Forms : Validating user input as integer
Manuel, Manuel Lemos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... | Hello boclair, | | On 05-Apr-01 01:58:24, you wrote: | | I have a problem with a user input in a form required to be an | integer, creating a variable for a mysql query. | | I have instances where integer, 0, is being typed as letter,o. | | You may want to try this PHP form generation and validation class that does | exactly what you need and more. | | http://phpclasses.UpperDesign.com/browse.html/package/1 | | | It does both client and server side validation. For the client side it | uses the isNaN(parseInt(value)) Javascript functions. For the server side | it uses the strcmp($value,strval(intval($value))) PHP functions . | | | Regards, | Manuel Lemos | | Web Programming Components using PHP Classes. | Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED] | -- | E-mail: [EMAIL PROTECTED] | URL: http://www.mlemos.e-na.net/ | PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp I downloaded the files and am studying them. Certainly comprehensive. Many thanks Tim Morris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms : Validating user input is integer
Thanks Steve, It is not my choice re javascript in this case I have tried to use the functions is_int($input_var) and is_integer($input_var) and the !versions as you suggest but with failures. Example 1_ if ((@!$submit) || (!is_int($input_var)) ) { echo "error"; include "get_id.php"; } else { _Example 2_ if ((@!$submit)) { echo "error"; include "get_id.php"; } elseif (is_int($num)) { _ There were no problems before attempting validation with is_int() and is_integer(). The integer validation was being with a javascript and the creation of the variable was OK. Further advise appreciated. Tim - Original Message - From: Steve Farmer [EMAIL PROTECTED] To: boclair [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, April 05, 2001 3:23 PM Subject: Re: [PHP-DB] Forms : Validating user input is integer Hi tim, most certainly it can be done on the server side, it juts requires a round trip to the server is all i think it is .. if(!isinteger($input_var)): (check the exact function in the php manual) echo "this is an error (or whatever), press here to go back and correct your inpout"; exit; /* stops the script executing */ endif; HTH Steve At 3:05 PM +1000 5/4/01, boclair wrote: I have a problem with a user input in a form required to be an integer, creating a variable for a mysql query. I have instances where integer, 0, is being typed as letter,o. The last discussion of validating the input was http://marc.theaimsgroup.com/?l=php-dbm=97207172003983w=2 There it was suggested that the only way to validate the input was using javascript. I have a case where clients have disabled javascript. I tried fiddling with is_int($input) but of cause it does not serve this purpose. Does anybody know if such validation can be done server side or definitely must be done client side? Tim Morris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- --- "Minds are like parachutes, they work best when open" Support free speech; visit http://www.efa.org.au/ Heads Together Systems Pty Ltd http://www.hts.com.au Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms : Validating user input is integer
- Original Message - From: Matt Williams [EMAIL PROTECTED] To: boclair [EMAIL PROTECTED] Sent: Thursday, April 05, 2001 9:03 PM Subject: RE: [PHP-DB] Forms : Validating user input is integer To gain the full benefit of your suggestion I find that I can validate for a wrong entry containing a mix alphabetical and numerical characters by altering the elseif line to read elseif (!eregi("[0-9]",$num) || eregi("[a-z]",$num)) Agreed? yes and no. I've done a lot of testing for this and using just the first one has never let any values of $num through unles they've contained only numbers. AFAIK (!eregi("[0-9]",$num) should always return false or 0 or whatever it is unless it contains only numbers. When I used only elseif (!eregi("[0-9]",$num) { } an input 2i passed the variable 2 You could also use [^a-zA-Z] for letters you don't want. so maybe something like (!eregi("([0-9]||[^a-zA-Z])",$num)) not tried so don't rely on that. xx correcting some typos this does the job elegantly. Should read elseif (!eregi(("[0-9]" || "[^a-zA-Z]"),$num)){ } xx Check out the phpbuilder.com regexp tutorial, I find it a good resource http://www.phpbuilder.com/columns/dario19990616.php3 Have read it and got confused. Will re-read it with my eyes open. Thanks for holding my hand. Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms : Validating user input is integer
"boclair" [EMAIL PROTECTED] wrote in message 004801c0bdc7$13afbe00$[EMAIL PROTECTED]">news:004801c0bdc7$13afbe00$[EMAIL PROTECTED]... | | - Original Message - | From: Matt Williams [EMAIL PROTECTED] | To: boclair [EMAIL PROTECTED] | Sent: Thursday, April 05, 2001 9:03 PM | Subject: RE: [PHP-DB] Forms : Validating user input is integer | | | | To gain the full benefit of your suggestion I find that I can | validate | for a wrong entry containing a mix alphabetical and numerical | characters by altering the elseif line to read | | elseif (!eregi("[0-9]",$num) || eregi("[a-z]",$num)) | | Agreed? | | | yes and no. | | I've done a lot of testing for this and using just the first one has | never | let any values of $num through unles they've contained only numbers. | AFAIK (!eregi("[0-9]",$num) should always return false or 0 or | whatever it | is unless it contains only numbers. | | | When I used only elseif (!eregi("[0-9]",$num) { } | an input 2i passed the variable 2 | | | You could also use [^a-zA-Z] for letters you don't want. | so maybe something like (!eregi("([0-9]||[^a-zA-Z])",$num)) | not tried so don't rely on that. | | xx | correcting some typos this does the job elegantly. Should read | | elseif (!eregi(("[0-9]" || "[^a-zA-Z]"),$num)){ } | xx or even just elseif (!eregi("[^a-zA-Z]"),$num)) { } Tim Morris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Forms : Validating user input is integer
or even just elseif (!eregi("[^a-zA-Z]"),$num)) { } But that would not stop other characters. M@ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms : Validating user input is integer
"Matt Williams" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... | | or even just | elseif (!eregi("[^a-zA-Z]"),$num)) { } | | But that would not stop other characters. | | M@ Whoops! Careless of me. The line should read, and as I tested it, elseif (eregi("[a-zA-Z]",$num)) { } Do you see any problem with this? I have tried with every type and mix of input that I can think of and was successful in denying all but digit inputs, but I have little confidence in what I am doing. With your examples I am at least coming to some understanding of Dario Gomes article on PHPBuilder. Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Forms : Validating user input is integer
Whoops! Careless of me. The line should read, and as I tested it, elseif (eregi("[a-zA-Z]",$num)) { } Do you see any problem with this? Yes, same thing it will accept other character like !*- etc... try if(!eregi("^[0-9]+[0-9]*$",$num) { //error } M@ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms : Validating user input is integer
- Original Message - From: Matt Williams [EMAIL PROTECTED] To: Boclair [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, April 05, 2001 11:28 PM Subject: RE: [PHP-DB] Forms : Validating user input is integer The line should read, and as I tested it, elseif (eregi("[a-zA-Z]",$num)) { } Do you see any problem with this? Yes, same thing it will accept other character like !*- etc... try if(!eregi("^[0-9]+[0-9]*$",$num) file://error } You are right again. Stops all further processing of the inserted variable if it is not entirely composed of digits. It did not cross my mind to check for ! (shift 1) and similar entry errors. Once again, thanks. Tim So here is the final working script ? if ((@!$submit) || empty($num) ) { echo "div align='center'span class='note'No entry was made/span/div"; include "get_id.php"; } if(!eregi("^[0-9]+[0-9]*$",$num)) { echo "div align='center'span class='note'The ID should have been a number./span/div"; include "get_id.php"; } else { include "do_form.php"; } ? Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms : Validating user input is integer
"boclair" [EMAIL PROTECTED] wrote in message 002101c0bd8e$30742e60$[EMAIL PROTECTED]">news:002101c0bd8e$30742e60$[EMAIL PROTECTED]... | I have a problem with a user input in a form required to be an | integer, creating a variable for a mysql query. | | I have instances where integer, 0, is being typed as letter,o. | Does anybody know if such validation can be done server side or | definitely must be done client side? Brad S Jackson replied suggesting that the php function preg_match() should be used for this type of server side validation. ^^ Brad, - Original Message - From: Brad S. Jackson [EMAIL PROTECTED] To: boclair [EMAIL PROTECTED] Sent: Thursday, April 05, 2001 11:54 PM Subject: Re: [PHP-DB] Forms : Validating user input is integer This is probably the most efficient way to check. The preg functions are faster than the ereg functions so I never use ereg. I think server side validation is required and client side is optional. if(preg_match("/^[0-9]+$/", $var)) echo "Valid"; else echo "Invalid"; There you go. Does the same job as Matt William's eregi() I am getting invaluable lessons on this stuff, which I never understood before. Using the php preg_match() function the tested script is _ ? if ((@!$submit) || empty($num) ) { echo "div align='center'span class='note'No entry was made/span/div"; include "get_id.php"; } if(preg_match("/^[0-9]+$/", $num)) { include "do_form.php"; } else { echo "div align='center'span class='note'The ID should have been a number./span/div"; include "get_id.php"; } ? ___ Many thanks ^^^ Tim Morris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Forms : Validating user input is integer
Ben Udall [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... | boclair wrote: | I have a problem with a user input in a form required to be an | integer, creating a variable for a mysql query. | | I have instances where integer, 0, is being typed as letter,o. | Does anybody know if such validation can be done server side or | definitely must be done client side? | | A basic client-server rule is to never trust the client. You should be | doing all validation on the server side. Client side validation is a | nice feature, but should be in addition to the sever side checking and | never required. | | Here's the quickest way I know to validate an integer in php: | | if (ereg("^[0-9]+$", $input)) | { |// $input is a valid non-negative integer | } | | or, if negative numbers are valid, use could use this one: | | if (ereg("^-?[0-9]+$", $input)) | { |// $input is a valid integer | } Once again, thanks. This validates for an all digit variable. In this case the tested script reads ? if ((@!$submit) || empty($num) ) { echo "div align='center'span class='note'No entry was made/span/div"; include "get_id.php"; } if (ereg("^[0-9]+$", $input)) { include "do_form.php"; } else { echo "div align='center'span class='note'The ID should have been a number./span/div"; include "get_id.php"; } ? Will I ever get on the ball and stay there Tim Morris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]