473,394 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

user friendly php form processor that includes sticky fields

1
As a web designer with only very rudimentary php skills, I've looked all over for a user friendly php form processor that includes sticky fields. The best match for my needs, php form wizard (http://tools4php.com/form-wizard/), lacks only the sticky field functionality. If useability is a priority, this functionality is essential for long forms with several fields to validate.

I'm partial to this app because I've already created the rather large form.

Any insights would be so much appreciated ... tia

sojo
May 11 '07 #1
2 1992
pbmods
5,821 Expert 4TB
By 'sticky field', I assume you mean that the User's input is saved between page loads (so, for example, he doesn't lose any input if you need to report an error or a validation warning).

Smarty is pretty good at this, but it's probably too late in the app's development cycle to try to start implementing a template system.

It's somewhat difficult with selects and checkboxes, but for text inputs, it's pretty easy to keep track of the value.

First thing you'll probably want to do is save the [VALIDATED!] input to the User's session.

Something like this (I'm pulling relevant code from my frameworks and trying to simplify it for the context; bear with me):
[PHP]
// Set up default values.
if(! isset($_SESSION['REQUEST']))
$_SESSION['REQUEST'] = array(
'flavor' => 'Brownie Batter',
'color' => 'purple',
etc.
);

$blacklist = array(
'PHPSESSID' => true,
'USERNAME' => true,
'PASSWORD' => true,
'LOGOUT' => true
);
// Overwrite $_SESSION['REQUEST'] with NEW values only.
$_SESSION['REQUEST'] = array_merge(
$_SESSION['REQUEST'],
validate(array_diff_key($_REQUEST, $blacklist))
);
[/PHP]

Note that 'validate' is a placeholder; replace it with your favorite validation function or object.

Now that you've got a persistent $_SESSION['REQUEST'], you can output it fairly easily.

[HTML]
<input name="flavor" type="text" value="<?php echo $_SESSION['REQUEST']['flavor']; ?>" />

<select name="color"><?php
foreach($colorSet as $val => $txt)
echo "<option value=\"$val\"" . (($_SESSION['REQUEST']['color'] == $val)
? ' selected="selected"'
: ''
) . ">$txt</option>";
?></select>
[/HTML]

And so forth.
May 11 '07 #2
code green
1,726 Expert 1GB
If you don't want to use sessions. You can bury php inside the HTML tag. i don't like it, but it works OK [PHP]<input type="text" name="mytext"
value="<?if(isset($_POST['mytext'])) echo $_POST['mytext'];?>">[/PHP]
May 11 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: weiwei | last post by:
HI I am having a problem with print friendly function with asp, I have download some code regard with print friendly, it works fine with static html information, however, I have the dynamic pages...
2
by: iam247 | last post by:
Hi I have an ASP form which only includes an option list. The list is dynamically created but includes a default value, which is an instruction "Select a group". The code is shown at bottom....
1
by: meganrobertson22 | last post by:
hi everybody- what is the best way to add data from one form to another? i have 2 tables: person and contract. here are some of the fields. table: person personid (autonumber and primary...
24
by: Rob R. Ainscough | last post by:
VS 2005 I have: ClickOnce deployment User's that hate and or don't want to use an IE Client (don't blame them) I don't see how ASPX web pages are going to survive? With .NET 2.0 and clickonce...
5
by: mabond | last post by:
Hi all This question is one of "theory" rather than a search for the specifics of a solution. I need some pointers as to how to proceed with my project. Here goes. My application allows the...
4
by: google.com | last post by:
Hi there! I've been digging around looking for a sample on how to upload a file without user action. I found the following article covering the area: ...
5
by: Bhujanga | last post by:
I'm trying to design a form with a few key fields on it that will allow the user to enter any portion one or more of those fields (i.e. if they enter "Elm" in the address field, it would match all...
2
by: mgrill | last post by:
I'm trying to create a "user-friendly" data entry form for inventory/despatch purpose in MSAccess2003. The items are classified by Brand...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.