473,729 Members | 1,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form validation with PHP/Javascript

Hi,

I have a form for uploading documents and inserting the data into a mysql
db. I would like to validate the form. I have tried a couple of Javascript
form validation functions, but it appears that the data goes straight to the
processing page, rather than the javascript seeing if data is missing and
popping up an alert. I thought it may be because much of the form is
populated with data from the db (lists, etc.), but when I leave out data in
a simple textbox, it still doesn't see it. I've tried a couple of different
things, that didn't work, so I simplified and tried to address one form
element at the simplest level at a time - still no luck. Is there something
special I need to do to make the Javascript work before the PHP? Is there a
good way to do client side validation with PHP?

Here's most of the code:

function ValidateForm(up load)
{
if(IsEmpty(uplo ad.title))
{
alert('You have not entered a title!')
form.title.focu s();
return false;
}

return true;

}
</script>
<?php
NOTE: queries are here - they fill some of the list boxes

<form enctype="multip art/form-data" action="upload. php" name="upload"
id="upload" method="post" onsubmit="javas cript:return ValidateForm(up load)">
<input name="uploadfil e" type="hidden" value="uploadfi le" />
<!--//Create the file and description inputs. -->

<table width="100%" border="0" cellspacing="5" cellpadding="0" >
<snip - took out a different category listing>
<tr>
<td <fieldset>
<legend><a name="Standard" id="Standard"> </a>Standard Document</legend>
<br />Complete this section <strong>only</strongif document/link is NOT
a Tool.<br /><br />
<snip - took out the generated category/subcategory lists>
</td>
</tr>
<tr>
<td><fieldset >
<legend>Documen t Information</legend>
<strong>Documen t Title</strong>:
<input name="title" id="title" type="text" size="40"
maxlength="50" />
<br />
(Required - no more than 50 characters)<br />
<br />
<strong>Descrip tion:</strong>(Require d -150 characters) <br />
<textarea name="descripti on" cols="30" rows="5"></textarea>
<br />

</fieldset></td>
<td><fieldset >
<legend>Proje ct Data</legend>
</p>
<strong>Prima ry Project:</strong>
<select name="project" id="project">
<option value="value">S elect a project...</option>
<?php
do {
?>
<option value="<?php echo $row_projects['projID']?>"><?php echo
$row_projects['projCode']?></option>
<?php
} while ($row_projects = mysql_fetch_ass oc($projects));
$rows = mysql_num_rows( $projects);
if($rows 0) {
mysql_data_seek ($projects, 0);
$row_projects = mysql_fetch_ass oc($projects);
}
?>
</select>
</p>
<snip- took out another listbox>
</fieldset></td>
</tr>
<tr>
<td><fieldset >
<legend>Documen t to Upload</legend>Upload a document from your computer.
<p><strong>File :</strong>
<input type="file" name="fileuploa d" id="fileupload "/>
</p></fieldset></td>
<td></td>
</tr>
</table>
<p</p>
<div align="center">
<input type="submit" name="submit" value="Submit" />
</div>
</form>
<snip>
?>

Thanks
Chris
Aug 15 '06 #1
27 4750
Rik
Chris wrote:
Hi,

I have a form for uploading documents and inserting the data into a
mysql db. I would like to validate the form. I have tried a couple
of Javascript form validation functions, but it appears that the data
goes straight to the processing page, rather than the javascript
seeing if data is missing and popping up an alert. I thought it may
be because much of the form is populated with data from the db
(lists, etc.), but when I leave out data in a simple textbox, it
still doesn't see it. I've tried a couple of different things, that
didn't work, so I simplified and tried to address one form element at
the simplest level at a time - still no luck.
Well, if you're having a problem with the javascript, post in
comp.lang.javas cript,
js has absolutely nothing to do with the PHP which created it. Judging by
your code:
function ValidateForm(up load)
{
if(IsEmpty(uplo ad.title))
{
alert('You have not entered a title!')
form.title.focu s();
return false;
}

return true;
}
<form enctype="multip art/form-data" action="upload. php" name="upload"
id="upload" method="post" onsubmit="javas cript:return
ValidateForm(up load)">
<input name="title" id="title" type="text" size="40"
maxlength="50" />
1. Lose the 'javascript:'
2. 'upload' isn't set, use "return ValidateForm(th is)"

And then I still doubt 'upload.title' and 'form.title.foc us()' are valid,
but hey, I know very little js.
Is there something
special I need to do to make the Javascript work before the PHP? Is
there a good way to do client side validation with PHP?
No, PHP outputs javascript as pure text, and has absolutely nothing to do
with it's workings on the clients computer. Furthermore client side
validation with PHP is impossible as it runs on the server, not on the
clients computer, you can only submit the form to it, check the values, and
report them back in a new HTML page (not neccesarily another script, could
easily be the same).

Crossposted to comp.lang.javas cript, f'up c.l.js.

Grtz,
--
Rik Wasmus
Aug 15 '06 #2
"Rik" <lu************ @hotmail.comwro te in message
news:<8e******* *************** *****@news1.tud elft.nl>...
>
Well, if you're having a problem with the javascript, post in
comp.lang.javas cript,
js has absolutely nothing to do with the PHP which created it. Judging by
your code:
I don't understand your statement - "js has absolutely nothing to do with
the PHP which created it". My problem isn't the js - it works okay on a
non-php generated form - I have used js to validate html forms in the past
with no problem. The question is how to work with PHP and js together - a
commonly asked question in forums. There are ways to pass the variables
back and forth, etc. which I have used elsewhere in my application. But I
haven't seen anything regarding form validation when the form is PHP and the
validation is js.
>
function ValidateForm(up load)
{
if(IsEmpty(uplo ad.title))
{
alert('You have not entered a title!')
form.title.focu s();
return false;
}

return true;
}
<form enctype="multip art/form-data" action="upload. php" name="upload"
id="upload" method="post" onsubmit="javas cript:return
ValidateForm(up load)">
<input name="title" id="title" type="text" size="40"
maxlength="50" />

1. Lose the 'javascript:'
2. 'upload' isn't set, use "return ValidateForm(th is)"
I had tried that before (when I had more complicated js) - and I tried it
again - no help.
>
And then I still doubt 'upload.title' and 'form.title.foc us()' are valid,
but hey, I know very little js.
Is there something
special I need to do to make the Javascript work before the PHP? Is
there a good way to do client side validation with PHP?

No, PHP outputs javascript as pure text, and has absolutely nothing to do
with it's workings on the clients computer. Furthermore client side
validation with PHP is impossible as it runs on the server, not on the
clients computer, you can only submit the form to it, check the values,
and
report them back in a new HTML page (not neccesarily another script, could
easily be the same).
That's my concern as I know that PHP is server-side and processes before
data goes to the browser. So - how to intercept the data as it goes from the
browser to the server?
I'm sure this is a fairly simple process, since there are tons of PHP forms
out there that get validated. Perhaps incorporate the js into the processing
page at the very beginning?
//check that form has been submitted
if (isset($_POST['uploadfile'])) { //begin check for submission
Validate form elements and show js alerts here (how to redirect user back to
form and elements for revisions? Maybe I should keep the processing on the
same page as the code.
//check if file uploaded
if (isset($_FILES['fileupload']['name'])) { // begin check for uploaded file
What to do if form is valid:
1.create path and move temp file to permanent location
2.insert data into db
3.display success page
}else{
File not uploaded - try again!
}
} else { //end submission and validation check
Show form
}
>
Does this look like reasonable workable logic?
Thanks,
Chris
Aug 15 '06 #3
Rik
Chris wrote:
"Rik" <lu************ @hotmail.comwro te in message
news:<8e******* *************** *****@news1.tud elft.nl>...
>>
Well, if you're having a problem with the javascript, post in
comp.lang.java script,
js has absolutely nothing to do with the PHP which created it.
Judging by your code:

I don't understand your statement - "js has absolutely nothing to do
with the PHP which created it". My problem isn't the js - it works
okay on a non-php generated form - I have used js to validate html
forms in the past with no problem.
Then check your HTML & JS source again. There are errors in it. As soon as
the page arrives it's just that, a page, which works exactly the same as if
you had typed the static HTML/JS by hand.
The question is how to work with
PHP and js together - a commonly asked question in forums.
Which will always be given the answer I gave you.
There are
ways to pass the variables back and forth, etc. which I have used
elsewhere in my application.
Not really, unless you use AJAX and the like to start seperate request to
the server. PHP on the server and JS on the clients UA. They cannot
communicate directly. All PHP recieves are HTTP requests in this case.
But I haven't seen anything regarding
form validation when the form is PHP and the validation is js.
Because there is no difference.
>>function ValidateForm(up load)
{
if(IsEmpty(up load.title))
{
alert('You have not entered a title!')
form.title.fo cus();
return false;
}

return true;
}
>><form enctype="multip art/form-data" action="upload. php"
name="uploa d" id="upload" method="post" onsubmit="javas cript:return
ValidateForm( upload)">
>><input name="title" id="title" type="text" size="40"
maxlength="50 " />

1. Lose the 'javascript:'
2. 'upload' isn't set, use "return ValidateForm(th is)"

I had tried that before (when I had more complicated js) - and I
tried it again - no help.
Then maybe the good people here in c.l.javascript can help you. MNaybe it's
just as well it's also in c.l.php, let's hope people will search for this
topic, and understand it, so I won't feel obliged to explain it for the
hundredth time.
>And then I still doubt 'upload.title' and 'form.title.foc us()' are
valid, but hey, I know very little js.
>>Is there something
special I need to do to make the Javascript work before the PHP? Is
there a good way to do client side validation with PHP?

No, PHP outputs javascript as pure text, and has absolutely nothing
to do with it's workings on the clients computer. Furthermore client
side validation with PHP is impossible as it runs on the server, not
on the clients computer, you can only submit the form to it, check
the values, and
report them back in a new HTML page (not neccesarily another script,
could easily be the same).

That's my concern as I know that PHP is server-side and processes
before data goes to the browser. So - how to intercept the data as it
goes from the browser to the server?
You don't 'intercept' the data, you prevent the sending of a request. Pure
js, no PHP involved, PHP cannot influence anything as soon as the page is
sent, and will only go to work as soon as it gets another request by HTTP.
I'm sure this is a fairly simple process, since there are tons of PHP
forms out there that get validated.
Yup, by js on the client side, and php on the server side, or none, or a
combination of both.
Perhaps incorporate the js into
the processing page at the very beginning?
I sincerely doubt an error in js or your html will be solved by moving the
script tags around.
//check that form has been submitted
if (isset($_POST['uploadfile'])) { //begin check for submission
Validate form elements
and show js alerts here
Impossible, the form is already submitted.
(how to redirect user
back to form and elements for revisions? Maybe I should keep the
processing on the same page as the code.
A colored border around element's which are not correctly filled, and
echoing usefull hints is the standard way to go.
//check if file uploaded
if (isset($_FILES['fileupload']['name'])) { // begin check for
uploaded file What to do if form is valid:
1.create path and move temp file to permanent location
2.insert data into db
3.display success page
}else{
File not uploaded - try again!
}
} else { //end submission and validation check
Show form
}
>>
Does this look like reasonable workable logic?
That's a workable logic, which has nothing to do with js validation on the
client side.

Grtz,
--
Rik Wasmus
Aug 15 '06 #4
Chris said the following on 8/15/2006 6:12 PM:
"Rik" <lu************ @hotmail.comwro te in message
news:<8e******* *************** *****@news1.tud elft.nl>...
>Well, if you're having a problem with the javascript, post in
comp.lang.java script,
js has absolutely nothing to do with the PHP which created it. Judging by
your code:

I don't understand your statement - "js has absolutely nothing to do with
the PHP which created it".
If you don't understand that statement, you need to take a good class on
HTTP.
My problem isn't the js - it works okay on a non-php generated form -
Yes, your problem is the js. If it works on a "non-php generated form"
then it will work on a PHP generated form providing PHP doesn't change
the names/ID's.
I have used js to validate html forms in the past with no problem.
With just the snippet quoted in the previous post, I find that a dubious
claim that I don't believe.
The question is how to work with PHP and js together - a commonly asked
question in forums.
And you will get two replies to that question:

1) They are unrelated other than being on the opposite ends of a
stateless HTTP Connection.
2) Some utter garbage that doesn't resemble the truth.
There are ways to pass the variables back and forth, etc. which I have
used elsewhere in my application.
Really? And you don't understand form validation using JS and that PHP
has nothing to do with it? Impressive.
But I haven't seen anything regarding form validation when the form is
PHP and the validation is js.
That is because JS doesn't know, and doesn't care, what server side
language generated it. It's irrelevant.

<snip>
That's my concern as I know that PHP is server-side and processes before
data goes to the browser. So - how to intercept the data as it goes from the
browser to the server?
You use JS and the onsubmit event handler. Once it is submitted, JS
can't touch it.
I'm sure this is a fairly simple process, since there are tons of PHP forms
out there that get validated. Perhaps incorporate the js into the processing
page at the very beginning?
Nope.
//check that form has been submitted
if (isset($_POST['uploadfile'])) { //begin check for submission
Validate form elements and show js alerts here (how to redirect user back to
form and elements for revisions? Maybe I should keep the processing on the
same page as the code.
//check if file uploaded
if (isset($_FILES['fileupload']['name'])) { // begin check for uploaded file
What to do if form is valid:
1.create path and move temp file to permanent location
2.insert data into db
3.display success page
}else{
File not uploaded - try again!
}
} else { //end submission and validation check
Show form
}
Does this look like reasonable workable logic?
Not even close.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 15 '06 #5
Chris wrote:
Hi,

I have a form for uploading documents and inserting the data into a mysql
db. I would like to validate the form. I have tried a couple of Javascript
form validation functions, but it appears that the data goes straight to the
processing page, rather than the javascript seeing if data is missing and
popping up an alert. I thought it may be because much of the form is
populated with data from the db (lists, etc.), but when I leave out data in
a simple textbox, it still doesn't see it. I've tried a couple of different
things, that didn't work, so I simplified and tried to address one form
element at the simplest level at a time - still no luck. Is there something
special I need to do to make the Javascript work before the PHP? Is there a
good way to do client side validation with PHP?

Here's most of the code:
<code snipped>

Chris,

As Rik is trying to tell you, there is no interaction between javascript
and PHP (unless you're using Ajax - but that's another story). PHP can
create the JS - just like you can type it out. But JS doesn't call PHP
functions.

I don't rely on js for form validation. The user can turn it off too
easily. I validate everything server side. Even when I validate with
JS, I revalidate on the server.

There are two ways to validate on the server - on the current page or on
the next page. Both are done in PHO.

Validating on the current page means you submit the form to the same
page. At the beginning of your page, check to see if the page has been
submitted. If not, go display your form. If it has, validate the data.
If it validates, redirect to the next page. If not, display the
errors. The advantage here is the validation code is on the same page
as the form it's validating - nice and compact. The downside is you
can't post the data to the next page, so you either need to use GET or
store the data in a session object.

Validating on the next page means you do the actual validation in the
page receiving the form. You can post the data from the first form to
the second one, but if you detect an error it's more difficult to go
back to the first page.

I use both, depending on the circumstances.

But the bottom line is - always validate server side, even if you fist
validate client side.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Aug 15 '06 #6
"Chris" <de************ @centurytel.net píše v diskusním příspěvku
news:eb******** **@news01.intel .com...
Hi,

I have a form for uploading documents and inserting the data into a mysql
db. I would like to validate the form. I have tried a couple of
Javascript form validation functions, but it appears that the data goes
straight to the processing page, rather than the javascript seeing if data
is missing and popping up an alert. I thought it may be because much of
the form is populated with data from the db (lists, etc.), but when I
leave out data in a simple textbox, it still doesn't see it. I've tried a
couple of different things, that didn't work, so I simplified and tried to
address one form element at the simplest level at a time - still no luck.
Is there something special I need to do to make the Javascript work before
the PHP? Is there a good way to do client side validation with PHP?
Javascript validation is not a good idea :-) Some users could have disabled
scripting in browser.
Validate data at server side and generate some warning into returned page.

test.php
----
<html><body>
<form name="test" action="test.ph p" method="post">
<?php
echo "<input name=\"number\" type=\"text\" value=\"",
isset($_POST["number"]) ? $POST["number"] : "", "\">";
if(! isset($_POST["number"])) {
echo "Write number here";}
elseif(isset($_ POST["number"]) and ! is_numeric($_PO ST["number"])) {
echo "Write DIGITS only";}
else {
echo "OK";}
?>
<input name="ok" type="submit" value="OK">
</form>
</body></html>
----
--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Aug 16 '06 #7
Rik
Petr Vileta wrote:
"Chris" <de************ @centurytel.net píše v diskusním příspěvku
news:eb******** **@news01.intel .com...
>Hi,

I have a form for uploading documents and inserting the data into a
mysql db. I would like to validate the form. I have tried a couple
of Javascript form validation functions, but it appears that the data
goes straight to the processing page, rather than the javascript
seeing if data is missing and popping up an alert. I thought it may
be because much of the form is populated with data from the db (lists,
etc.), but when I leave out data in a simple textbox, it still doesn't
see it. I've tried a couple of different things, that didn't work, so
I simplified and tried to address one form element at the simplest
level at a time - still no luck. Is there something special I need to
do to make the Javascript work before the PHP? Is there a good way to
do client side validation with PHP?
Javascript validation is not a good idea :-) Some users could have
disabled scripting in browser.
Validate data at server side and generate some warning into returned page.
Javascript validitation IS a good idea, as it can save the user a trip
to the server. You HAVE to check server-side too, that's true.

Grtz,
--
Rik Wasmus
Aug 16 '06 #8
"Randy Webb" <Hi************ @aol.comwrote in message
news:OP******** *************** *******@comcast .com...
Chris said the following on 8/15/2006 6:12 PM:
>"Rik" <lu************ @hotmail.comwro te in message
news:<8e****** *************** ******@news1.tu delft.nl>...
>>
I don't understand your statement - "js has absolutely nothing to do with
the PHP which created it".

If you don't understand that statement, you need to take a good class on
HTTP.
That may be so, but I haven't seen any such classes available at my college,
and even if there were, I don't have the time to take one now.
>My problem isn't the js - it works okay on a non-php generated form -

Yes, your problem is the js. If it works on a "non-php generated form"
then it will work on a PHP generated form providing PHP doesn't change the
names/ID's.
There may have been an error in it - but if you visit a few sites regarding
form validation with PHP and JS they show the same essential layout - in
fact, what I had included was a copy & paste from a tutorial - only changing
the name of the form element itself.
>I have used js to validate html forms in the past with no problem.

With just the snippet quoted in the previous post, I find that a dubious
claim that I don't believe.
You are just being rude here.
> The question is how to work with PHP and js together - a commonly asked
question in forums.

And you will get two replies to that question:

1) They are unrelated other than being on the opposite ends of a stateless
HTTP Connection.
2) Some utter garbage that doesn't resemble the truth.
Please see the following sites:
http://www.phpdebutant.com/articles/...orms.htmlThese
are all slightly different approaches, but they all refer to the use of both
PHP and js being used together to validate forms.I was looking for advice
for what approach has proven to work best when much of the data in the
initial form is php-generated (such as populating the list boxes).
>There are ways to pass the variables back and forth, etc. which I have
used elsewhere in my application.

Really? And you don't understand form validation using JS and that PHP has
nothing to do with it? Impressive.
Again - very rude. I never said that PHP had anything to do with JS or
vice-versa - I simply wanted to
know the best way to use both together to validate a form.
>But I haven't seen anything regarding form validation when the form is
PHP and the validation is js.

That is because JS doesn't know, and doesn't care, what server side
language generated it. It's irrelevant.

Rude again
<snip>
>
>That's my concern as I know that PHP is server-side and processes before
data goes to the browser. So - how to intercept the data as it goes from
the browser to the server?

You use JS and the onsubmit event handler. Once it is submitted, JS can't
touch it.
correct - because js is client-side, but I noted that the onsubmit event
handler didn't find the js function. That is why I even posted my question
in the first place. Our site has a header automatically prepended,
therefore, it's very likely didn't have the js in the correct spot so that
it can be called from the very top of the page (within the initial head
tags) - perhaps as an external js file.
>I'm sure this is a fairly simple process, since there are tons of PHP
forms out there that get validated. Perhaps incorporate the js into the
processing page at the very beginning?

Nope.
>Does this look like reasonable workable logic?

Not even close.
See the above-referenced sites.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/
It surprises me that some of the people in newsgroups are so rude to those
of us who are simply asking questions because we don't understand or would
like further clarification on how to approach something. If we were all php
or js gurus, we wouldn't be posting questions here. Perhaps I don't
understand the purpose of a newsgroup - I thought it was to share
information, not belittle people.

Christina
Aug 16 '06 #9
"Jerry Stuckle" <js*******@attg lobal.netwrote in message
news:6L******** *************** *******@comcast .com...
>
Chris,

As Rik is trying to tell you, there is no interaction between javascript
and PHP (unless you're using Ajax - but that's another story). PHP can
create the JS - just like you can type it out. But JS doesn't call PHP
functions.
Yes, I understood that, perhaps I wasn't very clear in how I presented it.
I was referring to information I've seen regarding passing PHP and JS values
back and forth.
Here are some examples:
http://www.netadmintools.com/art469.html
http://aspn.activestate.com/ASPN/Coo.../Recipe/414334
http://www.activewidgets.com/javascr...variables.html
>
I don't rely on js for form validation. The user can turn it off too
easily. I validate everything server side. Even when I validate with JS,
I revalidate on the server.
Thank you so much Jerry. This is the advice I was looking for. Much of
what you have said is similar to what I have seen around the web, but what's
out there varies so much, and some is old, so I rely on the newsgroups to
give me a current (therefore hopefully well-tested) approach.

I like this approach and have seen some reference to it online.
This page looks like a good start:
http://www.php-mysql-tutorial.com/fo...n-with-php.php

Most places simply go with js validation using onSubmit event handler,
however I have seen those that use only PHP, and some that use both. The
code that I posted appeared to not find the js function before the form was
submitted It wasn't the only js function I tried, but they all were very
similar - none of them worked - and most were c&p with only a change to the
name of the form and form element - I'm figuring it's because of where I
located the function(s). In my response to Randy Webb, I stated, "Our site
has a header automatically prepended, therefore, it's very likely didn't
have the js in the correct spot so that it can be called from the very top
of the page (within the initial head tags) - perhaps as an external js
file."
There are two ways to validate on the server - on the current page or on
the next page. Both are done in PHO.

Validating on the current page means you submit the form to the same page.
At the beginning of your page, check to see if the page has been
submitted. If not, go display your form. If it has, validate the data.
If it validates, redirect to the next page. If not, display the errors.
The advantage here is the validation code is on the same page as the form
it's validating - nice and compact. The downside is you can't post the
data to the next page, so you either need to use GET or store the data in
a session object.
I think I would like to validate in the same page as the form. Since this
is an intranet and security is handled at the server level (vs. site level)
it is possible that a session is already created as soon as the user logs
on. I say this because I have seen values continue to be displayed even
when refreshing a form (like a sticky form, but I didn't intentionally code
it to be one). They only seem to clear when the page is accessed through a
link as a totally new page. Oddly, this doesn't always occur, and Firefox
does this differently than IE, and I haven't had time to study and evaluate
what is happening.

Is the header() command what you are referring to when you say use GET? I
saw this on a tutorial. The tutorial used this for sending the processing to
a new page, but the validation was PHP and in the same page as the form.
header("locatio n: formpage.php?fi rstname=$firstn ame&lastname=$l astname");
Validating on the next page means you do the actual validation in the page
receiving the form. You can post the data from the first form to the
second one, but if you detect an error it's more difficult to go back to
the first page.
Perhaps the header("locatio n:
formpage.php?fi rstname=$firstn ame&lastname=$l astname"); would also work to
get back to the original form? I'm thinking in terms of passing the already
set values back to the form so it doesn't need to be completely refilled.
I use both, depending on the circumstances.

But the bottom line is - always validate server side, even if you fist
validate client side.
Thanks again,

Chris


Aug 16 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4257
by: TG | last post by:
Dear PHP Group, I have two forms that are used to collect user information. The first one takes user inputted values such as fullname, city, address etc. I want these values to display in the second form when it is called. Both forms are .htm files that call themselves when the submit button is press via the following command in each form: <form method="post" action="<?php $server?>">
3
2923
by: wk6pack | last post by:
Hi, How do you check for a empty value from a form? lservice = request.form("pservice") if not isnull(lservice) then <== this doesnt work. tried "" empty string and it still didnt work. ......
6
507
by: Darren | last post by:
I have a form that has 10 fields on it. I have made all of them "Required". I also am using vb if statements to decide whether or not each field should be on the page. I am using the vb to compare values in my database and if a certain field equals something then the field is shown on the form. When the form is displayed in the browser, it could any increment of the 10 fields on it. My problem is that unless all fields are being shown...
2
2008
by: iam247 | last post by:
Hi I have an ASP form which only includes an option list. The list is dynamically created but includes a default value, which is an instruction "Select a group". The code is shown at bottom. I want to ensure the user does not submit the form with the default value selected.
16
2244
by: Hosh | last post by:
I have a form on a webpage and want to use JavaScript validation for the form fields. I have searched the web for form validation scripts and have come up with scripts that only validate individual fields, such as an "Email Validation Script" or a "Phone Validation Script". Is it ok to put all these scripts on page as they are or should they be joined in some way together to be one script? I'm a total JavaScript newbie and am completely...
9
4178
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be honest I usually hire someone to do it for me, grab predone scripts and kind of hack out the parts that I need, or just do very minimal validation (e.g. this is numeric, this is alpha-numeric, etc.)
11
2999
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether certain fields match certain criteria, and inform the user in different ways when the data is wrong (offcourse, this will be checked on posting the data again, but that's something I've got a lot of experience with). Now, offcourse it's...
2
2300
by: rynato | last post by:
I have a form which the user fills out to enter some data. If there already exists an uncompleted session - say, the user started entering some data but had to stop to do something else - the user has the option of selecting that session from a drop-down menu (think <form><select><option>....</option></select></form>). The method for that particular form is set to 'GET' and the action is $_SERVER. The <selecttag has a bit of javascript...
3
3296
uranuskid
by: uranuskid | last post by:
Hey folks, I was going to include a contact form on my website. Well, in the first place that seemed an easy thing to do with a form that prompts a PHP file validating the input vaiables and using it's mail () function to send the mail. However, as I got more into that topic I realized that one should be really concerned about the validation part to prevent spam abuse. There are shiploads of 'mail scripts' available with each of them has...
0
8932
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9295
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9222
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9163
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6028
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4799
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2173
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.