Search found 8 matches

by gavinandresen
Wed Mar 29, 2006 6:02 pm
Forum: PHP - Code
Topic: submit & remember data
Replies: 4
Views: 442

For a more general way of filling in form fields after a submit, check out my fillInFormValues() function: http://www.onlamp.com/pub/a/php/2006/03/16/autofill-forms.html The same code works for all the different form elements (well, except for file uploads), and will save you a lot of typing. It als...
by gavinandresen
Sun Mar 26, 2006 8:16 pm
Forum: PHP - Code
Topic: Undefined index QUERY_STRING... kind of lost...
Replies: 2
Views: 1003

$_SERVER['QUERY_STRING'] isn't set. You can avoid the error by modifying the code to say:

Code: Select all

if(isset($_SERVER['QUERY_STRING']) and stristr($_SERVER['QUERY_STRING'], $threat)) {
by gavinandresen
Sun Mar 26, 2006 7:20 pm
Forum: PHP - Code
Topic: multiple selection
Replies: 7
Views: 1185

Oh, and you're getting an array_search() error probably because initially $_POST['provdist'] isn't set. If you don't wanna use fillInFormValues(), doing something like this at the top of your php code:

Code: Select all

if (!isset($_POST['provdist'])) { $_POST['provdist'] = array(); }
... should fix the problem.
by gavinandresen
Sun Mar 26, 2006 7:17 pm
Forum: PHP - Code
Topic: multiple selection
Replies: 7
Views: 1185

ademus wrote: Sorry gavin, but i can't see where in your fillInFormValues() function you work with multiple <select>
I modified the long example code to add your multi-valued select:
http://www.skypaint.com/gavin/code/longExample.php

... and I updated the code in the .zip file.
by gavinandresen
Sun Mar 26, 2006 6:12 pm
Forum: PHP - Code
Topic: Sticky radios without form submission?
Replies: 3
Views: 605

Sounds like a job for fillInFormValues(). Get all that PHP code OUT of your form's HTML; see:
http://www.onlamp.com/pub/a/php/2006/03 ... forms.html
by gavinandresen
Sat Mar 25, 2006 7:29 am
Forum: PHP - Code
Topic: multiple selection
Replies: 7
Views: 1185

My fillInFormValues() function Does the Right Thing with multiple <select>. See: http://www.onlamp.com/pub/a/php/2006/03 ... forms.html
by gavinandresen
Wed Mar 22, 2006 6:35 pm
Forum: PHP - Theory and Design
Topic: A new take on forms...
Replies: 10
Views: 3775

Personally, I don't like mixing the validation information in with the form display. In my work the look of the form is generally done by a HTML/CSS expert who knows how to make it all look fancy. And the whole XML -> XSLT -> XHTML thing seems way too complicated and hard to debug (XSLT... shudder.....
by gavinandresen
Tue Mar 21, 2006 8:29 pm
Forum: PHP - Code
Topic: How to refresh PHP page with data in fields without submitti
Replies: 2
Views: 261

I have a PHP page that has input text boxes and dropdown menus. Sometimes, users will input data and realize that one of the dropdown menus does not have the data they need. So they will click on a hyperlink next to the dropdown menu, and add it to the MySQL DB. Well... you could use AJAX, but unle...