[PHP] forms and php

2008-01-24 Thread Mark Pashia
I am fairly new to the php/mySQL combo and just noticed an unusual behavior
and don't know where to find the answer to fix this. It is probably common
knowledge, but not to a newbie.

 

If I fill in the fields of a form and hit the enter key to submit the
form, no variables seem to be passed along. If I use the submit button,
everything works perfectly. It seems that other forms on the web work with
the enter key just fine, so I am probably doing something to cause this yet
I don't know what.

 

I am hosted at hostgator.com and it has php version 4.4.4 and mySQL version
4.1.22-standard.

 

Thanks, Mark Pashia



Re: [PHP] forms and php

2008-01-24 Thread Jochem Maas

Mark Pashia schreef:

I am fairly new to the php/mySQL combo and just noticed an unusual behavior
and don't know where to find the answer to fix this. It is probably common
knowledge, but not to a newbie.

 


If I fill in the fields of a form and hit the enter key to submit the
form, no variables seem to be passed along. If I use the submit button,
everything works perfectly. It seems that other forms on the web work with
the enter key just fine, so I am probably doing something to cause this yet
I don't know what.


seem?

try the following line at the top of your submit script to see what is posted:

var_dump($_GET, $_POST);



 


I am hosted at hostgator.com and it has php version 4.4.4 and mySQL version
4.1.22-standard.

 


Thanks, Mark Pashia




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



Re: [PHP] forms and php

2008-01-24 Thread Nathan Nobbe
On Jan 24, 2008 3:34 AM, Mark Pashia [EMAIL PROTECTED] wrote:

 If I fill in the fields of a form and hit the enter key to submit the
 form, no variables seem to be passed along. If I use the submit button,
 everything works perfectly. It seems that other forms on the web work with
 the enter key just fine, so I am probably doing something to cause this
 yet
 I don't know what.


what does the html look like?
i did a quick little experiment
http://nathan.moxune.com/exampleForm.php
and found if the type attribute of the input tag,
used for the submission button, was 'submit',
the enter key would not submit the form.  however,
if the value of the type attribute was 'button', pressing
the enter button would submit the form.

-nathan


Re: [PHP] forms and php

2008-01-24 Thread Richard Lynch
Some older browsers didn't send along the button name/value when you
hit enter, for a one-button form...

But I've never heard of one that failed to send anything at all...

It's almost for sure a browser issue though -- PHP doesn't really *do*
anything with the data it gets.

It just stuffs it into $_POST / $_GET

Ah.

Did you remember to use method=post in your FORM tag?... :-)

On Thu, January 24, 2008 2:34 am, Mark Pashia wrote:
 I am fairly new to the php/mySQL combo and just noticed an unusual
 behavior
 and don't know where to find the answer to fix this. It is probably
 common
 knowledge, but not to a newbie.



 If I fill in the fields of a form and hit the enter key to submit
 the
 form, no variables seem to be passed along. If I use the submit
 button,
 everything works perfectly. It seems that other forms on the web work
 with
 the enter key just fine, so I am probably doing something to cause
 this yet
 I don't know what.



 I am hosted at hostgator.com and it has php version 4.4.4 and mySQL
 version
 4.1.22-standard.



 Thanks, Mark Pashia




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Forms on PHP

2005-01-11 Thread Leon Poon
Refer to the following line numbers:
01  ?php
02  // Start of PHP code - Extract values from form.
03  /* Other values read */
04  $n=$_POST['n'];
05 
06  // Pass the data from the form to lightcurve_csharp
07  $command=./lightcurve_csharp $a $i $e $lomega $bomega $lambda $n;
08  $result=`$command`;
09 
10  $form_submitted=$_POST['form_sumbitted'];
11  if (isset($form_submitted)) {
12 if ($form_submitted) {
13 echo 'The form has been submittedbr';
14 unset($form_submitted);
15 }
16  } else
17 echo 'The form has not been submittedbr';
When the user first load the page, no data was posted. So there was no 
$_POST['form_sumbitted'] available. Line 10 will cause $form_submitted to 
contain the NULL value (I think). $form_submitted will evaluate to FALSE at 
line 12. Thus it will not display any message.

By the way, by doing line 10, $form_submitted would have been set regardless 
whether there is $_POST['form_sumbitted'], and line 11 will evaluate to TRUE 
always. Thus you will never ever see the 'form not been submitted' message.

Anyway, when you posted for the first time, $_POST['form_sumbitted'] is 
available. The 'The form has been submittedbr' message will be printed. 
After that, when you press Reload button on the browser, the post data will 
once again be sent from the user. (This is the behaviour of reloading a 
posted page. In Internet Explorer there should be a message dialog box 
asking the user whether to resend form data in order to refresh.) Reposting 
the data during the reload means that there will be 
$_POST['form_sumbitted'], thus once again the 'form hass been submitted' 
message.

In order to prevent this from happening, you should do a header('Location: 
success-page.php') on a successful submit. This is so that at the redirected 
page, the user would not have resent data even if he press the Reload 
button.

Hope this helps

-Leon 

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


Re: [PHP] Forms on PHP

2005-01-11 Thread Richard Lynch
PHPDiscuss - PHP Newsgroups and mailing lists wrote:
 I am new to this or any newsgroup in PHP, as well as PHP itself, so this
 question is probably rather elementary.  I have a form which on clicking
 on the Submit button calls up a compiled program on the server that is
 executed and writes output to a file.  This file is then read by the PHP
 script and passed on for other processes.

Yikes!

What if two guys surf to the same page AT THE SAME TIME?

Is this all being taken care of?

Or is this an admin page that only one guy ever uses, and he *KNOWS* not
to run it in two different browsers at the same time?  And you'll *NEVER*
try to run it for testing while he's trying to run it for real?  And...

This scenario is rife with potential problems.

 When the page is first loaded,
 it knows that the Submit button has not been clicked, and after clicking
 the button it knows, which is of course what we want.  The problem is that
 subsequently it always thinks the button has been clicked, even if the
 reload button on the browser has been clicked.

When I hit re-load, you get back *exactly* the same thing I sent you last
time.

$_POST and everything.

If you want to do something *different* then you need to keep a record of
the fact that I already POSTed this data.

For example, you could embed a http://php.net/uniqid in your FORM in a
HIDDEN INPUT, and then store that in a database, and if I POST again, you
can do whatever you want.

Don't call that external program, and just read the file from the previous
action but with an added notification that I'm reading old data, or send
me a different output, or ...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Forms on PHP

2005-01-11 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Leon Poon wrote:

 Refer to the following line numbers:

 01  ?php
 02  // Start of PHP code - Extract values from form.
 03  /* Other values read */
 04  $n=$_POST['n'];
 05 
 06  // Pass the data from the form to lightcurve_csharp
 07  $command=./lightcurve_csharp $a $i $e $lomega $bomega $lambda $n;
 08  $result=`$command`;
 09 
 10  $form_submitted=$_POST['form_sumbitted'];
 11  if (isset($form_submitted)) {
 12 if ($form_submitted) {
 13 echo 'The form has been submittedbr';
 14 unset($form_submitted);
 15 }
 16  } else
 17 echo 'The form has not been submittedbr';

 When the user first load the page, no data was posted. So there was no 
 $_POST['form_sumbitted'] available. Line 10 will cause $form_submitted to 
 contain the NULL value (I think). $form_submitted will evaluate to FALSE at 
 line 12. Thus it will not display any message.

 By the way, by doing line 10, $form_submitted would have been set regardless 
 whether there is $_POST['form_sumbitted'], and line 11 will evaluate to TRUE 
 always. Thus you will never ever see the 'form not been submitted' message.

 Anyway, when you posted for the first time, $_POST['form_sumbitted'] is 
 available. The 'The form has been submittedbr' message will be printed. 
 After that, when you press Reload button on the browser, the post data will 
 once again be sent from the user. (This is the behaviour of reloading a 
 posted page. In Internet Explorer there should be a message dialog box 
 asking the user whether to resend form data in order to refresh.) Reposting 
 the data during the reload means that there will be 
 $_POST['form_sumbitted'], thus once again the 'form hass been submitted' 
 message.

 In order to prevent this from happening, you should do a header('Location: 
 success-page.php') on a successful submit. This is so that at the redirected 
 page, the user would not have resent data even if he press the Reload 
 button.

 Hope this helps



 -Leon

Many thanks - at the top of the file I put in the code:

if ($_POST['submit'])
header('Location: .../submitted.php');

where further down in the form I have name=submit for the submit button.
 This goes to a new page submitted.php.  The code is in fact now at
http://proteus.as.arizona.edu/~csharp/lightcurved.php .

No doubt there is still a way of writing back to the original page after
the submit button has been clicked, but I can't see an easy way, so this
will have to do for now.  A work-around is to do it in frames, and write
to a frame at the bottom so that it appears to be in the same page.

Christopher Sharp

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



[PHP] Forms on PHP

2005-01-10 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hi,

I am new to this or any newsgroup in PHP, as well as PHP itself, so this
question is probably rather elementary.  I have a form which on clicking
on the Submit button calls up a compiled program on the server that is
executed and writes output to a file.  This file is then read by the PHP
script and passed on for other processes.  When the page is first loaded,
it knows that the Submit button has not been clicked, and after clicking
the button it knows, which is of course what we want.  The problem is that
subsequently it always thinks the button has been clicked, even if the
reload button on the browser has been clicked.

Here is a cut down version of the code, where for brevity I have removed
all inputs other than n:

pre
form method=post action=?php print $_SERVER['PHP_SELF'] ?
Type in the following parameters:
!-- Various other entries omitted such as a, i, e etc. --

input type=text name=n value=1000 size=6

input type=submit name=form_sumbitted value=Submit
/form
p
?php
// Start of PHP code - Extract values from form.
/* Other values read */
$n=$_POST['n'];

// Pass the data from the form to lightcurve_csharp
$command=./lightcurve_csharp $a $i $e $lomega $bomega $lambda $n;
$result=`$command`;

$form_submitted=$_POST['form_sumbitted'];
if (isset($form_submitted)) {
if ($form_submitted) {
echo 'The form has been submittedbr';
unset($form_submitted);
}
} else
echo 'The form has not been submittedbr';

The input value of $n is picked up from $n=$_POST['n'] which has the
default of 1000, and I test that Submit has been clicked by looking at
the state of $form_sumbitted.  Unfortunately this only works the first
time the page is loaded, and subsequently it is always flagged as set.

This is a test for only writing some text below the form if it has been
clicked.  Subsequently, when the page is refreshed or is clicked again
with new data, the text below the form should disappear until the
calculations have been completed.  The form is implimented at
http://proteus.as.arizona.edu/~csharp/sudarsky/lightcurvec.php .

I would be very grateful for some kind help on this.

Christopher Sharp
http://csharp.com

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



Re: [PHP] Forms In PHP

2004-12-10 Thread Richard Lynch
Wil Hitchman wrote:
 I created a web form in PHP and used a couple of email addresses.  The
 only email address that worked when I submitted to the form (for testing
 purposes) was my Yahoo address.  My AOL, hotmail and other work addresses
 did not work.  Can someone tell me why?

Technically, To:  is only supposed to allow one (1) email address.

Assuming you are using sendmail or one of its popular drop-in
replacements, they will support To:  with multiple emails, but it's not
RFC that they have to.

So while I don't think it's the real problem, you're better off using Cc:
 headers in the optional fourth argument to http://php.net/mail to be
standards-based.

Most likely, however, the email you sent was flagged as spam by AOL and
hotmail, but not yahoo.  So the email got sent just fine, but they throw
it out before you ever saw it.

You can research how spam filters work to make your email look less like
spam and tray again.

Unless you plan on sending spam, in which case you should just quit :-)

-- 
Like Music?
http://l-i-e.com/artists.htm


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



[PHP] Forms In PHP

2004-12-09 Thread Wil Hitchman
Hi, 

I created a web form in PHP and used a couple of email addresses.  The only 
email address that worked when I submitted to the form (for testing purposes) 
was my Yahoo address.  My AOL, hotmail and other work addresses did not work.  
Can someone tell me why?

Thanks, 

Wil

Re: [PHP] Forms and PHP

2003-07-20 Thread Jason Wong
On Sunday 20 July 2003 12:37, Jason Giangrande wrote:
 I have a question about forms and PHP.  Here's what I'm looking to do.
 I'm trying to set up a spell checker that checks text entered in a form,
 but I want the check results to show up in a different window so that
 the user can change the misspelled words if they'd like.  In other
 words, I want to be able to click a link and have another page open that
 checks the spelling.  My question is how can I send the text from the
 form to this other page (which, right now, is a separate php script) so
 it can be spell checked without actually submitting the actual form
 first?  In other words, I would like the user to be able to check the
 spelling without actually submitting the form.

Squirrelmail has a nice spelling checker which works similar to that. Take a 
look to see if you can borrow some ideas/code.

-- 
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
--
/*
It is not a good omen when goldfish commit suicide.
*/


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



[PHP] Forms and PHP

2003-07-20 Thread Yasir Malik
I'm working with forms using PHP and HTML.  I've noticed that there is a
limit of the length of a URL that can sent to browser (I'm passing many
many things as arguments across pages).  Is there a way to get across the
limit or am I doing something wrong?
Yasir

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



Re: [PHP] Forms and PHP

2003-07-20 Thread John Nichel
Yasir Malik wrote:
I'm working with forms using PHP and HTML.  I've noticed that there is a
limit of the length of a URL that can sent to browser (I'm passing many
many things as arguments across pages).  Is there a way to get across the
limit or am I doing something wrong?
Yasir
Submit your form via post instead of get.

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


Re: [PHP] Forms and PHP

2003-07-20 Thread Curt Zirzow
* Thus wrote Yasir Malik ([EMAIL PROTECTED]):
 I'm working with forms using PHP and HTML.  I've noticed that there is a
 limit of the length of a URL that can sent to browser (I'm passing many
 many things as arguments across pages).  Is there a way to get across the
 limit or am I doing something wrong?
 Yasir

using a form POST has virtually unlimited amount data that can be sent.

if you have to keep passing the data around, I would suggest to storing
the data in a session of some sort then just passing the session
variable around in the urls.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Forms and PHP

2003-07-19 Thread Jason Giangrande
I have a question about forms and PHP.  Here's what I'm looking to do. 
I'm trying to set up a spell checker that checks text entered in a form,
but I want the check results to show up in a different window so that
the user can change the misspelled words if they'd like.  In other
words, I want to be able to click a link and have another page open that
checks the spelling.  My question is how can I send the text from the
form to this other page (which, right now, is a separate php script) so
it can be spell checked without actually submitting the actual form
first?  In other words, I would like the user to be able to check the
spelling without actually submitting the form.

Thanks,
Jason Giangrande


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



RE: [PHP] Forms and PHP

2003-07-19 Thread Chris Hubbard
Not sure why you don't want to submit the form.  But if you really really
don't want to submit the form then you have to use javascript.
If you're willing to submit the form, then this is relatively simple,
depending on how you want to display the data.
if you're willing to submit, then step through the field that has the data,
one word at a time (maybe explode the string on   (space)) and compare the
word to your dictionary.  if the word is misspelled, then add it to an
array, or do some action


-Original Message-
From: Jason Giangrande [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 19, 2003 8:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Forms and PHP


I have a question about forms and PHP.  Here's what I'm looking to do.
I'm trying to set up a spell checker that checks text entered in a form,
but I want the check results to show up in a different window so that
the user can change the misspelled words if they'd like.  In other
words, I want to be able to click a link and have another page open that
checks the spelling.  My question is how can I send the text from the
form to this other page (which, right now, is a separate php script) so
it can be spell checked without actually submitting the actual form
first?  In other words, I would like the user to be able to check the
spelling without actually submitting the form.

Thanks,
Jason Giangrande


--
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

2003-07-19 Thread Justin French
This is done with javascript... without getting too off topic... JS can 
get the contents of the textarea, and submit it via get (maybe post as 
well) to another (pop-up) window.  the pop-up window can highlght 
misspelled words, and even make dynamic changes to the content in the 
first window.

it's pretty complex stuff though... and definitely NOT for the JS 
newbie...

look around the JS lists and sites for something that might give you a 
head start.

justin



On Sunday, July 20, 2003, at 02:37  PM, Jason Giangrande wrote:

I have a question about forms and PHP.  Here's what I'm looking to do.
I'm trying to set up a spell checker that checks text entered in a 
form,
but I want the check results to show up in a different window so that
the user can change the misspelled words if they'd like.  In other
words, I want to be able to click a link and have another page open 
that
checks the spelling.  My question is how can I send the text from the
form to this other page (which, right now, is a separate php script) so
it can be spell checked without actually submitting the actual form
first?  In other words, I would like the user to be able to check the
spelling without actually submitting the form.

Thanks,
Jason Giangrande
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
[This E-mail scanned for viruses]



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


Re: [PHP] Forms and PHP

2003-07-19 Thread Curt Zirzow
* Thus wrote Justin French ([EMAIL PROTECTED]):
 This is done with javascript... without getting too off topic... JS can 
 get the contents of the textarea, and submit it via get (maybe post as 
 well) to another (pop-up) window.  the pop-up window can highlght 
 misspelled words, and even make dynamic changes to the content in the 
 first window.

Yes you can do a POST with javascript :)


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Forms and PHP

2003-07-19 Thread Jason Giangrande
Thanks guys.  I think I'll try it first as Chris suggested and see how
that goes.  Thanks again.

Jason

On Sun, 2003-07-20 at 00:55, Justin French wrote:
 This is done with javascript... without getting too off topic... JS can 
 get the contents of the textarea, and submit it via get (maybe post as 
 well) to another (pop-up) window.  the pop-up window can highlght 
 misspelled words, and even make dynamic changes to the content in the 
 first window.
 
 it's pretty complex stuff though... and definitely NOT for the JS 
 newbie...
 
 look around the JS lists and sites for something that might give you a 
 head start.
 
 
 justin
 
 
 
 On Sunday, July 20, 2003, at 02:37  PM, Jason Giangrande wrote:
 
  I have a question about forms and PHP.  Here's what I'm looking to do.
  I'm trying to set up a spell checker that checks text entered in a 
  form,
  but I want the check results to show up in a different window so that
  the user can change the misspelled words if they'd like.  In other
  words, I want to be able to click a link and have another page open 
  that
  checks the spelling.  My question is how can I send the text from the
  form to this other page (which, right now, is a separate php script) so
  it can be spell checked without actually submitting the actual form
  first?  In other words, I would like the user to be able to check the
  spelling without actually submitting the form.
 
  Thanks,
  Jason Giangrande
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
  ---
  [This E-mail scanned for viruses]
 
 
 


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



Re: [PHP] Forms and PHP variables

2002-12-22 Thread Jason Wong
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

2002-12-22 Thread Philip Olson

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

2002-12-21 Thread Beauford.2002
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

2002-12-21 Thread Philip Olson

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

2002-12-21 Thread Beauford.2002
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 in PHP

2002-04-18 Thread Demitrious S. Kelly

Use an array
input type=hidden name=itemid[] value=11/input
input type=hidden name=itemid[] value=22/input
input type=hidden name=itemid[] value=33/input

$numberofitemids=count($itemid);
echo $itemid[0]; // == 1
echo $itemid[1]; // == 2
echo $itemid[2]; // == 3


cheers
-Original Message-
From: Alia Mikati [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 17, 2002 2:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Forms in PHP

Hello
I hope u can help me with this problem. I dont know if it is possible to

do it. I'm using PHP and XML to generate the folowing HTML:
...
form method=post action=cart.php
input type=hidden name=itemid value=11/input
...
input type=hidden name=itemid value=22/input
...
input type=hidden name=itemid value=33/input
...
...

I want to use PHP to count the number of $itemid in this file. Is it 
possible? And how?
Thx a lot



-- 
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 in PHP

2002-04-17 Thread Alia Mikati

Hello
I hope u can help me with this problem. I dont know if it is possible to 
do it. I'm using PHP and XML to generate the folowing HTML:
...
form method=post action=cart.php
input type=hidden name=itemid value=11/input
...
input type=hidden name=itemid value=22/input
...
input type=hidden name=itemid value=33/input
...
...

I want to use PHP to count the number of $itemid in this file. Is it 
possible? And how?
Thx a lot



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




Re: [PHP] Forms in PHP

2002-04-12 Thread Erik Price


On Thursday, April 11, 2002, at 09:17  PM, Jennifer Downey wrote:

 Now I have a weird problem. I am using this code and can't understand 
 why it
 doesn't work.
 When the script is run it returns a blank page, no error or done.

 here it is and any help would be appreciated.

 if(($type == book) or ($type == weapon)){
   ^^ 

I could be completely wrong here, but shouldn't these values be quoted?  
Even if it's not what's screwing up your code, it's probably a good idea 
unless they are supposed to represent your own defined constants.

Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




[PHP] FORMs (HELP) --- PHP Gurus (Please HELP)

2001-10-24 Thread Miguel Ribeiro

Hi,

How can be possible to call other functions (that have a html pages) from a
first function that also have a html with a form and pass all html variables
without losing them?

I've a problem that from a html form I'm losing all html variables and this
is happening because this form is located in the 3th function (one inside
another)...

If you know a better way to deal with this... I'm interested to learn...
Thanks for all.

Simple example that may work:

file name: xyz.php



function display($ref) {
printf('The REF have %s,$ref);
}

function query() {
echo('FORM ENCTYPE=multipart/form-data NAME=addimovel METHOD=POST
ACTION=xyz.php?pg=1ref=$ref);
echo('TABLE
TR
TDRef/TD
TDINPUT type=text name=ref/TD
/TR
TR
TDINPUT border=0 src=baddaz.jpg
name=ADD width=40 height=40 type=image/TD
/TR
/TABLE
/FORM');
}

// PG options
switch($pg) {
case 1:display($ref);
break;
default:query();
break;
}




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]