Jump to content

Archived

This topic is now archived and is closed to further replies.

jared1017

HTML/PHP Form

Recommended Posts

This form is a registration form for a hosting website

there are 3 choices on the plans drop down list

we have a subscription URL setup for each plan

when the form is submitted it goes to the /new/process.php page which shows what they submitted and it refreshes to go to back to the hosting /index.html

I want it to be like when they choose the plan they want once it gets to the process page, the process page will send them to the URL for that plan they chose.

Just need the codes and where to enter them at, I'm guessing I put a code into the value on the drop down menu and code on the process page to call and send them to the URL for the plan they chose? I'm like a super newbie I study up on the PHP Manual every now and then slowly but surely learning.

Also there is spots on the form for
(Password:)
&
(Confirm Password:)

I would like for the form to give a ERROR if they don't have both password fields matching each other.

I was able to setup a error message for not filling in required fields, and if they put in a valid email or not.

Hope to get some help soon, my first time on the forums, this site has really tought me alot of things and I will probably continue using it for all my PHP needs ;)

Thanks


Jared

Share this post


Link to post
Share on other sites
About the password check.. do it with java.. ^~ something like it:

function checkpassw ( form )
{
if (form.field.value != form.field.value2 )
{
stop sending form
focus on password field
}
}

And call it on the form.. maybe like it:

<form ... onsubmit="javascript:checkpassw(me)">

=)

D.Soul

Share this post


Link to post
Share on other sites
or with php

if( $password != password2 ){ echo " passwords do not match";}

the !password is the variable for the first password and the password2 is for the second.. the != means not equal to..

so in words would be if first password not identical to the second.. tell the user...echo

Share this post


Link to post
Share on other sites
Well it sure notices that the passwords are diffrent, but theres 1 problem, it thinks they are diffrent everytime.

heres my form code where the pw are: ( No! its not the full code just the parts that have to do with the pw.)

[code]
PASSWORD:

<input name='$password' title="$password" type="password" class="input1" size="22">

CONFIRM:

<input name='$password2' title="$password2" type="password" class="input1" size="22">
[/code]


heres the rules part of the processing page:(I put all the code that controls the errors its probably something simple, but dont forget I'm still pretty new, mostly learned from tut's)

[code]
<?php
$errors=0;
$error="The following errors occured while processing your form submission.<ul>";
pt_register('POST','Plan');
pt_register('POST','Domain');
pt_register('POST','PaymentMethod');
pt_register('POST','Company');
pt_register('POST','FirstName');
pt_register('POST','LastName');
pt_register('POST','Email');
pt_register('POST','Phone1');
pt_register('POST','Phone2');
pt_register('POST','Phone3');
pt_register('POST','Address');
pt_register('POST','City');
pt_register('POST','State');
pt_register('POST','Zipcode');
pt_register('POST','Country');
pt_register('POST','password');
pt_register('POST','password2');
pt_register('POST','Agree');
if($Plan=="" || $Domain=="" || $PaymentMethod=="" || $FirstName=="" || $LastName=="" || $Email=="" || $Address=="" || $City=="" || $Zipcode=="" || $Country=="" || $Password=="" || $ConfirmPassword=="" || $Agree=="" ){
$errors=1;
$error.="<li>You missed something! You forgot to fill in a requiered field, Go back and fix it.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>You have entered a invalid email. Ya didn't fool nobody, Go back and fix it.";
$errors=1;
}
if($password!= password2 )
$error.="<li>Your passwords do not match, please go back and correct them.";
if($errors==1) echo $error;
else{
[/code]

Share this post


Link to post
Share on other sites
Anything...Anybody???
I'm really trying to hurry and get this done.
site is really in need of this form :P

Share this post


Link to post
Share on other sites
[!--quoteo(post=366343:date=Apr 19 2006, 03:48 AM:name=jared1017)--][div class=\'quotetop\']QUOTE(jared1017 @ Apr 19 2006, 03:48 AM) [snapback]366343[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Anything...Anybody???
I'm really trying to hurry and get this done.
site is really in need of this form :P
[/quote]

--------------------------------------------------------
On the form
--------------------------------------------------------
Find
[code]
PASSWORD:

<input name='$password' title="$password" type="password" class="input1" size="22">

CONFIRM:

<input name='$password2' title="$password2" type="password" class="input1" size="22">
[/code]

Replace With
[code]
PASSWORD:

<input name='password' title="password" type="password" class="input1" size="22">

CONFIRM:

<input name='password2' title="password2" type="password" class="input1" size="22">
[/code]

--------------------------------------------------------
On the processing part
--------------------------------------------------------

Find
[code]
if($password!= password2 )
[/code]

Replace With
[code]
if($password != $password2 )
[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=366350:date=Apr 19 2006, 04:39 AM:name=jared1017)--][div class=\'quotetop\']QUOTE(jared1017 @ Apr 19 2006, 04:39 AM) [snapback]366350[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Does same thing
[/quote]

Can I see your updated code?

Share this post


Link to post
Share on other sites
Sorry I didn't see your edited post

It shows the correct errors when the passwords are incorrect

but when the passwords ARE correct it shows

The following errors occured while processing your form submission.

it doesn't submit

AND for some reason when I try to post my code on here it sends me to a 403 (Forbidden) page not sure why

so is there any other way to show you my code?

Share this post


Link to post
Share on other sites
Hmm, I think I might know where the problem is..

Find:
[code]
if($password != $password2 )
[/code]

Replace with:
[code]
if($_POST['password'] != $_POST['password2'] )
[/code]

Edit - I see you already register the variables higher up..

Dunno :(

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.