[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 10-30-2006, 05:24 PM   #1 (permalink)
Senior Member
 
faisj's Avatar
 
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,198
60.18 NP$ (Donate)

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

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.

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, 06:44 PM   #2 (permalink)
NPQ's PA, Slave, and On Call Coder

Technical Services


 
Eric's Avatar
 
Join Date: Mar 2005
Posts: 4,545
0.71 NP$ (Donate)

Eric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond repute

Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse
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, 07:37 PM   #3 (permalink)
Senior Member
 
faisj's Avatar
 
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,198
60.18 NP$ (Donate)

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

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, 07:43 PM   #4 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

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, 08:33 PM   #5 (permalink)
NPQ's PA, Slave, and On Call Coder

Technical Services


 
Eric's Avatar
 
Join Date: Mar 2005
Posts: 4,545
0.71 NP$ (Donate)

Eric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond repute

Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse
^ correct. I'd have to see your "script.php" - to help you any further..
__________________
Eric is offline  
Old 10-31-2006, 12:59 PM   #6 (permalink)
Senior Member
 
faisj's Avatar
 
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,198
60.18 NP$ (Donate)

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

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 01:08 PM.
faisj is offline  
Old 10-31-2006, 01:25 PM   #7 (permalink)
NPQ's PA, Slave, and On Call Coder

Technical Services


 
Eric's Avatar
 
Join Date: Mar 2005
Posts: 4,545
0.71 NP$ (Donate)

Eric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond repute

Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse
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..
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, 01:34 PM   #8 (permalink)
Senior Member
 
faisj's Avatar
 
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,198
60.18 NP$ (Donate)

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

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, 05:03 PM   #9 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

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, 05:23 PM   #10 (permalink)
Senior Member
 
faisj's Avatar
 
Join Date: Mar 2005
Location: The Netherlands
Posts: 3,198
60.18 NP$ (Donate)

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

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, 07:02 AM   #11 (permalink)
Joe
Senior Member
 
Join Date: Oct 2005
Location: Kent ~ U.K.
Posts: 3,246
88.85 NP$ (Donate)

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
Joe is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 08:05 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85