RE: [PHP] Forms PHP
[snip] I have a form that gets filled out and within this form there is a link to add additional information in a new form. When this information is saved I would like the browser to redirect to the previous form (this I can do) but with all the details they have already filled out still in the text boxes. What is the easiest way to do this using PHP? [/snip] By maintaining the POST (assuming you're using POST)variables and calling them into the form values when reloaded. If you go to the second page store the POST variables in hidden form input types, then grab them when the second page is POSTED. Does this make sense? Not enough caffeine for me yet... Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms PHP
[snip] By maintaining the POST (assuming you're using POST)variables and calling them into the form values when reloaded. If you go to the second page store the POST variables in hidden form input types, then grab them when the second page is POSTED. Does this make sense? Not enough caffeine for me yet...[/snip] So basically I need to have 2 versions of the first page, is that right? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms PHP
[snip] By maintaining the POST (assuming you're using POST)variables and calling them into the form values when reloaded. If you go to the second page store the POST variables in hidden form input types, then grab them when the second page is POSTED. Does this make sense? Not enough caffeine for me yet...[/snip] So basically I need to have 2 versions of the first page, is that right? :) [/snip] Not really, test for emptiness of the variable (isset())...if it is set display it, if not show it as blank. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms PHP[Scanned]
If I've understood your initial email correctly another approach would be to save the contents of the form to your database and populate the form fields presented subsequently with information retrieved from the database. You can use the header function to redirect to whatever page you wish once the information has been saved. Regards, Michael Egan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms PHP
[snip] Not really, test for emptiness of the variable (isset())...if it is set display it, if not show it as blank. HTH! Jay [/snip] You'll have to forgive me as I am unfamiliar with PHP, still a beginner!! So if I have a page (page1.php) which is my first page with a form. When I click a normal link within this form it takes me to page2.php. This page has another smaller form. When the submit button in this form is clicked it updates the database with no problems and displays a link - linking back to page1.php (I have decided not to use redirect). How do load the page and fill all the text boxes with the information that was already written - because this information (from page1.php, first form) has not been saved to the database yet. You probably knew this anyway - but I had to go through that process to satisfy myself!! Many Thanks Gary Ogilvie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms PHP[Scanned]
Wouldn't I then be saving the contents of that page twice in the database? -Original Message- From: Michael Egan [mailto:[EMAIL PROTECTED] Sent: 02 July 2003 14:53 To: PHP General Subject: RE: [PHP] Forms PHP[Scanned] If I've understood your initial email correctly another approach would be to save the contents of the form to your database and populate the form fields presented subsequently with information retrieved from the database. You can use the header function to redirect to whatever page you wish once the information has been saved. Regards, Michael Egan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms PHP
On Wed, 2 Jul 2003 14:45:27 +0100, Gary Ogilvie [EMAIL PROTECTED] wrote: [snip] By maintaining the POST (assuming you're using POST)variables and calling them into the form values when reloaded. If you go to the second page store the POST variables in hidden form input types, then grab them when the second page is POSTED. Does this make sense? Not enough caffeine for me yet...[/snip] So basically I need to have 2 versions of the first page, is that right? :) No, in your first form you have code like ?php if ((!isset($_POST)) || (!isset($_POST['foo']))) { $foo = set default value here; } else { $foo = $_POST['foo']; } ? form method=post action=form2.php input type=text name=foo value=?php echo $foo;? / ... /form and in the second form you have: form method=post action=form1.php input type=hidden name=foo value=?php echo $_POST['foo'];? / ... /form Cheers, Greg. -- Greg Wiley www.wileysworld.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms PHP
Ah I understand that - many thanks. -Original Message- From: Greg Wiley [mailto:[EMAIL PROTECTED] Sent: 02 July 2003 14:59 To: Gary Ogilvie; 'PHP General' Subject: Re: [PHP] Forms PHP On Wed, 2 Jul 2003 14:45:27 +0100, Gary Ogilvie [EMAIL PROTECTED] wrote: [snip] By maintaining the POST (assuming you're using POST)variables and calling them into the form values when reloaded. If you go to the second page store the POST variables in hidden form input types, then grab them when the second page is POSTED. Does this make sense? Not enough caffeine for me yet...[/snip] So basically I need to have 2 versions of the first page, is that right? :) No, in your first form you have code like ?php if ((!isset($_POST)) || (!isset($_POST['foo']))) { $foo = set default value here; } else { $foo = $_POST['foo']; } ? form method=post action=form2.php input type=text name=foo value=?php echo $foo;? / ... /form and in the second form you have: form method=post action=form1.php input type=hidden name=foo value=?php echo $_POST['foo'];? / ... /form Cheers, Greg. -- Greg Wiley www.wileysworld.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms PHP
[snip] You'll have to forgive me as I am unfamiliar with PHP, still a beginner!! So if I have a page (page1.php) which is my first page with a form. When I click a normal link within this form it takes me to page2.php. This page has another smaller form. When the submit button in this form is clicked it updates the database with no problems and displays a link - linking back to page1.php (I have decided not to use redirect). How do load the page and fill all the text boxes with the information that was already written - because this information (from page1.php, first form) has not been saved to the database yet. You probably knew this anyway - but I had to go through that process to satisfy myself!! [/snip] If you are just clicking on a link instead of submitting the information you have not populated any variables...so no recall is available unless the clicked link is formatted to hold the variables (a GET). For instance a href = someotherpage.php?name=GaryClick Here/a $_GET['name'] is equal to Gary You can do it for more than one variable... a href = someotherpage.php?name=Garyaddress=ChicagoClick Here/a $_GET['name'] is equal to Gary $_GET['address'] is equal to Chicago HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms PHP - Thanks
Thanks all, I shall try these methods now. I may be a while - the form is pretty large :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms
Hi can anyone help me with this? I have been failing to get any forms working with PHP now I have run out of ideas? Having bought 3 books the latest one being php mysql for dummies(which might be appropriate for me) I am still failing at this hurdle. the following script is a classic example taken straight out of the book, I get round the $PHP_SELF problem ok but then all the script does is loop back to itself? !-- Program Name: mysql_send.php Description: PHP program that sends an SQL query to the MySQL server and displays the results. -- html head titleSQL Query Sender/title /head body ?php $user=root; $host=localhost; $password=; /* Section that executes query */ if (@$form == yes) { mysql_connect($host,$user,$password); mysql_select_db($database); $query = stripSlashes($query) ; $result = mysql_query($query); echo Database Selected: b$database/bbr Query: b$query/b h3Results/h3 hr; if ($result == 0) echo(bError . mysql_errno() . : . mysql_error() . /b); elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned./bbr); else { echo table border='1' thead tr; for ($i = 0; $i mysql_num_fields($result); $i++) { echo(th . mysql_field_name($result,$i) . /th); } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i++) { echo tr; $row = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo(td . $row[$j] . /td); } echo /tr; } echo /tbody /table; } echo hrbr form action=$PHP_SELF method=post input type=hidden name=query value=\$query\ input type=hidden name=database value=$database input type=submit name=\queryButton\ value=\New Query\ input type=submit name=\queryButton\ value=\Edit Query\ /form; unset($form); exit(); } /* Section that requests user input of query */ @$query = stripSlashes($query); if (@$queryButton != Edit Query) { $database = ; $query = ; } ? form action=?php echo $PHP_SELF ??form=yes method=post table tr td align=rightbType in database name/b/td td input type=text name=database value=?php echo $database ? /td /tr tr td align=right valign=topbType in SQL query/b/td tdtextarea name=query cols=60 rows=10?php echo $query ?/textarea /td /tr tr td colspan=2 align=centerinput type=submit value=Submit Query/td /tr /table /form /body /html Any ideas would be greatly appreciated as I am floundering badly! Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Have you checked register_globals = on/off in your php.ini? If register_globals=off, then you must access your POST variables by: $_POST['whatever']; and your get (the stuff you put at the end of your URL's): $_GET['whatever']; On Mon, 2003-06-30 at 15:48, Simon Chappell wrote: Hi can anyone help me with this? I have been failing to get any forms working with PHP now I have run out of ideas? Having bought 3 books the latest one being php mysql for dummies(which might be appropriate for me) I am still failing at this hurdle. the following script is a classic example taken straight out of the book, I get round the $PHP_SELF problem ok but then all the script does is loop back to itself? !-- Program Name: mysql_send.php Description: PHP program that sends an SQL query to the MySQL server and displays the results. -- html head titleSQL Query Sender/title /head body ?php $user=root; $host=localhost; $password=; /* Section that executes query */ if (@$form == yes) { mysql_connect($host,$user,$password); mysql_select_db($database); $query = stripSlashes($query) ; $result = mysql_query($query); echo Database Selected: b$database/bbr Query: b$query/b h3Results/h3 hr; if ($result == 0) echo(bError . mysql_errno() . : . mysql_error() . /b); elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned./bbr); else { echo table border='1' thead tr; for ($i = 0; $i mysql_num_fields($result); $i++) { echo(th . mysql_field_name($result,$i) . /th); } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i++) { echo tr; $row = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo(td . $row[$j] . /td); } echo /tr; } echo /tbody /table; } echo hrbr form action=$PHP_SELF method=post input type=hidden name=query value=\$query\ input type=hidden name=database value=$database input type=submit name=\queryButton\ value=\New Query\ input type=submit name=\queryButton\ value=\Edit Query\ /form; unset($form); exit(); } /* Section that requests user input of query */ @$query = stripSlashes($query); if (@$queryButton != Edit Query) { $database = ; $query = ; } ? form action=?php echo $PHP_SELF ??form=yes method=post table tr td align=rightbType in database name/b/td td input type=text name=database value=?php echo $database ? /td /tr tr td align=right valign=topbType in SQL query/b/td tdtextarea name=query cols=60 rows=10?php echo $query ?/textarea /td /tr tr td colspan=2 align=centerinput type=submit value=Submit Query/td /tr /table /form /body /html Any ideas would be greatly appreciated as I am floundering badly! Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms
Most books, specially the older ones will use this type of coding. It relies completely on register_globals (and some other settings) to be enabled in your php.ini. However, many possible security risks has been identified with having register_globals=on, so newer versions come with that feature disabled by default. This has been discussed to great depths in the archives, and arguably, if you design your code with security in mind, turning register_globals on, will and should not cause any problems. On the other hand, it is becoming a standard, so unless you have your own server, or you know your ISP will turn it on for you, then you are probably better off accessing your variables through the POST and GET arrays. As I said in my first post, it is basically in the way that you call your variables. If you look at your example: You have a form that has the same page as the action, using the POST method, meaning that all the names of form elements and the correlating values, will be passed to the action page as POST variables. All these variables get stored in the $_POST array. So, as an example: Your form has a input type=text name=var1 value=test With your code in mind, hitting the submit on the form, will place a new element in the $_POST array, called var1 ad associative value = test And if you need to echo or use that variable/value, you should do so by calling it like so: echo $_POST[var1]; output - test If you look closely at your code, you will see an If /* Section that executes query */ if (@$form == yes) { and you will also see that the form being shown on first load of the page, has a get variable appended to it in the action: form action=?php echo $PHP_SELF ??form=yes method=post table tr td align=rightbType in database name/b/td td that ?form=yes bit, creates a $_GET variable called $_GET[form] with a value of yes So, for your code to work, the IF statement should read: if ($_GET[form] == yes) { Basically, the reason why it looks like your page is not doing anything, is because the if cannot be satisfied... You should thus go through that sample code and change the nameing of your POST and GET variables (ie, the variables that are passed to the next page to the abovementioned method and all should be fine. -Original Message- From: Simon Chappell [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 6:22 PM To: Petre Agenbag Subject: Re: [PHP] Forms thanks for the reply yes I have tried both on and off, it is currently off? Where would i put those in my script? or do I have to start from scratch? The reason I am asking, is that all the books I have seem to be doing the same out of date coding, and if it is possible to make a quick change that I can carry with me through my learning then I can get use out of all the books that i have bought! but if all the scripts are pointless then i might as well light a match or give them to my 6 year old and ask him to look after them!! Many thanks Simon On Monday 30 Jun 2003 3:14 pm, Petre Agenbag wrote: Have you checked register_globals = on/off in your php.ini? If register_globals=off, then you must access your POST variables by: $_POST['whatever']; and your get (the stuff you put at the end of your URL's): $_GET['whatever']; On Mon, 2003-06-30 at 15:48, Simon Chappell wrote: Hi can anyone help me with this? I have been failing to get any forms working with PHP now I have run out of ideas? Having bought 3 books the latest one being php mysql for dummies(which might be appropriate for me) I am still failing at this hurdle. the following script is a classic example taken straight out of the book, I get round the $PHP_SELF problem ok but then all the script does is loop back to itself? !-- Program Name: mysql_send.php Description: PHP program that sends an SQL query to the MySQL server and displays the results. -- html head titleSQL Query Sender/title /head body ?php $user=root; $host=localhost; $password=; /* Section that executes query */ if (@$form == yes) { mysql_connect($host,$user,$password); mysql_select_db($database); $query = stripSlashes($query) ; $result = mysql_query($query); echo Database Selected: b$database/bbr Query: b$query/b h3Results/h3 hr; if ($result == 0) echo(bError . mysql_errno() . : . mysql_error() . /b); elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned./bbr); else { echo table border='1' thead tr; for ($i = 0; $i mysql_num_fields($result); $i++) { echo(th . mysql_field_name($result,$i) . /th); } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i
RE: [PHP] Forms
Additionally, you could put this in a header file or the top of your page: reset ($_GET); while (list ($key, $val) = each ($_GET)) { //echo $key = $valbr\n; $$key = $val; } reset ($_POST); while (list ($key, $val) = each ($_POST)) { //echo $key = $valbr\n; $$key = $val; } reset ($_SESSION); while (list ($key, $val) = each ($_SESSION)) { //echo $key = $valbr\n; $$key = $val; } So you can leave register_globals = off and get mostly the same functionality (and security issues if you're worried about them too). -Original Message- From: Petre Agenbag [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 7:14 AM To: Simon Chappell Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Forms Have you checked register_globals = on/off in your php.ini? If register_globals=off, then you must access your POST variables by: $_POST['whatever']; and your get (the stuff you put at the end of your URL's): $_GET['whatever']; On Mon, 2003-06-30 at 15:48, Simon Chappell wrote: Hi can anyone help me with this? I have been failing to get any forms working with PHP now I have run out of ideas? Having bought 3 books the latest one being php mysql for dummies(which might be appropriate for me) I am still failing at this hurdle. the following script is a classic example taken straight out of the book, I get round the $PHP_SELF problem ok but then all the script does is loop back to itself? !-- Program Name: mysql_send.php Description: PHP program that sends an SQL query to the MySQL server and displays the results. -- html head titleSQL Query Sender/title /head body ?php $user=root; $host=localhost; $password=; /* Section that executes query */ if (@$form == yes) { mysql_connect($host,$user,$password); mysql_select_db($database); $query = stripSlashes($query) ; $result = mysql_query($query); echo Database Selected: b$database/bbr Query: b$query/b h3Results/h3 hr; if ($result == 0) echo(bError . mysql_errno() . : . mysql_error() . /b); elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned./bbr); else { echo table border='1' thead tr; for ($i = 0; $i mysql_num_fields($result); $i++) { echo(th . mysql_field_name($result,$i) . /th); } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i++) { echo tr; $row = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo(td . $row[$j] . /td); } echo /tr; } echo /tbody /table; } echo hrbr form action=$PHP_SELF method=post input type=hidden name=query value=\$query\ input type=hidden name=database value=$database input type=submit name=\queryButton\ value=\New Query\ input type=submit name=\queryButton\ value=\Edit Query\ /form; unset($form); exit(); } /* Section that requests user input of query */ @$query = stripSlashes($query); if (@$queryButton != Edit Query) { $database = ; $query = ; } ? form action=?php echo $PHP_SELF ??form=yes method=post table tr td align=rightbType in database name/b/td td input type=text name=database value=?php echo $database ? /td /tr tr td align=right valign=topbType in SQL query/b/td tdtextarea name=query cols=60 rows=10?php echo $query ?/textarea /td /tr tr td colspan=2 align=centerinput type=submit value=Submit Query/td /tr /table /form /body /html Any ideas would be greatly appreciated as I am floundering badly! Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
On Tuesday 01 July 2003 06:51, Daevid Vincent wrote: Additionally, you could put this in a header file or the top of your page: reset ($_GET); while (list ($key, $val) = each ($_GET)) { //echo $key = $valbr\n; $$key = $val; } reset ($_POST); while (list ($key, $val) = each ($_POST)) { //echo $key = $valbr\n; $$key = $val; } reset ($_SESSION); while (list ($key, $val) = each ($_SESSION)) { //echo $key = $valbr\n; $$key = $val; } So you can leave register_globals = off and get mostly the same functionality (and security issues if you're worried about them too). All that the above achieves is re-introduce the potential security problems of having register_globals = on (!) -- 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-general -- /* What passes for optimism is most often the effect of an intellectual error. -- Raymond Aron, The Opium of the Intellectuals */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms / Array Question...
on 28/06/03 4:20 AM, Noel Wade ([EMAIL PROTECTED]) wrote: Anyone know if this (A) works have you tried it? surely it couldn't take more than 10 seconds to find out eh? and (B) is not actually just some undefined behavior that's risky to use? it's quite common, although i believe the syntax is name='foo[1]' not name='$foo[1]'. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms / Array Question...
Hi All, Quickie Question... Possibly a silly one; but it would make my life easier if it works! I know that with a SELECT MULTIPLE, you have to use the convention: NAME=$varName[] to get all of the responses into a nice neat array. I'm wondering about the mechanism behind this - is it simply doing a behind-the-scenes $varName[] = X;, $varName[] = Y;, $varName[] = Z; operation to dynamically generate the array? (Note: this is not my main question - keep reading. :-P ) If so, then it would follow that it's also possible to do something like this: INPUT TYPE=TEXT NAME=$varArray[1] INPUT TYPE=TEXT NAME=$varArray[2] INPUT TYPE=TEXT NAME=$varArray[3] ... And get a nice array with your text values. Anyone know if this (A) works and (B) is not actually just some undefined behavior that's risky to use? Thanks! Take care, --Noel
Re: [PHP] Forms / Array Question...
(A) works YES (B) is not actually just some undefined behavior that's risky to use? It works fine for me. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms addslashes ?
Hi, I want to add slashes to a string, if it contains quotation marks and which is received as input from a form, so that I can enter it to a database. What I am doing is as follows: echo input type=\text\ name=\title\; $title=addslashes($title); But the string that gets added has a lot of slashes! How should this be done? Mukta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms addslashes ?
On Thu, 2003-06-19 at 05:27, Mukta Telang wrote: Hi, I want to add slashes to a string, if it contains quotation marks and which is received as input from a form, so that I can enter it to a database. What I am doing is as follows: echo input type=\text\ name=\title\; $title=addslashes($title); But the string that gets added has a lot of slashes! How should this be done? Mukta Do you mean that there are two slashes everywhere there should be one, or that they are inserted where you do not expect them? It's slashes doubling up on you, you may have magic_quotes_gpc enabled in php.ini. magic_quotes_gpc is explained here: http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc You can check whether it's turned on with: http://www.php.net/get_magic_quotes_gpc http://www.php.net/get_magic_quotes_runtime So if that's the case, you could either disable magic_quotes in php.ini, or else test whether it's turned on and then decide whether to call addslashes(). Torben -- Torben Wilson [EMAIL PROTECTED]+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms addslashes ?
On Thursday 19 June 2003 20:27, Mukta Telang wrote: I want to add slashes to a string, if it contains quotation marks and which is received as input from a form, so that I can enter it to a database. What I am doing is as follows: echo input type=\text\ name=\title\; $title=addslashes($title); But the string that gets added has a lot of slashes! What exactly do you mean by a lot of slashes ? How should this be done? Check in php.ini that: magic_quotes_gpc = Off -- 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-general -- /* Death is nature's way of saying `Howdy'. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms question -- simple
Hi all, I'm new to the list and to PHP. I haven't bought a book as of yet but I've found a number of resources that are getting me through the basics. I am collecting data from a form. I've having no problems collecting the data and printing it out. But... I have a form with check boxes with 4 options. See below. input type=checkbox value=Investment name=investment input type=checkbox value=Vacation Home name=vacation input type=checkbox value=Retirement Home name=retirement input type=checkbox value=Primary Home name=primary This form data is being sent off to a php page to get the values printed out. See below: ** print Which best describes your reason for wanting to purchase land?br; print $investmentbr $investment2br $investment3br $investment4br; ** The problem is if a check box is not checked a blank space gets printed out which I don't want. Can someone show me how to use an if then statement with the following stucture: *** if $investment not eqaul to a blank then print $investment *** I would use this structure for each of the variables in the checkboxes above. I'm sure this could be done with arrays in some form or another but since I'm new at this I would just as soon keep it simple for now and learn more sophisticated techniques later. Thanks so much, Greg Landry [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] forms question -- simple
I figured it out. Yipppee.. Thanks -Original Message- From: Gregory Landry [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 4:10 PM To: [EMAIL PROTECTED] Subject: [PHP] forms question -- simple Hi all, I'm new to the list and to PHP. I haven't bought a book as of yet but I've found a number of resources that are getting me through the basics. I am collecting data from a form. I've having no problems collecting the data and printing it out. But... I have a form with check boxes with 4 options. See below. input type=checkbox value=Investment name=investment input type=checkbox value=Vacation Home name=vacation input type=checkbox value=Retirement Home name=retirement input type=checkbox value=Primary Home name=primary This form data is being sent off to a php page to get the values printed out. See below: ** print Which best describes your reason for wanting to purchase land?br; print $investmentbr $investment2br $investment3br $investment4br; ** The problem is if a check box is not checked a blank space gets printed out which I don't want. Can someone show me how to use an if then statement with the following stucture: *** if $investment not eqaul to a blank then print $investment *** I would use this structure for each of the variables in the checkboxes above. I'm sure this could be done with arrays in some form or another but since I'm new at this I would just as soon keep it simple for now and learn more sophisticated techniques later. Thanks so much, Greg Landry [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Session variables
Guru Geek wrote: perhaps javascript? let me know if you need further help! JavaScript can be turned off. -- W | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. smime.p7s Description: S/MIME Cryptographic Signature
[PHP] Forms Session variables
I'm trying to build a multi-step form and using sessions to register the field values, but having serious issues. This is what I'd like to do: step 1 (first page): ask for name, address, email. [submit] step 2 (second page): ask for more personal information [submit] step 3 (last page): ask for specific event information [submit] send everything to a back end MySQL db, and redirect to a thank you page. This whole process is just one form.php file that posts to a process.php script. The content of form.php gets changed based on the step# (they get included step1.inc, step2.inc, and step3.inc.) However, after each [submit] I would like to verify the data prior to continuing to the next page. If any of the fields are missing or incorrect, we re-post the same page with the correct fields already filled in (based on whatever the user entered), and the missing one ... blank (obviously.) But, if everything is okay, and all fields check out, register the values and go on to the next page. Repeat the process. I'm having a heck of a time with the validation part. Either things don't register, or it gets stuck in a loop, regardless of what I change after the re-post. So, I need some help. I need some code...help! -- M | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] Forms Session variables
You need to slow down and think things through. My recommendation would be to get a SINGLE PAGE form to work how you want first, then assess the logic needed to move onto multiple forms. Also, this was asked a while back, so here was my answer sample code last time: http://marc.theaimsgroup.com/?l=php-generalm=104371796307302w=2 Justin on 11/03/03 4:45 PM, Ashley M. Kirchner ([EMAIL PROTECTED]) wrote: I'm trying to build a multi-step form and using sessions to register the field values, but having serious issues. This is what I'd like to do: step 1 (first page): ask for name, address, email. [submit] step 2 (second page): ask for more personal information [submit] step 3 (last page): ask for specific event information [submit] send everything to a back end MySQL db, and redirect to a thank you page. This whole process is just one form.php file that posts to a process.php script. The content of form.php gets changed based on the step# (they get included step1.inc, step2.inc, and step3.inc.) However, after each [submit] I would like to verify the data prior to continuing to the next page. If any of the fields are missing or incorrect, we re-post the same page with the correct fields already filled in (based on whatever the user entered), and the missing one ... blank (obviously.) But, if everything is okay, and all fields check out, register the values and go on to the next page. Repeat the process. I'm having a heck of a time with the validation part. Either things don't register, or it gets stuck in a loop, regardless of what I change after the re-post. So, I need some help. I need some code...help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms and MySql date
To avoid user error (remember, 90% of internet users are stupid and illogical and don't know anything), just have drop down menus for the dates and months and allow the user to enter in the year then just do: $mysqldate = $_POST[month].-.$_POST[date].-.$_POST[year]; -Original Message- From: Frank Keessen [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 1:21 AM To: Philip Hallstrom Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Forms and MySql date Hi, You can let the users enter a date as 20-02-2003 into a textfield with the name $userdate Then you can use this function to convert it; $date_array = split(-, $userdate); $mysqldate = $date_array[2].-.$date_array[1].-.$date_array[0]; Store $mysqldate into the database! Regards, Frank - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] To: Mike Tuller [EMAIL PROTECTED] Cc: php mailing list list [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 11:48 PM Subject: [PHP] Re: Forms and MySql date You could use the TO_DATE function to convert that text string into a date, or reformat it in PHP to -mm-dd which mysql will take automatically (at least I think so) On Thu, 20 Feb 2003, Mike Tuller wrote: I have a form that I want to enter a date into a MySql database. I currently have the column in the database set as Date, and can't seem to get the date I enter into the text field to go into the database using the format yymmdd. I could change the column to varchar, and then it would enter, but this will be a database that I want to keep track of purchases, and if it is entered in as text, I wouldn't be able to do calculations such as showing how old something is. How can I have a text field where a person enters the date and have that information entered into the database? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms and MySql date
I apologize the correct order is -MM-DD so you would do: $mysqldate = $_POST[year].-.$_POST[month].-.$_POST[date]; -Original Message- From: v0idnull [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 4:37 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Forms and MySql date To avoid user error (remember, 90% of internet users are stupid and illogical and don't know anything), just have drop down menus for the dates and months and allow the user to enter in the year then just do: $mysqldate = $_POST[month].-.$_POST[date].-.$_POST[year]; -Original Message- From: Frank Keessen [mailto:[EMAIL PROTECTED]] Sent: Friday, February 21, 2003 1:21 AM To: Philip Hallstrom Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Forms and MySql date Hi, You can let the users enter a date as 20-02-2003 into a textfield with the name $userdate Then you can use this function to convert it; $date_array = split(-, $userdate); $mysqldate = $date_array[2].-.$date_array[1].-.$date_array[0]; Store $mysqldate into the database! Regards, Frank - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] To: Mike Tuller [EMAIL PROTECTED] Cc: php mailing list list [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 11:48 PM Subject: [PHP] Re: Forms and MySql date You could use the TO_DATE function to convert that text string into a date, or reformat it in PHP to -mm-dd which mysql will take automatically (at least I think so) On Thu, 20 Feb 2003, Mike Tuller wrote: I have a form that I want to enter a date into a MySql database. I currently have the column in the database set as Date, and can't seem to get the date I enter into the text field to go into the database using the format yymmdd. I could change the column to varchar, and then it would enter, but this will be a database that I want to keep track of purchases, and if it is entered in as text, I wouldn't be able to do calculations such as showing how old something is. How can I have a text field where a person enters the date and have that information entered into the database? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms and MySql date
I have a form that I want to enter a date into a MySql database. I currently have the column in the database set as Date, and can't seem to get the date I enter into the text field to go into the database using the format yymmdd. I could change the column to varchar, and then it would enter, but this will be a database that I want to keep track of purchases, and if it is entered in as text, I wouldn't be able to do calculations such as showing how old something is. How can I have a text field where a person enters the date and have that information entered into the database? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and MySql date
mysql stores date as -mm-dd that is how the date should be entered into the form If entered in another format, you can reformat it. - Original Message - From: Mike Tuller [EMAIL PROTECTED] To: php mailing list list [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 4:43 PM Subject: [PHP] Forms and MySql date I have a form that I want to enter a date into a MySql database. I currently have the column in the database set as Date, and can't seem to get the date I enter into the text field to go into the database using the format yymmdd. I could change the column to varchar, and then it would enter, but this will be a database that I want to keep track of purchases, and if it is entered in as text, I wouldn't be able to do calculations such as showing how old something is. How can I have a text field where a person enters the date and have that information entered into the database? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and MySql date
Hi, You can let the users enter a date as 20-02-2003 into a textfield with the name $userdate Then you can use this function to convert it; $date_array = split(-, $userdate); $mysqldate = $date_array[2].-.$date_array[1].-.$date_array[0]; Store $mysqldate into the database! Regards, Frank - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] To: Mike Tuller [EMAIL PROTECTED] Cc: php mailing list list [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 11:48 PM Subject: [PHP] Re: Forms and MySql date You could use the TO_DATE function to convert that text string into a date, or reformat it in PHP to -mm-dd which mysql will take automatically (at least I think so) On Thu, 20 Feb 2003, Mike Tuller wrote: I have a form that I want to enter a date into a MySql database. I currently have the column in the database set as Date, and can't seem to get the date I enter into the text field to go into the database using the format yymmdd. I could change the column to varchar, and then it would enter, but this will be a database that I want to keep track of purchases, and if it is entered in as text, I wouldn't be able to do calculations such as showing how old something is. How can I have a text field where a person enters the date and have that information entered into the database? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Help (continued)
Globals are turned on - Original Message - From: Ray Hunter [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Sunday, February 16, 2003 12:15 AM Subject: Re: [PHP] Forms Help (continued) Do you have globals turned on or off? Ray On Sat, 2003-02-15 at 21:19, Beauford.2002 wrote: Has anyone seen or used this script? It looks fairly straight forward, but I can't get it to work. It is however, exactly what I need. Any help is appreciated. http://codewalkers.com/tutorials.php?show=28page=1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms Question
Hi, Im trying to figure out the best way to do the following. I need to have a series of forms that when the user finishes the first part of the form he is sent to another page where a second form is filled out, and then a third. Making the forms etc. is no problem, what I'm not sure of is how to keep the data from all forms so it can be displayed at the end. I don't want to have anything written to the users drive, or to the server - so this information would have to be kept in memory. Would an array work in this situation? Any ideas are appreciated. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms Question
Hey there, Maintaining state in a web application is always a difficult thing.. fortunatly, you use PHP, which makes it a bit easier. However, if you do not want anything written to the server or to the user's drive you are out of luck, simply because at very least you will need to have the user download your HTML which will be written to the hard drive for caching. There are a few ways of doing making this work: 1) Store the form values from the previous form stored in hidden form fields on each page of the form, such as the fields the user filled out on form1 will be stored as hidden form fields on form2, the fields from form1 and form2 will be stored in hidden fields on form3, etc.. This is not the cleanest way, but as far as crossplatforming goes, it's one of the best. 2) Use a cookie to store the form fields. YUCK! Cookies have many good applications, but they are usually disabled on the user's browser as they have been miss used in the past. of course, this goes against your rule of keeping things from being written on the user's harddrive. 3) Finally, you could use sessions. The cleanest way i would think to pass variables from one form to another is to create an object in PHP that contains the fields in the form as variables. Pass that object from form to form, adding the information the application recieves from the user into the object at each form submit. That way, all you have to do is to pass the sessionid from page to page. How do you do that you ask? 2 ways: 1) you could save it in a cookie (this is the default way of passing sessionids in PHP), 2) OR you can use a really cool thing PHP does and turn URL-rewriting on in the php.ini file. This will automatically rewrite all the urls you have on your page to append the ?SESSIONID=id at the end and include the sessionid as a hidden form field on all your pages. Cool, huh? yeah.. PHP kicks ass. =) If you need more help on how to do this, don't hesitate to ask. good luck! -Chris -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED]] Sent: Sat 2/15/2003 10:02 AM To: PHP General Cc: Subject: [PHP] Forms Question Hi, Im trying to figure out the best way to do the following. I need to have a series of forms that when the user finishes the first part of the form he is sent to another page where a second form is filled out, and then a third. Making the forms etc. is no problem, what I'm not sure of is how to keep the data from all forms so it can be displayed at the end. I don't want to have anything written to the users drive, or to the server - so this information would have to be kept in memory. Would an array work in this situation? Any ideas are appreciated. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Question
Yep, Definitely need help. I tried option 1, but for some reason the variables are not being passed - and this is messy and not really one I want to use. Option 3 sounds like the cleanest, but I am not 100% familiar with sessions - I have used this on another page with a counter so the counter doesn't get run up on every refresh, and I am sure this is similar, but I would need some further help on how to pass the information from one page to the next. Any help is appreciated.. - Original Message - From: Chris McCluskey [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Saturday, February 15, 2003 1:25 PM Subject: RE: [PHP] Forms Question Hey there, Maintaining state in a web application is always a difficult thing.. fortunatly, you use PHP, which makes it a bit easier. However, if you do not want anything written to the server or to the user's drive you are out of luck, simply because at very least you will need to have the user download your HTML which will be written to the hard drive for caching. There are a few ways of doing making this work: 1) Store the form values from the previous form stored in hidden form fields on each page of the form, such as the fields the user filled out on form1 will be stored as hidden form fields on form2, the fields from form1 and form2 will be stored in hidden fields on form3, etc.. This is not the cleanest way, but as far as crossplatforming goes, it's one of the best. 2) Use a cookie to store the form fields. YUCK! Cookies have many good applications, but they are usually disabled on the user's browser as they have been miss used in the past. of course, this goes against your rule of keeping things from being written on the user's harddrive. 3) Finally, you could use sessions. The cleanest way i would think to pass variables from one form to another is to create an object in PHP that contains the fields in the form as variables. Pass that object from form to form, adding the information the application recieves from the user into the object at each form submit. That way, all you have to do is to pass the sessionid from page to page. How do you do that you ask? 2 ways: 1) you could save it in a cookie (this is the default way of passing sessionids in PHP), 2) OR you can use a really cool thing PHP does and turn URL-rewriting on in the php.ini file. This will automatically rewrite all the urls you have on your page to append the ?SESSIONID=id at the end and include the sessionid as a hidden form field on all your pages. Cool, huh? yeah.. PHP kicks ass. =) If you need more help on how to do this, don't hesitate to ask. good luck! -Chris -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED]] Sent: Sat 2/15/2003 10:02 AM To: PHP General Cc: Subject: [PHP] Forms Question Hi, Im trying to figure out the best way to do the following. I need to have a series of forms that when the user finishes the first part of the form he is sent to another page where a second form is filled out, and then a third. Making the forms etc. is no problem, what I'm not sure of is how to keep the data from all forms so it can be displayed at the end. I don't want to have anything written to the users drive, or to the server - so this information would have to be kept in memory. Would an array work in this situation? Any ideas are appreciated. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms Help (continued)
Has anyone seen or used this script? It looks fairly straight forward, but I can't get it to work. It is however, exactly what I need. Any help is appreciated. http://codewalkers.com/tutorials.php?show=28page=1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Help (continued)
This one time, at band camp, Beauford.2002 [EMAIL PROTECTED] wrote: Has anyone seen or used this script? It looks fairly straight forward, but I can't get it to work. It is however, exactly what I need. Any help is appreciated. http://codewalkers.com/tutorials.php?show=28page=1 I never use anything from codewankers or sites like it. What is it you wish to do? Kevin -- __ (_ \ _) ) | / / _ ) / _ | / ___) / _ ) | | ( (/ / ( ( | |( (___ ( (/ / |_| \) \_||_| \) \) Kevin Waterson Port Macquarie, Australia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Help (continued)
Do you have globals turned on or off? Ray On Sat, 2003-02-15 at 21:19, Beauford.2002 wrote: Has anyone seen or used this script? It looks fairly straight forward, but I can't get it to work. It is however, exactly what I need. Any help is appreciated. http://codewalkers.com/tutorials.php?show=28page=1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Help (continued)
I wish to get this script to work. If you can help it would be appreciated, whether you personally like them or not. If it works, I don't care if it was coded by Bugs Bunny. TIA - Original Message - From: Kevin Waterson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 15, 2003 11:34 PM Subject: Re: [PHP] Forms Help (continued) This one time, at band camp, Beauford.2002 [EMAIL PROTECTED] wrote: Has anyone seen or used this script? It looks fairly straight forward, but I can't get it to work. It is however, exactly what I need. Any help is appreciated. http://codewalkers.com/tutorials.php?show=28page=1 I never use anything from codewankers or sites like it. What is it you wish to do? Kevin -- __ (_ \ _) ) | / / _ ) / _ | / ___) / _ ) | | ( (/ / ( ( | |( (___ ( (/ / |_| \) \_||_| \) \) Kevin Waterson Port Macquarie, Australia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms Help (continued)
This one time, at band camp, Beauford.2002 [EMAIL PROTECTED] wrote: I wish to get this script to work. If you can help it would be appreciated, whether you personally like them or not. If it works, I don't care if it was coded by Bugs Bunny. What is it you wish the script to do? Kevin -- __ (_ \ _) ) | / / _ ) / _ | / ___) / _ ) | | ( (/ / ( ( | |( (___ ( (/ / |_| \) \_||_| \) \) Kevin Waterson Port Macquarie, Australia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms
G'day All Just a quick question This is really a html more than a php question. Is it possible to have two buttons and have different actions for each button in the same form? Thanks CJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms
Do you mean like two SUBMIT buttons? Yes. - Original Message - From: cj [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 13, 2003 7:32 PM Subject: [PHP] forms G'day All Just a quick question This is really a html more than a php question. Is it possible to have two buttons and have different actions for each button in the same form? Thanks CJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] forms
yes but it's more of an HTML/JavaScript thing. use INPUT Type='BUTTON' to put a second button on your form. Then use the onClick method to assign an action to it. If you want it to submit your form then call document.formName.submit(); =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: cj [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 7:32 PM To: [EMAIL PROTECTED] Subject: [PHP] forms G'day All Just a quick question This is really a html more than a php question. Is it possible to have two buttons and have different actions for each button in the same form? Thanks CJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] forms
Would you know of any tutorial web sites which would explain how to do this? As I have not done any java programing before. -Original Message- From: Cal Evans [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 14 January 2003 12:43 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] forms yes but it's more of an HTML/JavaScript thing. use INPUT Type='BUTTON' to put a second button on your form. Then use the onClick method to assign an action to it. If you want it to submit your form then call document.formName.submit(); =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: cj [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 7:32 PM To: [EMAIL PROTECTED] Subject: [PHP] forms G'day All Just a quick question This is really a html more than a php question. Is it possible to have two buttons and have different actions for each button in the same form? Thanks CJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] forms
G'day CJ This is really a html more than a php question. Yep, it probably is... Is it possible to have two buttons and have different actions for each button in the same form? Yep, you can. form etc input type=submit name=first_submit_action value=do this input type=submit name=2nd_submit_action value=do that /form When you process your form in php you'll find that you have either $first_submit_action or $2nd_submit_action set to a value (well, if you have register global on anyway). So, you look for which one is set and act accordingly. Works for me... CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms
--- cj [EMAIL PROTECTED] wrote: Is it possible to have two buttons and have different actions for each button in the same form? No, because the action belongs to the form, not the submit buttons (which is why action is an attribute of form). However, you can use different names and values for the submit buttons, so that you can tell which was pressed on your receiving page. This way you can act accordingly, which is probably what you wanted to know. Hope that helps. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] forms
So, if I am understanding correctly The page that processes the form will have to work out which button got pressed? That should be easy enough to work out, I hope :-) -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 14 January 2003 2:21 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] forms --- cj [EMAIL PROTECTED] wrote: Is it possible to have two buttons and have different actions for each button in the same form? No, because the action belongs to the form, not the submit buttons (which is why action is an attribute of form). However, you can use different names and values for the submit buttons, so that you can tell which was pressed on your receiving page. This way you can act accordingly, which is probably what you wanted to know. Hope that helps. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] forms
--- cj [EMAIL PROTECTED] wrote: The page that processes the form will have to work out which button got pressed? Exactly. For starters, use this bit of HTML/PHP code to help you see what the browser sends you when the form is submitted (add this to the receiving page): pre ? print_r($_REQUEST); ? /pre Alternatively, you can choose to output $_GET or $_POST (instead of $_REQUEST) depending on which method you choose for your form. This will show you how to identify which button was pressed. Good luck. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms
in HTML form: FORM method=post action=myscript.php . . . INPUT type=submit name=submita value=Do This INPUT type=submit name=submitb value=Do That /FORM in myscript.php: if(ISSET($HTTP_POST_VARS['submita'])) { } if ISSET(($HTTP_POST_VARS['submitb'])) { } - Original Message - From: cj [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Php-List (E-mail) [EMAIL PROTECTED] Sent: Monday, January 13, 2003 9:30 PM Subject: RE: [PHP] forms So, if I am understanding correctly The page that processes the form will have to work out which button got pressed? That should be easy enough to work out, I hope :-) -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 14 January 2003 2:21 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] forms --- cj [EMAIL PROTECTED] wrote: Is it possible to have two buttons and have different actions for each button in the same form? No, because the action belongs to the form, not the submit buttons (which is why action is an attribute of form). However, you can use different names and values for the submit buttons, so that you can tell which was pressed on your receiving page. This way you can act accordingly, which is probably what you wanted to know. Hope that helps. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms
Thanks everyone for your help. I got it to work yay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms
On Tuesday 14 January 2003 09:53, cj wrote: Would you know of any tutorial web sites which would explain how to do this? google knows. As I have not done any java programing before. javascript != java -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Q: What's the difference between a duck and an elephant? A: You can't get down off an elephant. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms and sessions ?
hi I'm having some problems submitting forms while using sessions :o( I have a form, that will only display if the session vars exist and are not null or empty. I'm using this is the form handler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms
I'm having problems using variables from a html form. I've been reading, and it seems that I have register_globlas=off in php.ini. But I've tried to find this file in my Linux, but I haven't been able to locate it. Could someone tell me where is it? Thank you
Re: [PHP] Forms
How did you install php? RPM, from source? Check in /etc, or do a... find / -name php.ini as root. Vicente Valero wrote: I'm having problems using variables from a html form. I've been reading, and it seems that I have register_globlas=off in php.ini. But I've tried to find this file in my Linux, but I haven't been able to locate it. Could someone tell me where is it? Thank you -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
For my Linux (RedHat 7.1), it's at /etc/php.ini - Original Message - From: Vicente Valero [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 23, 2002 10:25 AM Subject: [PHP] Forms I'm having problems using variables from a html form. I've been reading, and it seems that I have register_globlas=off in php.ini. But I've tried to find this file in my Linux, but I haven't been able to locate it. Could someone tell me where is it? Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Rick Emery wrote: For my Linux (RedHat 7.1), it's at /etc/php.ini If its not there, check phpinfo(), this will specifiy where that particular installation of php requires it to be. HTH Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
On Monday 23 December 2002 17:30, John Nichel wrote: How did you install php? RPM, from source? Check in /etc, or do a... find / -name php.ini Or run a script ?php phpinfo(); ? and look what Configuration File (php.ini) Path tells you. On the output ob this comamnd you can see the settin of register_globals, too. johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
And remember that if you alter the php.ini file once you have found it, that you MUST restart apache in order for the changes to take place. Jason Reid [EMAIL PROTECTED] -- AC Host Canada www.achost.ca - Original Message - From: Johannes Schlueter [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 23, 2002 10:07 AM Subject: Re: [PHP] Forms On Monday 23 December 2002 17:30, John Nichel wrote: How did you install php? RPM, from source? Check in /etc, or do a... find / -name php.ini Or run a script ?php phpinfo(); ? and look what Configuration File (php.ini) Path tells you. On the output ob this comamnd you can see the settin of register_globals, too. johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
php.ini can be in several different locations, the best way to identify its location is to ask PHP where it is at (I have seen it in /usr/local/etc, /etc, /usr/local/lib, /usr/local/conf, among others). Construct a php file with phpinfo() like: ?php phpinfo(); ? Then visit the page in your browser, now look for: Configuration File (php.ini) Path section, it is in the top 1/5 of the page, this will give you the directory PHP is looking for php.ini at. You can also use filesystem utils such as locate php.ini or find / -name php.ini Jason On Mon, 2002-12-23 at 09:53, Rick Emery wrote: For my Linux (RedHat 7.1), it's at /etc/php.ini - Original Message - From: Vicente Valero [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 23, 2002 10:25 AM Subject: [PHP] Forms I'm having problems using variables from a html form. I've been reading, and it seems that I have register_globlas=off in php.ini. But I've tried to find this file in my Linux, but I haven't been able to locate it. Could someone tell me where is it? Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and PHP variables
On Sunday 22 December 2002 10:29, Beauford.2002 wrote: Hi, First off, thanks to all those that helped out with my other questions. Not all my problems were solved, but I'm certainly closer. Still working on the same project I need to do the following. I have a form where users input numbers only, is there a way I can have php check to make sure a letter or other character didn't get put in by accident. I was looking at ereg, but not to familiar with this or if it would work in this case. Try this: http://www.phpclasses.org/browse.html/package/914.html -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* So this is what it feels like to be potato salad */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and PHP variables
is_numeric() will work with variables just fine. So: if (is_numeric($var)) { print Yep, it's numeric; } else { print Nope, it sure isn't a number; } Make sure $var is defined. If it's coming from a form then use $_POST['var'] or similar instead for reasons described here: http://www.php.net/variables.external Regards, Philip Olson On Sat, 21 Dec 2002, Beauford.2002 wrote: Thanks for the info, but . is_numeric does not appear to accept variables i.e. is_numeric($num) and ctype gives me the following. Fatal error: Call to undefined function: ctype_digit() in /usr/local/apache/htdocs/.. on line 6 - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Saturday, December 21, 2002 9:50 PM Subject: Re: [PHP] Forms and PHP variables Use is_numeric() http://www.php.net/is_numeric See also the ctype functions which can be read about here: http://www.php.net/ctype And yes, regular expressions are another option but aren't needed here. Regards, Philip Olson On Sat, 21 Dec 2002, Beauford.2002 wrote: Hi, First off, thanks to all those that helped out with my other questions. Not all my problems were solved, but I'm certainly closer. Still working on the same project I need to do the following. I have a form where users input numbers only, is there a way I can have php check to make sure a letter or other character didn't get put in by accident. I was looking at ereg, but not to familiar with this or if it would work in this case. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms and PHP variables
Hi, First off, thanks to all those that helped out with my other questions. Not all my problems were solved, but I'm certainly closer. Still working on the same project I need to do the following. I have a form where users input numbers only, is there a way I can have php check to make sure a letter or other character didn't get put in by accident. I was looking at ereg, but not to familiar with this or if it would work in this case. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and PHP variables
Use is_numeric() http://www.php.net/is_numeric See also the ctype functions which can be read about here: http://www.php.net/ctype And yes, regular expressions are another option but aren't needed here. Regards, Philip Olson On Sat, 21 Dec 2002, Beauford.2002 wrote: Hi, First off, thanks to all those that helped out with my other questions. Not all my problems were solved, but I'm certainly closer. Still working on the same project I need to do the following. I have a form where users input numbers only, is there a way I can have php check to make sure a letter or other character didn't get put in by accident. I was looking at ereg, but not to familiar with this or if it would work in this case. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and PHP variables
Thanks for the info, but . is_numeric does not appear to accept variables i.e. is_numeric($num) and ctype gives me the following. Fatal error: Call to undefined function: ctype_digit() in /usr/local/apache/htdocs/.. on line 6 - Original Message - From: Philip Olson [EMAIL PROTECTED] To: Beauford.2002 [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Saturday, December 21, 2002 9:50 PM Subject: Re: [PHP] Forms and PHP variables Use is_numeric() http://www.php.net/is_numeric See also the ctype functions which can be read about here: http://www.php.net/ctype And yes, regular expressions are another option but aren't needed here. Regards, Philip Olson On Sat, 21 Dec 2002, Beauford.2002 wrote: Hi, First off, thanks to all those that helped out with my other questions. Not all my problems were solved, but I'm certainly closer. Still working on the same project I need to do the following. I have a form where users input numbers only, is there a way I can have php check to make sure a letter or other character didn't get put in by accident. I was looking at ereg, but not to familiar with this or if it would work in this case. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Hello, Chris Hewitt [EMAIL PROTECTED] wrote: [snip] GET or POST method (I'm not sure whether there is a default). [/snip] GET is the default... should be... I guess... - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Beauford.2002 wrote: --snip--- The problem is that the form is not sending the employee name to the php page. If I insert the name in the php page manually, it works fine, so the problem appears to be with the form. --snip-- PCENTERFORM NAME=Employees SELECT NAME=name OPTION SELECTED VALUE=/OPTION OPTION VALUE=John/OPTIONJohn OPTION VALUE=Mary/OPTIONMary /SELECT INPUT TYPE=submit VALUE=Submit Two suggestions. You do not specify whether your form should use GET or POST method (I'm not sure whether there is a default). The other is how you are accessing the variable name within php. If register_globals is on in php.ini then just $name is fine, but if its off then use $name = $_GET['name'] or $name = $_POST['name'] depending upon whether you specify GET or POST method. HTH Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
I think Keith hits this one on the head -- Without an ACTION directive in the FORM definition, you're at the mercy of the browser where it gets sent (if in fact it's sent anywhere) ... You might find some browsers work (defaulting to resubmit to the current page), whereas others will silently fail sending the page nowhere. Hank On Wed, Dec 11, 2002 at 04:36:39PM -0500, Beauford.2002 wrote: Hi, I'm sending this to both lists as I'm not sure where the problem is, but I believe it is an issue with my HTML form. Here's the problem: I have a drop-down menu form on my webpage with employee names in it. When I choose a name and click submit it gets passed to a php page which accesses a mysql database and displays information about that employee. The problem is that the form is not sending the employee name to the php page. If I insert the name in the php page manually, it works fine, so the problem appears to be with the form. Can someone help me out here - a sample of my code is below. I'm not sure how to explain this, but whatever gets sent to the PHP page has to be one variable - i.e. if I choose John, then the variable that gets sent to the PHP should have the value John, if I choose Mary, the value of the variable should be Mary. Hope this makes sense. TIA PCENTERFORM NAME=Employees SELECT NAME=name OPTION SELECTED VALUE=/OPTION OPTION VALUE=John/OPTIONJohn OPTION VALUE=Mary/OPTIONMary /SELECT INPUT TYPE=submit VALUE=Submit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Hank Marquardt [EMAIL PROTECTED] http://web.yerpso.net GPG Id: 2BB5E60C Fingerprint: D807 61BC FD18 370A AC1D 3EDF 2BF9 8A2D 2BB5 E60C *** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD *** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild *** See http://www.hwg.org/services/classes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms
Hi, I'm sending this to both lists as I'm not sure where the problem is, but I believe it is an issue with my HTML form. Here's the problem: I have a drop-down menu form on my webpage with employee names in it. When I choose a name and click submit it gets passed to a php page which accesses a mysql database and displays information about that employee. The problem is that the form is not sending the employee name to the php page. If I insert the name in the php page manually, it works fine, so the problem appears to be with the form. Can someone help me out here - a sample of my code is below. I'm not sure how to explain this, but whatever gets sent to the PHP page has to be one variable - i.e. if I choose John, then the variable that gets sent to the PHP should have the value John, if I choose Mary, the value of the variable should be Mary. Hope this makes sense. TIA PCENTERFORM NAME=Employees SELECT NAME=name OPTION SELECTED VALUE=/OPTION OPTION VALUE=John/OPTIONJohn OPTION VALUE=Mary/OPTIONMary /SELECT INPUT TYPE=submit VALUE=Submit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Have you tried echoing out the value on the resulting page, i.e. the page that parses the form? echo $_POST['name']; What does that give you? I don't see anything that really jumps out at me with your code. -Brad Beauford.2002 wrote: Hi, I'm sending this to both lists as I'm not sure where the problem is, but I believe it is an issue with my HTML form. Here's the problem: I have a drop-down menu form on my webpage with employee names in it. When I choose a name and click submit it gets passed to a php page which accesses a mysql database and displays information about that employee. The problem is that the form is not sending the employee name to the php page. If I insert the name in the php page manually, it works fine, so the problem appears to be with the form. Can someone help me out here - a sample of my code is below. I'm not sure how to explain this, but whatever gets sent to the PHP page has to be one variable - i.e. if I choose John, then the variable that gets sent to the PHP should have the value John, if I choose Mary, the value of the variable should be Mary. Hope this makes sense. TIA PCENTERFORM NAME=Employees SELECT NAME=name OPTION SELECTED VALUE=/OPTION OPTION VALUE=John/OPTIONJohn OPTION VALUE=Mary/OPTIONMary /SELECT INPUT TYPE=submit VALUE=Submit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
This HTML is invalid. Is it the same way in your script? OPTION VALUE=Mary/OPTIONMary Do instead. OPTION VALUE=MaryMary/OPTION -Kevin - Original Message - From: Beauford.2002 [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, December 11, 2002 2:36 PM Subject: [PHP] Forms Hi, I'm sending this to both lists as I'm not sure where the problem is, but I believe it is an issue with my HTML form. Here's the problem: I have a drop-down menu form on my webpage with employee names in it. When I choose a name and click submit it gets passed to a php page which accesses a mysql database and displays information about that employee. The problem is that the form is not sending the employee name to the php page. If I insert the name in the php page manually, it works fine, so the problem appears to be with the form. Can someone help me out here - a sample of my code is below. I'm not sure how to explain this, but whatever gets sent to the PHP page has to be one variable - i.e. if I choose John, then the variable that gets sent to the PHP should have the value John, if I choose Mary, the value of the variable should be Mary. Hope this makes sense. TIA PCENTERFORM NAME=Employees SELECT NAME=name OPTION SELECTED VALUE=/OPTION OPTION VALUE=John/OPTIONJohn OPTION VALUE=Mary/OPTIONMary /SELECT INPUT TYPE=submit VALUE=Submit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Change the html to: SELECT NAME=name OPTION SELECTED VALUE=/OPTION OPTION VALUE=JohnJohn/OPTION OPTION VALUE=MaryMary/OPTION /SELECT Beauford.2002 wrote: Hi, I'm sending this to both lists as I'm not sure where the problem is, but I believe it is an issue with my HTML form. Here's the problem: I have a drop-down menu form on my webpage with employee names in it. When I choose a name and click submit it gets passed to a php page which accesses a mysql database and displays information about that employee. The problem is that the form is not sending the employee name to the php page. If I insert the name in the php page manually, it works fine, so the problem appears to be with the form. Can someone help me out here - a sample of my code is below. I'm not sure how to explain this, but whatever gets sent to the PHP page has to be one variable - i.e. if I choose John, then the variable that gets sent to the PHP should have the value John, if I choose Mary, the value of the variable should be Mary. Hope this makes sense. TIA PCENTERFORM NAME=Employees SELECT NAME=name OPTION SELECTED VALUE=/OPTION OPTION VALUE=John/OPTIONJohn OPTION VALUE=Mary/OPTIONMary /SELECT INPUT TYPE=submit VALUE=Submit -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php, forms, mysql
Hello, I could use some help. I have two framed pages, upperframe.html and lowerframe.html. In upper frame.html: echo table border=1; echo trtd/tdtdID/tdtdSubject/tdtdOpen/tdtdClose/td/tr; while($row = MySQL_fetch_array($result)) { echo trtdforminput type=\checkbox\ method=\post\ name=\linia\/form/td; echo tda href=\\ target=\_parent\{$row['id']}/a/td; ?? echo td{$row['subject']}/td; echo td{$row['open']}/td; echo td{$row['close']}/td/tr; } echo /table; I display the content of the main table, which has an autoincrement index. For every index I have another table, something like tableID. What I want is to press on the id from a row in upperframe table and to display in lowerframe the tableID. How can I do that? Thanks a lot, Adrian
Re: [PHP] php, forms, mysql
You don't need to use forms (which you got wrong), but simple links with target=lowerframe and href=lowerframe.php?tableID=$tableID, then you get in your lowerframe.php $_GET['tableID'] Adrian Partenie wrote: Hello, I could use some help. I have two framed pages, upperframe.html and lowerframe.html. In upper frame.html: echo table border=1; echo trtd/tdtdID/tdtdSubject/tdtdOpen/tdtdClose/td/tr; while($row = MySQL_fetch_array($result)) { echo trtdforminput type=\checkbox\ method=\post\ name=\linia\/form/td; echo tda href=\\ target=\_parent\{$row['id']}/a/td; ?? echo td{$row['subject']}/td; echo td{$row['open']}/td; echo td{$row['close']}/td/tr; } echo /table; I display the content of the main table, which has an autoincrement index. For every index I have another table, something like tableID. What I want is to press on the id from a row in upperframe table and to display in lowerframe the tableID. How can I do that? Thanks a lot, Adrian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms and Sessions not working
Hi all: Im new to php and i have an isue. php4.2.3 windows 2000 advanced server I create a simple form page that posts back to its self and im unable to retreive the posted form data to display on the page. it seems like all my GLOBAL amd SESSION stuff isnt working. sample code: form name=form method=post action=thispage.php Your Namebr input type=text name=Name value=?PHP $Name ?br input type=submit name=Submit value=Submit /form Im thinking that it may be a setting in the php.ini file but i dont know.. Please help. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms and Sessions not working
On Saturday 16 November 2002 15:11, Chris Jackson wrote: Hi all: Im new to php and i have an isue. php4.2.3 windows 2000 advanced server I create a simple form page that posts back to its self and im unable to retreive the posted form data to display on the page. it seems like all my GLOBAL amd SESSION stuff isnt working. sample code: form name=form method=post action=thispage.php Your Namebr input type=text name=Name value=?PHP $Name ?br ?PHP $Name ? doesn't acutally do anything (that you can see), you need ?php echo $Name ? And if you still don't see anything then ... Im thinking that it may be a setting in the php.ini file but i dont know.. ... enable register_globals in php.ini. But before you do, READ the notes in php.ini AND also the manual about register globals. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The proof of the pudding is in the eating. -- Miguel de Cervantes */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms issues..
I am having difficulty managing forms. for example I have a table builder class which builds me a table of a query with all the bells and whistles to make it editable etc. so it creates it's own form to build itself on, then I have a dateselector class which builds a nice little graphic date selector, this also uses it's own form as it is not always in a table - it can be anywhere - as far as I know you can't have a form in a form so I am cheating a bit at the moment and only creating the dateselector after the table on a div then moving it into place.. This is working for me, but being a relative newbie I am sure there is a better way to handling forms. Any ideas, comments appreciated. Thanks _ Simon Taylor AfriTol (Pty) Ltd. ? [EMAIL PROTECTED] Å+27 12 361 3303 ext 257 Å+27 72 471 1833 Æ+27 12 365 3810 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms: How-to not display it if user hits back?
I have the following scenario 1- user comes to page A, clicks a button to get to page B 2- Page B is a form the user fills and hits the submit button 3- form data is received and I use header() to send him back to page A So A - B - A The problem I have is with Netscape 7, possibly other browsers too. If the user clicks the back button at stage 3, an annoying warning pops up: The page you are trying to view contains POST data that has expired from the cache . Is the anyway for me to code around this in PHP. Preferably the user would get sent back to A and not B. But if this is not possible can I do something so the warring does not pop up? Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms: How-to not display it if user hits back?
Use GET instead of POST. Other than that, I don't think so. It's a client side issue and all browsers handle it differently, I think. ---John Holmes... -Original Message- From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 29, 2002 1:24 PM To: [EMAIL PROTECTED] Subject: [PHP] Forms: How-to not display it if user hits back? I have the following scenario 1- user comes to page A, clicks a button to get to page B 2- Page B is a form the user fills and hits the submit button 3- form data is received and I use header() to send him back to page A So A - B - A The problem I have is with Netscape 7, possibly other browsers too. If the user clicks the back button at stage 3, an annoying warning pops up: The page you are trying to view contains POST data that has expired from the cache . Is the anyway for me to code around this in PHP. Preferably the user would get sent back to A and not B. But if this is not possible can I do something so the warring does not pop up? Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms and sessions
Hi, How can I keep values in a from when using session_start() and later, the Back Button on my Browser after posting via POST? Thanks, Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms problem?
I have a php script that queries a mysql db and build a form on a page for each row returned. Each form has four fields and a thumbnail of a JPEG. Below the image is a link to view the full image in a new window by using a javascript function. (No javascript jibes before I go any further, it was the only way I knew how). When I enter a query and say 10 records are returned (10 forms are created with the same name), the data and appropriate thumbnails are displayed correctly. When I click on the link the full image is only displayed for the first six links. After this clicking on the link has no effect. In the example above, the first five images were the same and the last five were also the same. I should also mention that when I load this page, I get an IE error 'unterminated string constant' but the page does load correctly. I have checked my code for closing quotes etc but they seem OK. Is there a max number of forms that can be created on a page or do I have to name them all different or is there some other explanation as to why the images won't display. Any ideas would be helpful and I can post more code if required. The call to the function is: echo td width='200' colspan='2' align='center' class=labelsa href='javascript:void(0)' onclick='ViewFullImage(\$img_code\)'View full size/a/td; The function is: function ViewFullImage(strCode) { msg=window.open(,msg,height=400,width=750,left=20,top=80,scrollbars=yes ,resizable=yes); msg.document.write(htmltitleDecoration Image/title); msg.document.write(body bgcolor='white' onblur=window.close()); msg.document.write(centerimg src=images/ + strCode + .jpg align=center valign=center/center); msg.document.write(/body/htmlp); } This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms problem?
On Wednesday 17 July 2002 19:17, Mark Colvin wrote: Misleading subject. Nothing to do with php or forms. [snip] mention that when I load this page, I get an IE error 'unterminated string constant' but the page does load correctly. Obviously there is a problem. What does 'load correctly' mean? My guess is that $img_code contains a space? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Veni, vidi, vici. [I came, I saw, I conquered]. -- Gaius Julius Caesar */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms not passing variables
Hello all. I have a site that was backed up, before the box was reformatted and rebuilt. Apache and PHP were upgraded. I have since resored all of the files and DB's that make up my site. Now, in doing some testing, the html forms are not passing variables to the next page. Specifically, these variables are the databse name, and the infor to be insereted into that database. My site uses frames, and it trying to pass the information from a form on one static page (menu) to the main window to display results. This used to work before I got the bright idea to upgrade. I have tried setting register_globals=on to see if that might help, but it had no effect. Has anyone else had, or is currently having issues like these? If you think you have any answer, please let me know. I will just about try anything to make this work again. Thanks, RC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms not passing variables
I am sure this is the n00b thing think, but you do have it as $_POST[var] for the variables right, assuming you had the other style before. also I had problems without POST being capitalized in the form section. J Hopp3r [EMAIL PROTECTED] 07/10/2002 12:23 PM To: [EMAIL PROTECTED] cc: Subject:[PHP] Forms not passing variables Hello all. I have a site that was backed up, before the box was reformatted and rebuilt. Apache and PHP were upgraded. I have since resored all of the files and DB's that make up my site. Now, in doing some testing, the html forms are not passing variables to the next page. Specifically, these variables are the databse name, and the infor to be insereted into that database. My site uses frames, and it trying to pass the information from a form on one static page (menu) to the main window to display results. This used to work before I got the bright idea to upgrade. I have tried setting register_globals=on to see if that might help, but it had no effect. Has anyone else had, or is currently having issues like these? If you think you have any answer, please let me know. I will just about try anything to make this work again. Thanks, RC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms and files
Hi, I have a form kinda like this: form action=$PHP_SELF?option=Massaction=add method=POST enctype=multipart/form-data input type=file name=passcodeFile the rest of the form is there too. And $PHP_SELF is set to $PHP_SELF = $_SERVER[PHP_SELF] at the top of the page. When I select a passcodeFile file to upload and click the upload button, I am presented with this on the next page: You need to specify a file to use. Here's what I did: if ($_POST[passcodeFile] == ) { print You need to specify a file to use.; } Any ideas why it does that even if I do select a file? Thanks, tyler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms and files
On Tuesday 02 July 2002 23:34, Tyler Longren wrote: Hi, I have a form kinda like this: form action=$PHP_SELF?option=Massaction=add method=POST enctype=multipart/form-data input type=file name=passcodeFile You really should use around your tag values. What you have is invalid HTML. the rest of the form is there too. And $PHP_SELF is set to $PHP_SELF = $_SERVER[PHP_SELF] at the top of the page. When I select a passcodeFile file to upload and click the upload button, I am presented with this on the next page: You need to specify a file to use. Here's what I did: if ($_POST[passcodeFile] == ) { print You need to specify a file to use.; } Any ideas why it does that even if I do select a file? 1) print_r($_POST) to see what you have, while you're at it, do the same for $_FILES. 2) Use the example(s) in the manual, once you have them working modify to suit. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Nature always sides with the hidden flaw. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms and files
On Tue, 2 Jul 2002 23:45:56 +0800 Jason Wong [EMAIL PROTECTED] wrote: On Tuesday 02 July 2002 23:34, Tyler Longren wrote: Hi, I have a form kinda like this: form action=$PHP_SELF?option=Massaction=add method=POST enctype=multipart/form-data input type=file name=passcodeFile You really should use around your tag values. What you have is invalid HTML. the rest of the form is there too. And $PHP_SELF is set to $PHP_SELF =$_SERVER[PHP_SELF] at the top of the page. When I select a passcodeFile file to upload and click the upload button, I am presented with this on the next page: You need to specify a file to use. Here's what I did: if ($_POST[passcodeFile] == ) { print You need to specify a file to use.; } Any ideas why it does that even if I do select a file? 1) print_r($_POST) to see what you have, while you're at it, do the same for $_FILES. 2) Use the example(s) in the manual, once you have them working modify to suit. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Nature always sides with the hidden flaw. */ that worked. I had to use _FILES instead of _POST I still get these errors though: Warning: fopen(, r) - Success in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 151 Warning: stat failed for (errno=2 - No such file or directory) in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 151 Warning: fread(): supplied argument is not a valid File-Handle resource in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 151 And here's the line that produces them: $data = fread(fopen($_FILES[passcodeFile_name], r), filesize($_FILES[passcodeFile])); any ideas on that one? This is the problem I have been working on for a few days now. Thanks, Tyler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms and files
On Tuesday 02 July 2002 23:54, Tyler Longren wrote: that worked. I had to use _FILES instead of _POST I still get these errors though: Warning: fopen(, r) - Success in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 151 Warning: stat failed for (errno=2 - No such file or directory) in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 151 Warning: fread(): supplied argument is not a valid File-Handle resource in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 151 And here's the line that produces them: $data = fread(fopen($_FILES[passcodeFile_name], r), filesize($_FILES[passcodeFile])); any ideas on that one? This is the problem I have been working on for a few days now. My understanding of the file upload process is that the uploaded file get written to a tmp directory under a tmp filename. It is your responsibility to match this tmp filename with the real filename and copy it somewhere (or do something with it) because as soon as the script ends the tmp files will be deleted. Please, do yourself a favour -- study the examples in the manual and save yourself a few more days of grief :) -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Would the last person to leave Michigan please turn out the lights? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms question
Hi I'm busy with an order form in php. How would I display a text field only if a checkbox is checked. The reason for this is that if the user selects the product in the form and, how would I get to display the quantity field corresponding to that checkbox Any help would be appreciated. Thanks Mohamed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms question
If you want to do it from PHP, then the forms will have to be seperate (PHP is server side...) You assign a value to a checkbox, then in the page you submit to, use something like if ( $_POST[$checkbox_name] == checked_value ) { ... } On Tuesday 25 June 2002 10:30 am, M.E. Suliman wrote: Hi I'm busy with an order form in php. How would I display a text field only if a checkbox is checked. The reason for this is that if the user selects the product in the form and, how would I get to display the quantity field corresponding to that checkbox Any help would be appreciated. Thanks Mohamed -- To Believe without evidence and demonstration is an act of ignorance and folly. Volney -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms question
I'm busy with an order form in php. How would I display a text field only if a checkbox is checked. The reason for this is that if the user selects the product in the form and, how would I get to display the quantity field corresponding to that checkbox if(isset($_REQUEST['checkbox_name'])) { echo textareaData/textarea; } etc... Adapt to your needs. remember that PHP runs on the server, so what you want to happen won't work unless the form is submitted in between. i.e. check the checkbox, submit the form, now it shows/doesn't show a text area depending on the whether the checkbox was checked or not. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] forms question
I do what you're asking with Javascript. Lookup dynamic forms and you'll find a lot of examples. On Tuesday 25 June 2002 10:30 am, M.E. Suliman wrote: I'm busy with an order form in php. How would I display a text field only if a checkbox is checked. The reason for this is that if the user selects the product in the form and, how would I get to display the quantity field corresponding to that checkbox This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms question
That would be the best idea, but he *is* asking on a PHP list... That's why i reminded him that PHP is server-side. On Tuesday 25 June 2002 13:02 pm, Lazor, Ed wrote: I do what you're asking with Javascript. Lookup dynamic forms and you'll find a lot of examples. On Tuesday 25 June 2002 10:30 am, M.E. Suliman wrote: I'm busy with an order form in php. How would I display a text field only if a checkbox is checked. The reason for this is that if the user selects the product in the form and, how would I get to display the quantity field corresponding to that checkbox *** * This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much. -- God is a comedian playing to an audience too afraid to laugh. Voltaire -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms into database and visa versa
***_PLEASE CC me as I am on digest_*** Anyone have a link or links to how to definitively make safe inserts to databases with form information? I'm thinking this has to do with add/remove slashes. BUT, I also think that it might be a good idea to write a function that adds slashes to all SQL words, (and make its converse function as well) Maybe a pointer to all the possible exploits would be a way to learn what to do to avoid them? :-) -- If You want to buy computer parts, see the reviews at: http://www.cnet.com/ **OR EVEN BETTER COMPILATIONS**!! http://sysopt.earthweb.com/userreviews/products/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms into database and visa versa
depending on your needs you could just create a .csv file (comma seperated text) that excel can read easily - Original Message - From: Dennis Gearon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 17, 2002 11:13 AM Subject: [PHP] forms into database and visa versa ***_PLEASE CC me as I am on digest_*** Anyone have a link or links to how to definitively make safe inserts to databases with form information? I'm thinking this has to do with add/remove slashes. BUT, I also think that it might be a good idea to write a function that adds slashes to all SQL words, (and make its converse function as well) Maybe a pointer to all the possible exploits would be a way to learn what to do to avoid them? :-) -- If You want to buy computer parts, see the reviews at: http://www.cnet.com/ **OR EVEN BETTER COMPILATIONS**!! http://sysopt.earthweb.com/userreviews/products/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forms into database and visa versa
Anyone have a link or links to how to definitively make safe inserts to databases with form information? It's a good idea to validate all data you're sticking in before you do. For example, if you have a numeric field, you don't want the person to be able to submit letters in that field. So, always check that the data is formatted the way you want it to be before sending it to the database. I usually use preg_replace() to remove undesireable characters. If you want text to go into a field and want people to be able to have quotes and other such items in there, then use addslashes(). --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing variables between php forms
Hi sorry to annoy you AGAIN, but i cant seem to get it working i think its something to do with the order that i put things in: #end of html and start of php script ?php #Take the Variables from enterdetails.php that are posted from an html form $firstname=$_POST['txtFirstName']; $lastname=$_POST['txtLastName']; $email=$_POST['txtEmail']; $quantity=$_POST['txtJars']; $order_value=sprintf('%.2f', floatval($_POST['txtJars'])*7.0); echo 'INPUT type=hidden name=testvar value='.$order_value.' /'; ?php # end of php script back into html Are your details correct? tr td valign=top colspan=3 align=centerform action=confirm.php method=postinput type=Submit name=submit value=Yes/form/td /tr tr td valign=top colspan=3 align=centerform action=updateaddress.php method=postinput type=submit value=Nonbsp;/form/td /tr /font If i put the echo or INPUT type outside of the php script this works, but obviously just returns a string '.$quantity.' and not waht the variable $quantity holds. This is extremely confusing. How do i get this php variable to be passed to the HTML so it can be posted I thought the way i have it the echo would make the variable testvar available to the browser, and then i would be able to retrieve it by $_POST[testvar]; or $_POST[$testvar]; in either the confirm.php or updateaddress.php that the html posts to? Yet again thanks in advance for any help. Confused Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables between php forms
What exactly goes wrong? Indeed, you _should_ have $_POST[testvar] available in the next page... The only problem I see is that you first echo the input and only then do you start the forms... which is an HTML problem, not a PHP one. Bogdan baldey_uk wrote: Hi sorry to annoy you AGAIN, but i cant seem to get it working i think its something to do with the order that i put things in: #end of html and start of php script ?php #Take the Variables from enterdetails.php that are posted from an html form $firstname=$_POST['txtFirstName']; $lastname=$_POST['txtLastName']; $email=$_POST['txtEmail']; $quantity=$_POST['txtJars']; $order_value=sprintf('%.2f', floatval($_POST['txtJars'])*7.0); echo 'INPUT type=hidden name=testvar value='.$order_value.' /'; ?php # end of php script back into html Are your details correct? tr td valign=top colspan=3 align=centerform action=confirm.php method=postinput type=Submit name=submit value=Yes/form/td /tr tr td valign=top colspan=3 align=centerform action=updateaddress.php method=postinput type=submit value=Nonbsp;/form/td /tr /font If i put the echo or INPUT type outside of the php script this works, but obviously just returns a string '.$quantity.' and not waht the variable $quantity holds. This is extremely confusing. How do i get this php variable to be passed to the HTML so it can be posted I thought the way i have it the echo would make the variable testvar available to the browser, and then i would be able to retrieve it by $_POST[testvar]; or $_POST[$testvar]; in either the confirm.php or updateaddress.php that the html posts to? Yet again thanks in advance for any help. Confused Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables between php forms
On Friday 10 May 2002 07:41, baldey_uk wrote: Hi sorry to annoy you AGAIN, but i cant seem to get it working i think its something to do with the order that i put things in: #end of html and start of php script ?php #Take the Variables from enterdetails.php that are posted from an html form $firstname=$_POST['txtFirstName']; $lastname=$_POST['txtLastName']; $email=$_POST['txtEmail']; $quantity=$_POST['txtJars']; $order_value=sprintf('%.2f', floatval($_POST['txtJars'])*7.0); echo 'INPUT type=hidden name=testvar value='.$order_value.' /'; ?php # end of php script back into html Are your details correct? tr td valign=top colspan=3 align=centerform action=confirm.php method=postinput type=Submit name=submit value=Yes/form/td /tr tr td valign=top colspan=3 align=centerform action=updateaddress.php method=postinput type=submit value=Nonbsp;/form/td /tr /font If i put the echo or INPUT type outside of the php script this works, but obviously just returns a string '.$quantity.' and not waht the variable $quantity holds. This is extremely confusing. How do i get this php variable to be passed to the HTML so it can be posted I thought the way i have it the echo would make the variable testvar available to the browser, and then i would be able to retrieve it by $_POST[testvar]; or $_POST[$testvar]; in either the confirm.php or updateaddress.php that the html posts to? Your form element is outside the form so is invalid and ignored by the browser. What you need is something like: tr td valign=top colspan=3 align=centerform action=confirm.php method=postinput type=Submit name=submit value=Yes INPUT type=hidden name=testvar value=? echo $order_value; ? / /form/td /tr And similarly for the second form. But I hope you're only doing this as a test. If you're implementing some kind on online shopping thing then including the value of goods ordered on a form and relying on that value when someone posts the form is a VERY BAD thing. When the form is posted you should always re-calculate the value based on item and quantity. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Every country has the government it deserves. -- Joseph De Maistre */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms
I created a simple html form with only one textbox a submit button as follows: form method=post action=form1.php input type=text name=fname input type=submit value=SUBMIT /form This is form1.php html body Hi ?php echo $fname; ? /body /html But I don't know why I am not getting the output. I am just getting the following error: Notice: Undefined variable: fame in d:\inetpub\wwwroot\php\Form1.php on line 3 In order to pass the Form values to a PHP page, I went through 3-4 tutorials on the web all showed this way only to collect the form values as what I have done but still I am getting the error. It's damn frustrating when even after just copying pasting the code from the tutorial then running it I get an error. I even tried the above using print($fname) but without any luck. But if I include the following line in the PHP code before the above PHP line ?php $fname=Arpan; ? the code gets executed perfectly !!! Thanks, Arpan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
On Tuesday 30 April 2002 01:25, Arpan De wrote: But I don't know why I am not getting the output. I am just getting the following error: Notice: Undefined variable: fame in d:\inetpub\wwwroot\php\Form1.php on line 3 In order to pass the Form values to a PHP page, I went through 3-4 tutorials on the web all showed this way only to collect the form values as what I have done but still I am getting the error. It's damn frustrating when even after just copying pasting the code from the tutorial then running it I get an error. I even tried the above using print($fname) but without any luck. But if I include the following line in the PHP code before the above PHP line You're probably using a newer of php (4.1.X) in which the default behaviour of many aspects of php had changed. So if you're using php 4.1.X then you need to reference $fname as: $_POST['fname'] Or if you had use the GET method in your form then: $_GET['fname'] -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Just because the message may never be received does not mean it is not worth sending. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php