Jump to content


Photo

HTML/PHP Form


  • Please log in to reply
11 replies to this topic

#1 jared1017

jared1017
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 17 April 2006 - 04:23 PM

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

#2 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 17 April 2006 - 04:44 PM

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
(If something is wrong, please tell me. I'm learning this language. Thank you)

#3 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 17 April 2006 - 07:37 PM

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

#4 jared1017

jared1017
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 17 April 2006 - 09:19 PM

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.)

PASSWORD:

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

CONFIRM:

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


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)

<?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{


#5 jared1017

jared1017
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 19 April 2006 - 08:48 AM

Anything...Anybody???
I'm really trying to hurry and get this done.
site is really in need of this form :P

#6 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 19 April 2006 - 09:33 AM

[!--quoteo(post=366343:date=Apr 19 2006, 03:48 AM:name=jared1017)--][div class=\'quotetop\']QUOTE(jared1017 @ Apr 19 2006, 03:48 AM) View Post[/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
PASSWORD:

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

CONFIRM:

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

Replace With
PASSWORD:

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

CONFIRM:

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

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

Find
if($password!= password2 )

Replace With
if($password != $password2 )


#7 jared1017

jared1017
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 19 April 2006 - 09:39 AM

Does same thing

#8 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 19 April 2006 - 09:45 AM

[!--quoteo(post=366350:date=Apr 19 2006, 04:39 AM:name=jared1017)--][div class=\'quotetop\']QUOTE(jared1017 @ Apr 19 2006, 04:39 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Does same thing
[/quote]

Can I see your updated code?

#9 jared1017

jared1017
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 19 April 2006 - 11:44 AM

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?

#10 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 19 April 2006 - 11:50 AM

Hmm, I think I might know where the problem is..

Find:
if($password != $password2 )

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

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

Dunno :(

#11 jared1017

jared1017
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 19 April 2006 - 12:03 PM

Well, Would you like to see my full updated code?
I can send it to your email or something.


#12 jared1017

jared1017
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 24 April 2006 - 08:45 PM

anything?
-
--
---
anybody?
---
--
-




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users