/    Sign up×
Community /Pin to ProfileBookmark

PHP Form not working

Hi there

Please help.

I have started creating my form. The alert popups are not working, and I dont know why.

[url]http://www.leighdesignstudio.com/james/contact.php[/url]

Thanks
Leigh

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@cs3mwMay 13.2008 — Without seeing your script for checkform() it is rather difficult to work out, however, in your form tag I would change

[code=html]<form name="frm" method="post" action="contact-thanks.php" onsubmit="return checkform();">[/code]

to

[code=html]<form name="frm" method="post" action="contact-thanks.php" onsubmit="return checkform(this);">[/code]

Note the (this) in your function call.

However if this doesnt work post your javascript function and I will take a look!!

P.S Like the site alot!! Great design!

Mike
Copy linkTweet thisAlerts:
@leighchicauthorMay 13.2008 — Thanks for your help :-)

I tried that and it doesnt work. Im really puzzled, as ive done many forms before and this one doenst want to work.

I have attached the files for you to have a look at.

Cheers!

Leigh

[upl-file uuid=80f1b5d4-6783-4a6c-baf2-c3230ef589a0 size=6kB]relevant files.zip[/upl-file]
Copy linkTweet thisAlerts:
@cs3mwMay 13.2008 — A couple of things stand out firstly close your form in your Contact page! And then secondly if you leave your form tag as

[code=html]<form name="frm" method="post" action="contact-thanks.php" onsubmit="return checkform(this);">[/code]

and then have your javascript as

[CODE]function checkform(form) {
msg = "";

if (form.fname.value == "") msg = msg + "- First namen";
if (!emailcheck(form.email.value)) msg = msg + "- Valid email addressn";
if (form.message.value == "") msg = msg + "- Messagen";


if (msg!="")
{
alert ("Please complete the following:rn"+msg);
return false;
}
}[/CODE]


Then I would expect that to work. Defintely close your form first then if that doesnt work change the javascript. I havent had chance to check this works or havent had a look at your emailcheck but I think that the closing of the form should work!!

Hope it helps!!!
Copy linkTweet thisAlerts:
@leighchicauthorMay 13.2008 — I have closed my form. hmm...

very strange - code in dreamweaver gives me no errors, but the red lines that usually appear when form is there are not displaying. I have redone it various times.

I tried changes in javascript but that makes no changes.
Copy linkTweet thisAlerts:
@cs3mwMay 13.2008 — Could you email me across the style sheet please so that I can upload it on my test server! I will then be able to do error checking i.e. create an alert box when the form is submitted etc!! Regards

Mike
×

Success!

Help @leighchic spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...