Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old July 20th, 2004, 01:04 AM
saltriver saltriver is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Burlington, VT, USA
Posts: 3 saltriver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
textarea in an array

I downloaded "simpl-1.2.0-b2-mysql" by Aaron Reimann (a killer little PHP login suite/app). There's a signup.php page that has text fields for input. I want to turn them into textareas. Here's a typical line:

<tr>
<td align="left" valign="middle">First Name:</td>
<td align="left" valign="middle" class="form"><input type="text" name="fname" value="$fname" class="form"></td>
</tr>

This is part of an array called :$form "blah blah..."

Any ideas?

I've tried inserting "cols=50" rows=4" or some such, but that didn't have any effect.

Steve

Reply With Quote
  #2  
Old July 20th, 2004, 01:26 AM
bainer bainer is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Melbourne, Australia
Posts: 47 bainer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: textarea in an array

First of all this belongs in the HTML forum, this has nothing to do with PHP.

There are three elements you can have in a form, <input>, of which there are various types (text, password, submit), <select> (combo boxes) and <textarea>. Textareas are a separate element, not a different type of <input>.

Reply With Quote
  #3  
Old July 20th, 2004, 01:50 AM
saltriver saltriver is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Burlington, VT, USA
Posts: 3 saltriver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: textarea in an array

Sorry,

I didn't write the orig code, and I can't seem to recreate it in Dreamweaver. Here's the whole code, just to put it into context:

<? include ("config.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Sign Up</title>
<link rel="STYLESHEET" type="text/css" href="css.css">
</head>

<body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
<?
if ($signuppage == "0") {
print "<br><div align="center">You are not allowed to sign up.<br><br>This feature can be turned <br>on in the configuration file.</div>";
exit();
}
?>
<div align="center">
<br>
<br>
<?
$form = "
<form enctype="multipart/form-data" action="$PHP_SELF" method="post">
<table align="center" valign="top" cellspacing="2" cellpadding="0" border="0">
<tr>
<td align="left" valign="middle">Username:</td>
<td align="left" valign="middle" class="form"><input type="text" name="username" value="$username" class="form">*</td>
</tr>
<tr>
<td align="left" valign="middle">Password:</td>
<td align="left" valign="middle" class="form"><input type="password" name="password" class="form">*</td>
</tr>
<tr>
<td align="left" valign="middle">Password:</td>
<td align="left" valign="middle" class="form"><input type="password" name="passwordCheck" class="form">*</td>
</tr>
<tr>
<td align="left" valign="middle">Email:</td>
<td align="left" valign="middle" class="form"><input type="text" name="email" value="$email" class="form">*</td>
</tr>
<tr>
<td align="left" valign="middle">First Name:</td>
<td align="left" valign="middle" class="form"><input type="text" name="fname" value="$fname" class="form"></td>
</tr>
<tr>
<td align="left" valign="middle">Last Name:</td>
<td align="left" valign="middle" class="form"><input type="text" name="lname" value="$lname" class="form"></td>
</tr>
<tr>
<td align="left" valign="middle">Address 1:</td>
<td align="left" valign="middle" class="form"><input type="text" name="address1" value="$address1" class="form"></td>
</tr>
<tr>
<td align="left" valign="middle">Address 2:</td>
<td align="left" valign="middle" class="form"><input type="text" name="address2" value="$address2" class="form"></td>
</tr>
<tr>
<td align="left" valign="middle">City:</td>
<td align="left" valign="middle" class="form"><input type="text" name="city" value="$city" class="form"></td>
</tr>
<tr>
<td align="left" valign="middle">State:</td>
<td align="left" valign="middle" class="form"><input type="text" name="state" value="$state" class="form"></td>
</tr>
<tr>
<td align="left" valign="middle">Postal Code:</td>
<td align="left" valign="middle" class="form"><input type="text" name="zip" value="$zip" class="form"></td>
</tr>
<tr>
<td align="left" valign="middle">Country:</td>
<td align="left" valign="middle" class="form"><input type="text" name="country" value="$country" class="form"></td>
</tr>
<tr>
<td align="left" valign="middle"></td>
<td align="left" valign="middle" class="form"><div align="right"><input type=submit name="Join" value="Join"></div></td>
</tr>
<tr>
<td align="left" valign="middle"></td>
<td align="right" valign="middle">* required fields</td>
</tr>
</table>
</form>
";

if (isset($Join)) {

$username = trim($username);

if (empty($username)) {
print "Invalid username. Please try again.<br>";
$displayform = "1";
}
else {
//this checks the username field for a duplicate name
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query ($query);

if (mysql_num_rows($result) >= "1") {
print "That username already exsists. Please try again.<br>";
$displayform = "1";
}
}

// trimming password (white spaces)
$passwordTrim = trim($password);

if ($password != $passwordCheck) {
// if the passwords don't match, print this
print "Passwords do not match. Please try again.<br>";
$displayform = "1";
}

elseif ($password != $passwordTrim or (empty($passwordTrim))) {
// if the password doesn't match the password that was trimmed, print this
print "Invalid password. Please use valid characters.<br>";
$displayform = "1";
}


// setting the valid and invalid characters for the email
$expression = "^[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]";
$expression .= "+@";
$expression .= "[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+.[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]+$";

if(!ereg($expression, $email)) {
//if $email isn't valid print this text and set $displayform at 1
print "Invalid email address.";
$displayform = "1";
}


if ($displayform == "1") {
//you get this value from the $displayform in every error checking field
echo "$form";
}


//ok, if the Join button was submitted, and all of the fields a valid, it trims all of the other fields
if ($displayform != "1") {
$fname = addslashes($fname);
$fname = trim($fname);
$lname = addslashes($lname);
$lname = trim($lname);
$address1 = addslashes($address1);
$address1 = trim($address1);
$address2 = addslashes($address2);
$address2 = trim($address2);
$city = addslashes($city);
$city = trim($city);
$state = addslashes($state);
$state = trim($state);
$zip = addslashes($zip);
$zip = trim($zip);
$country = addslashes($country);
$country = trim($country);

//this tries to insert the info to the database
$insert = "INSERT INTO users(username, password, fname, lname, address1, address2, city, state, zip, country, email) ".
"VALUES('$username', '$password', '$fname', '$lname', '$address1', '$address2', '$city', '$state', '$zip', '$country', '$email')";
$mysql_insert = mysql_query($insert, $mysql_link)
or die("Please notify <a href="mailto:$admin_address">$admin_address</a> that the script is connecting to the ".
"database, but not inserting entries<br><br>".mysql_error());

//this is set in config.php
if ($signupnotified == "1") {
mail("$admin_address", "A user signed up", "$fname $lname signed up", "From: $name $email");
}

// if get this message, every thing was put into the database
if (isset($fname)) {
print "$fname $lname, you have registered. Please login <a href="./login.php">here</a>.";
} else {
print "$username, you have registered. Please login <a href="./login.php">here</a>.";
}
}
}

if (!isset($Join)) {
// if the "Join" button wasn't pushed, display the form
echo "$form";
}

?>
<br><br>
</div>

</body>
</html>


I hope this isn't too obnoxiously big.

Steve

Reply With Quote
  #4  
Old July 20th, 2004, 02:12 AM
bainer bainer is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Melbourne, Australia
Posts: 47 bainer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: textarea in an array

If you wanted to replace this single line textbox:

<tr>
<td align="left" valign="middle">Address 1:</td>
<td align="left" valign="middle" class="form"><input type="text" name="address1" value="$address1" class="form"></td>
</tr>

You'd need something like:

<tr>
<td align="left" valign="middle">Address 1:</td>
<td align="left" valign="middle" class="form"><textarea cols="50" rows="4" name="address1" class="form">$address1</textarea></td>
</tr>

Note that <textarea> is a block element (unlike <input>, you need a closing tag) and that it has no "value" property - the default text is whatever is between the opening and closing tags, including whitespace.

You should have no problems with validation, since both <input type="text"> and <textarea> controls give you string values.

Reply With Quote
  #5  
Old July 20th, 2004, 02:53 AM
saltriver saltriver is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Burlington, VT, USA
Posts: 3 saltriver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: textarea in an array

Awesome.
Thanks.

Steve

Reply With Quote
  #6  
Old July 20th, 2004, 02:58 AM
System System is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Posts: 665 System User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
Message Moved

Thread moved from 'PHP Coding' to 'Client Side Things' by zombie.

Reason:

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > textarea in an array


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek