473,666 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

user friendly php form processor that includes sticky fields

1 New Member
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 2005
pbmods
5,821 Recognized Expert Expert
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($_REQU EST, $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($colorS et as $val => $txt)
echo "<option value=\"$val\"" . (($_SESSION['REQUEST']['color'] == $val)
? ' selected="selec ted"'
: ''
) . ">$txt</option>";
?></select>
[/HTML]

And so forth.
May 11 '07 #2
code green
1,726 Recognized Expert Top Contributor
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(iss et($_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
2127
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 and strange things is everything works except I cannt see the result of query from database. anyone has idea, please help me out, thanks in advance. below is the code I have, there are several pages of code and I have
2
2003
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. I want to ensure the user does not submit the form with the default value selected.
1
3544
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 key) ss#
24
1911
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 deployment my app is 427KB (even with modem dialup speed it doesn't take long to download) -- the user gets a very friendly secure WindowsForm app (most of them don't even notice they're not under IE anymore) that performs considerably faster than...
5
1353
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 user to select from menu options. Some of the menus allow the user, via an options form, to select parameters for the display of reports. Those parameters will include things like the date range,
4
9171
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: http://www.motobit.com/tips/detpg_uploadvbaie/ It describes the vba code required to handle a very simple upload form:
5
3623
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 addresses on Elm Street, Elm Drive, etc.), and then upon clicking on a button it will bring up the list of all records that match the criteria. To do this I invoke a query that uses the 'like "*" & & "*"' syntax for each of the fields. The only...
2
1164
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 (1)-----(M)Models(1)------(M)Colors(1)------(M)Sizes(1)-----(M)Shops-----Pieces fields. What is required: set up a (sub)form, where for a given Model's (first) color is being entered, what triggers a subform to enter the different size-sortiment for that color indicating the number of despatched pieces for...
0
8449
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8360
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8876
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8784
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8642
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2774
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.