Welcome to Dream.In.Code
Become a PHP Expert!

Join 137,420 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,976 people online right now. Registration is fast and FREE... Join Now!




create registration module

 
Reply to this topicStart new topic

create registration module, please help

alecoder
11 Jan, 2008 - 03:30 PM
Post #1

New D.I.C Head
*

Joined: 11 Jan, 2008
Posts: 25


My Contributions
hey all
i have question
then For example we have Form registration I will make summary
CODE

$user_bg = "white";
$user_value = "";

$email_bg = "white";
$email_value = "";
<form action="registration.php" method="post">
<b>Name</b><input type="text" name="user" value="<?php echo $user_value?>">
<b>Email</b><input type="text" name="email" value="<?php echo $email_value?>">
<input type="submit" name="Submit">
</form>


then
I want to make so
only click submit button
if (empty($_POST['name']) || strlen($_POST['user']) < 4) {$user_bg = "red"; } then return input border red
and else {$user_value = $_POST['name'];}
and analogue in email

If did not understand here is see to picture
IPB Image

This post has been edited by Martyr2: 12 Jan, 2008 - 12:59 PM
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Create Registration Module
12 Jan, 2008 - 12:57 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,260



Thanked: 227 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Once you have determined a particular field is invalid, all you need to do is change the style of the control using something like this...

CODE

<input type="text" name="nickname" <?php if (isset($user_bg) && ($user_bg == "red")) { echo "style=\"border: #FF0000 solid 1px;\""; } ?>>


What this is doing is using php inside an input element where it checks to see if the $user_bg is first set and that it is set to "red" (meaning that you had determined it was an error). If these conditions are true, echo a style tag which sets the border to a 1px solid red line.

I hope that makes some sense. Remember you can put php code output anywhere, even in the middle of an input tag.

Good luck!

"At DIC we be red line error detecting code ninjas!" decap.gif

This post has been edited by Martyr2: 12 Jan, 2008 - 12:58 PM
User is offlineProfile CardPM
+Quote Post

alecoder
RE: Create Registration Module
12 Jan, 2008 - 01:12 PM
Post #3

New D.I.C Head
*

Joined: 11 Jan, 2008
Posts: 25


My Contributions
thx man wink2.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/5/08 04:19AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month