Re: Trap CR or "Enter" possible?
| From: | Andre Dubuc | Date: | Fri, 22 Mar 2002 02:52:45 +0000 |
| Subject: | Re: Trap CR or "Enter" possible? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89638@lists.php.net to get a copy of this message | ||
Thanks Martin,
I forgot to mention: I would like to accomplish this using PHP since I'm not
using Javascript. Will this still work with straight html?
regards,
Andre
On Thursday 21 March 2002 21:39, you wrote:
> do it in html/javascript like this:
>
> <form action="http://www.somewhere.com/"
> method="get" onSubmit="return
> (this.okay.value != 'no');">
> <input type="hidden" name="okay" value="no">
> <input type="text">
> <input type="submit" onClick="this.form.okay.value =
> 'yes';">
> </form>
>
> -----Original Message-----
> From: Andre Dubuc [mailto:aajdubuc@webhart.net]
> Sent: Friday, March 22, 2002 1:39 PM
> To: php-general@lists.php.net
> Subject: [PHP] Trap CR or "Enter" possible?
>
>
> In one of my php pages, I have a form that requires the user to click
> "Search
> for Surname". If however they press "Enter", undesirable effects occur.
>
> I've successfully trapped if an empty string is in the <input
> type="text"....>, but "Enter" eludes my efforts to trap it for an
> appropriate
> "Educational" message about following instructions :>
>
> ie:
>
> if ($sname == "") {echo "Please enter a Surname and click "Search for
> Surname'.", exit;}
> if (eregi(\r == true) {exit;} // something tells me this isn't correct!!
>
>
> Any ideas how I can accomplish this -- the code is asking for search
> criteria
> for a query into PostgreSQL (it's coded between <?php . . . ?>)
>
> Any ideas, suggestions, or where to look would be appreciated.
>
> Tia,
> Andre
>
>
> ----------
>
> Please pray the Holy Rosary to end the holocaust of abortion.
> Remember in your prayers the suffering souls in Purgatory.
>
> May God bless you abundantly in His love!
>
> For a free Cenacle Scriptural Rosary Booklet --
> http://www.webhart.net/csrb/
--
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the suffering souls in Purgatory.
May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet -- http://www.webhart.net/csrb/