Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 2nd, 2006, 8:56 PM   #1
theguy0000
Programmer
 
Join Date: Jul 2005
Posts: 73
Rep Power: 4 theguy0000 is on a distinguished road
cannot get form input...

For some reason, either the form input is not working, or it is not emailing correctly.

here is the html:

<!--

/*************************

*						*

*  Created with RapidPHP *

*	 version 6.1.0.54   *

*						*

*						*

*************************/

-->



<form action="register.php" method="POST">

<table border="0" cellspacing="2" cellpadding="4" width="100%">

<tr><td width="20%" bgcolor="#AAAAAA">Desired username:</td><td bgcolor="#AAAAAA">&nbsp;<input type="text" name="user" width="98%" maxlength="30" /></td></tr>

<tr><td width="20%" bgcolor="#AAAAAA">Desired password:</td><td bgcolor="#AAAAAA">&nbsp;<input type="password" name="pass" width="98%" maxlength="30" /></td></tr>

<tr><td width="20%" bgcolor="#AAAAAA">Password (again):</td><td bgcolor="#AAAAAA">&nbsp;<input type="password" name="pass_conf" width="98%" maxlength="30" /></td></tr>

<tr><td width="20%" bgcolor="#AAAAAA">First Name:</td><td bgcolor="#AAAAAA">&nbsp;<input type="text" name="fname" width="98%" maxlength="30" /></td></tr>

<tr><td width="20%" bgcolor="#AAAAAA">Last Name:</td><td bgcolor="#AAAAAA">&nbsp;<input type="text" name="lname" width="98%" maxlength="30" /></td></tr>

<tr><td width="20%" bgcolor="#AAAAAA">E-Mail address:</td><td bgcolor="#AAAAAA">&nbsp;<input type="text" name="email" width="98%" maxlength="30" />&nbsp;&nbsp;<font size="-1">(You will need to enter a valid e-mail address to continue.)</font></td></tr>

<tr><td width="20%" bgcolor="#AAAAAA">Age:</td><td bgcolor="#AAAAAA">&nbsp;<input type="text" name="age" width="98%" maxlength="30" />&nbsp;&nbsp;<font size="-1">(For legal reasons we cannot offer service to users under the age of 13.)</td></tr>

<tr><td width="20%" bgcolor="#AAAAAA" rowspan="2">Address:</td><td bgcolor="#AAAAAA" rowspan="2">&nbsp;<input type="text" name="adddress1" width="98%" maxlength="30" /><br />&nbsp;<input type="text" name="address2" width="98%" maxlength="30" /></td></tr>

<tr><td></td></tr>

<tr><td colspan="2" align="center"><input type="submit" value="Submit" /></td></tr>

</table>

</form>

and register.php:

[php]<?php

/*************************

* *

* Created with RapidPHP *

* version 6.1.0.54 *

* *

* *

*************************/



unset($user, $pass, $pass_conf, $fname, $lname, $email, $address1, $address2);

$user = $_POST['user'];

$pass = $_POST['pass'];

$pass_conf = $_POST['pass_conf'];

$fname = $_POST['fname'];

$lname = $_POST['lname'];

$email = $_POST['email'];

$address1 = $_POST['address1'];

$address2 = $_POST['address2'];

$address = $_POST['address1'] . "\n" . $_POST['address2'];

$email_from = "noreply@xxxxxxxxxxxxxxxxx.com";

$email_to = "xxxxxxxxxx@xxxxx.com";

$email_msg = "noreply@xxxxxxxxxxxxxxxxx.com\n----------\nDo not respond to this email. Any response sent will not be recieved.\n\nYour message is as follows\n-------------------------\n\n";

$email_subj = "Undaground Hosting: user registration";



If ( $user = "" ||$pass = "" || $pass_conf = "" || $fname = "" || $lname = "" || $email = "" || $address1 = "" || $address2 = "" )

{

Die ("One or more fields were not filled out. Please click <script language=\"javascript\" type=\"text/javascript\">document.write('<a href=\"javascript:history.go(-1)\">here</a>');</script><noscript>your browser's back button</noscript> to fill out the empty fields.");

}



If ( $pass != $pass_conf )

{

Die ("Your password and your confirmation password did not match. Please click <script language=\"javascript\" type=\"text/javascript\">document.write('<a href=\"javascript:history.go(-1)\">here</a>');</script><noscript>your browser's back button</noscript> to correct these passwords, then try again.");

}



$email_msg .= "A new user account has been requested. The user sent the following information about the account:\n";

$email_msg .= "\nUsername:\n".$user."\n";

$email_msg .= "\nPassword:\n".$pass."\n";

$email_msg .= "\nFull Name:\n".$lname.", ".$fname."\n";

$email_msg .= "\nEmail address:\n".$email."\n";

$email_msg .= "\nPostal Address:\n".$address."\n";



mail ($email_to, $email_subj, $email_msg, "From: ".$email_from);



?>
[/php]

and here is the email I recieved:

Quote:
noreply@xxxxxxxxxxxxxxxxx.com
----------
Do not respond to this email. Any response sent will not be recieved.

Your message is as follows
-------------------------

A new user account has been requested. The user sent the following information about the account:

Username:


Password:


Full Name:
,

Email address:


Postal Address:

Something Village, CO 12345
why is it emailing me blank fields?

thanks!
theguy0000 is offline   Reply With Quote
Old Feb 2nd, 2006, 9:22 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
If ( $user = "" ||$pass = "" || $pass_conf = "" || 
$fname = "" || $lname = "" || $email = "" || 
$address1 = "" || $address2 = "" )
This is assigning "" to each variable. I b'leve you prolly meant to use "=="
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 2nd, 2006, 9:25 PM   #3
theguy0000
Programmer
 
Join Date: Jul 2005
Posts: 73
Rep Power: 4 theguy0000 is on a distinguished road
oops that was a bit stupid...

sorry, my php has gotten a little rusty...

thanks man!
theguy0000 is offline   Reply With Quote
Old Feb 2nd, 2006, 9:28 PM   #4
theguy0000
Programmer
 
Join Date: Jul 2005
Posts: 73
Rep Power: 4 theguy0000 is on a distinguished road
wait...now it's telling me that some fileds were not filled out, but I am positive that I filled out everything...
theguy0000 is offline   Reply With Quote
Old Feb 2nd, 2006, 9:35 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Effective debugging requires information. If you don't have a debugger, sprinkle 'echo' or 'print_r' statements through the code to make sure variables are being stuffed with the values you expect. A print_r ($_POST) will tell you if the stuff is arriving. Echoing the values inside the string of "" tests (where the DIE is) will also tell you something. Sometimes you will need to view the source as well as the rendered page.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:24 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC