NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Form question (required fields)

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 10-30-2006, 06:24 PM THREAD STARTER               #1 (permalink)
Senior Member
 
faisj's Avatar
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,212
faisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to behold
 

Member of the Month
November 2006
Child Abuse Child Abuse Baby Health Cancer Survivorship Child Abuse

Question Form question (required fields)


I guys,

I have this as code on the moment:
HTML Code:
<p>Get your tickets:<br>
<FORM action="script.php" method="post" name="form">
	Naam: 
	<INPUT name="name" size="10" style="BACKGROUND-COLOR: #FFFFFF; BORDER-BOTTOM: #F383A9 1px solid; BORDER-LEFT: #F383A9 1px solid; BORDER-RIGHT: #F383A9 1px solid; BORDER-TOP: #F383A9 1px solid; FONT-FAMILY: Arial; Helvetica; Microsoft Sans Serif; FONT-SIZE: 8pt; HEIGHT: 18px; WIDTH: 100px;" value="" /><br />
	Aantal kaarten: 
	<INPUT name="amountoftickets" size="10" style="BACKGROUND-COLOR: #FFFFFF; BORDER-BOTTOM: #F383A9 1px solid; BORDER-LEFT: #F383A9 1px solid; BORDER-RIGHT: #F383A9 1px solid; BORDER-TOP: #F383A9 1px solid; FONT-FAMILY: Arial; Helvetica; Microsoft Sans Serif; FONT-SIZE: 8pt; HEIGHT: 18px; WIDTH: 20px;" value="" /><br />
	E-mail adres: <INPUT name="email" size="10" style="BACKGROUND-COLOR: #FFFFFF; BORDER-BOTTOM: #F383A9 1px solid; BORDER-LEFT: #F383A9 1px solid; BORDER-RIGHT: #F383A9 1px solid; BORDER-TOP: #F383A9 1px solid; FONT-FAMILY: Arial; Helvetica; Microsoft Sans Serif; FONT-SIZE: 8pt; HEIGHT: 18px; WIDTH: 100px;" value="" /><br />
	Mobiel nummer: <INPUT name="mobilenr" size="10" style="BACKGROUND-COLOR: #FFFFFF; BORDER-BOTTOM: #F383A9 1px solid; BORDER-LEFT: #F383A9 1px solid; BORDER-RIGHT: #F383A9 1px solid; BORDER-TOP: #F383A9 1px solid; FONT-FAMILY: Arial; Helvetica; Microsoft Sans Serif; FONT-SIZE: 8pt; HEIGHT: 18px; WIDTH: 80px;" value="" /><br /> 
	<p align=right><input type="image" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('submit','','images/submit_over.gif',1)" src="images/submit_up.gif" name="submit" style="width: 49px; height: 18px; border: 0;" align="absmiddle"></a></p>

</p>
2 things i wanted to have.
????: NamePros.com http://www.namepros.com/programming/252643-form-question-required-fields.html
????: NamePros.com http://www.namepros.com/showthread.php?t=252643

in the email form the script should check if a "@" is entered in the field
this way i know for sure people will enter a email address there

At Mobiel nummer (mobile number) I want to have a check that the
person entered 10 digits like: 0612345678

when they did not enter the info correct they should get a
popup that they have to fill it in before it can be send.

could someone help me with this.

thanks in advance.

kind regards,

Faisj
__________________

The PPC Parking Guide.com
~how much do you want to earn today?

faisj is offline  
Old 10-30-2006, 07:44 PM   #2 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
PHP

PHP Code:
<?php

// All digits
if (!preg_match('#[0-9]{10}#'$_POST['mobilenr']))
{
    echo 
'Invalid mobile number.';
}
else if (!
preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s\'"<>]+\.+[a-z]{2,6}))$#si'$_POST['email']))
{
    echo 
'Invalid email.';
}
else
{
    
//etc
}

?>
Eric is offline  
Old 10-30-2006, 08:37 PM THREAD STARTER               #3 (permalink)
Senior Member
 
faisj's Avatar
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,212
faisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to behold
 

Member of the Month
November 2006
Child Abuse Child Abuse Baby Health Cancer Survivorship Child Abuse
Dear SecondVersion,

Thanks! But, where should I add this piece of code?

kind regards,

Faisj
__________________

The PPC Parking Guide.com
~how much do you want to earn today?

faisj is offline  
Old 10-30-2006, 08:43 PM   #4 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
His code is set up to be placed in script.php-

You would replace the line "//etc" with most [if not all] of your current script.php.
Dan is offline  
Old 10-30-2006, 09:33 PM   #5 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
^ correct. I'd have to see your "script.php" - to help you any further..
Eric is offline  
Old 10-31-2006, 01:59 PM THREAD STARTER               #6 (permalink)
Senior Member
 
faisj's Avatar
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,212
faisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to behold
 

Member of the Month
November 2006
Child Abuse Child Abuse Baby Health Cancer Survivorship Child Abuse


Cant it open in a javascript popup i have seen that on other sites.
they do the check by java and before the data is send to script.php
the html performs the check

something like this
http://www.javascriptkit.com/script/...2/acheck.shtml
intergrated in the code i provided.

np$'s will be donated!
__________________

The PPC Parking Guide.com
~how much do you want to earn today?

Last edited by faisj; 10-31-2006 at 02:08 PM.
faisj is offline  
Old 10-31-2006, 02:25 PM   #7 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Here's the JS you provided integrated with your form. If you can find the JS to check for mobilenr, I can do that too..
????: NamePros.com http://www.namepros.com/showthread.php?t=252643
Code:
<script language="JavaScript1.2">

//Advanced Email Check credit-
//By JavaScript Kit (http://www.javascriptkit.com)
//Over 200+ free scripts here!

var testresults
function checkemail(){
var str=document.form1.email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!")
testresults=false
}
return (testresults)
}
</script>

<script>
function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}
</script>

 <p>Get your tickets:<br> <FORM action="script.php" method="post" name="form1" onsubmit="return checkbae()">
	Naam: 
	<INPUT name="name" size="10" style="BACKGROUND-COLOR: #FFFFFF; BORDER-BOTTOM: #F383A9 1px solid; BORDER-LEFT: #F383A9 1px solid; BORDER-RIGHT: #F383A9 1px solid; BORDER-TOP: #F383A9 1px solid; FONT-FAMILY: Arial; Helvetica; Microsoft Sans Serif; FONT-SIZE: 8pt; HEIGHT: 18px; WIDTH: 100px;" value="" /><br />
	Aantal kaarten: 
	<INPUT name="amountoftickets" size="10" style="BACKGROUND-COLOR: #FFFFFF; BORDER-BOTTOM: #F383A9 1px solid; BORDER-LEFT: #F383A9 1px solid; BORDER-RIGHT: #F383A9 1px solid; BORDER-TOP: #F383A9 1px solid; FONT-FAMILY: Arial; Helvetica; Microsoft Sans Serif; FONT-SIZE: 8pt; HEIGHT: 18px; WIDTH: 20px;" value="" /><br />
	E-mail adres: <INPUT name="email" size="10" style="BACKGROUND-COLOR: #FFFFFF; BORDER-BOTTOM: #F383A9 1px solid; BORDER-LEFT: #F383A9 1px solid; BORDER-RIGHT: #F383A9 1px solid; BORDER-TOP: #F383A9 1px solid; FONT-FAMILY: Arial; Helvetica; Microsoft Sans Serif; FONT-SIZE: 8pt; HEIGHT: 18px; WIDTH: 100px;" value="" /><br />
	Mobiel nummer: <INPUT name="mobilenr" size="10" style="BACKGROUND-COLOR: #FFFFFF; BORDER-BOTTOM: #F383A9 1px solid; BORDER-LEFT: #F383A9 1px solid; BORDER-RIGHT: #F383A9 1px solid; BORDER-TOP: #F383A9 1px solid; FONT-FAMILY: Arial; Helvetica; Microsoft Sans Serif; FONT-SIZE: 8pt; HEIGHT: 18px; WIDTH: 80px;" value="" /><br /> <p align=right><input type="image" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('submit','','images/submit_over.gif',1)" src="images/submit_up.gif" name="submit" style="width: 49px; height: 18px; border: 0;" align="absmiddle"></a></p> </p>
Eric is offline  
Old 10-31-2006, 02:34 PM THREAD STARTER               #8 (permalink)
Senior Member
 
faisj's Avatar
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,212
faisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to behold
 

Member of the Month
November 2006
Child Abuse Child Abuse Baby Health Cancer Survivorship Child Abuse
The mobile number has to be only checked only if there are 10 numbers entered.

Ps. i tried the script but i can still enter a invalid email address : (
__________________

The PPC Parking Guide.com
~how much do you want to earn today?

faisj is offline  
Old 10-31-2006, 06:03 PM   #9 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
Code:
<script type="text/javascript">
function checkform () {
	var mobilenr = document.form.mobilenr.value;
	
	if (mobilenr.length != 10) { 
		alert("Your mobile number needs to be 10 digits long."); 
		var errors = true; 
	}

	var email = document.form.email.value;
	var regex = new RegExp(/[_a-zA-Z0-9\.-]+\@[_a-zA-Z0-9\.-]{2,6}(\.[_a-zA-Z0-9\.-]{2,6})?/);
	
	if (email.match(regex)) {
	} else {
		alert("You must enter a valid email address."); 
		var errors = true; 
	}
	if (errors) return false;
	else return true;
}
window.onload = function () {
	document.form.submit.onmouseout = function () {
		document.form.submit.style.background = "url('images/submit_over.gif') 0 0 no-repeat;";
	}
	document.form.submit.onmouseover = function () {
		document.form.submit.style.background = "url('images/submit_up.gif') 0 0 no-repeat;";	
	}
}
</script>
<style type="text/css">
.input {
	BACKGROUND-COLOR: #FFFFFF; 
	BORDER-BOTTOM: #F383A9 1px solid; 
	BORDER-LEFT: #F383A9 1px solid; 
	BORDER-RIGHT: #F383A9 1px solid; 
	BORDER-TOP: #F383A9 1px solid; 
	FONT-FAMILY: Arial, Helvetica, Microsoft Sans Serif; 
	FONT-SIZE: 8pt; 
	HEIGHT: 18px; 
	WIDTH: 100px;
}
</style>

<p>Get your tickets:<br>
<FORM action="script.php" onsubmit="return checkform();" method="post" name="form">
	Naam: 
		<INPUT name="name" size="10" class="input" value="" /><br />
	Aantal kaarten: 
		<INPUT name="amountoftickets" size="10" class="input" value="" /><br />
	E-mail adres: 
		<INPUT name="email" size="10" class="input" value="" /><br />
	Mobiel nummer: 
		<INPUT name="mobilenr" size="10" class="input" value="" /><br />
	<p align=right>
		<input type="submit" value="" name="submit" style="background: url('images/submit_up.gif') 0 0 no-repeat; width: 49px; height: 18px; border: 0;" align="absmiddle">
	</p>
</p>
I edited the submit button code a little.. tell me if it's picture loads right.
Dan is offline  
Old 10-31-2006, 06:23 PM THREAD STARTER               #10 (permalink)
Senior Member
 
faisj's Avatar
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,212
faisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to beholdfaisj is a splendid one to behold
 

Member of the Month
November 2006
Child Abuse Child Abuse Baby Health Cancer Survivorship Child Abuse
Dan you are great!!!!

NP$'s send to Dan & SecondVersion

Thanks guys!!
__________________

The PPC Parking Guide.com
~how much do you want to earn today?

faisj is offline  
Old 11-05-2006, 08:02 AM   #11 (permalink)
Joe
Senior Member
Join Date: Oct 2005
Location: Kent ~ U.K.
Posts: 3,209
Joe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud of
 


Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
resolved

Joe
__________________
Myself and "JackHeskett" are no longer associated with FusedHosting.net. Please pipe all PMs to admin [at] fusedhosting.net.
Joe is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:16 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger