Form built with DW form wizard doesn't work

Thanks for clarifying that. I do plan to check out Aptana and will also check Komodo Edit. I’m finding that I have to work in code view most of the time anyway, when working with the php stuff, so there’s not much benefit to DW in that respect. I’m learning SO much so fast. <LOL> Thanks to the comments about my form problem yesterday (or was that the day before) I’ve rebuilt all the forms (3 or 4) so that they now all work properly without all the extraneous DW coding. In the process, I’m getting a much better grip on how to work with php. Thanks again everyone!

you seem at least somewhat knowledgeable so the good part is once you understand one language the rest become fairly simple as a lot of the syntax across many patforms is similiar in some way or another, its just a matter of remembering the exact syntax, thank god for google huh?

…I sometimes wonder though, with all of the different languages/cms/platforms whatever. Admittedly i do a lot of copy pasting, editing and then refining.
Does that change my job title to “Reverse Engineer” ?

:smiley:

Thanks. I’m no expert but I have been doing basic html stuff since the 90s and did take a programming course (in BASIC) back in the 80s. Trouble with the programming was that I wrote lousy code. Then when I saw what went wrong I found it easy to fix. The same still holds. It would take me a lot less time if I could just write the code correctly in the first place but that doesn’t seem to be the way my brain works. :>)

Absolutely!!

That’s pretty much what mine should be, that’s for sure. Once I get a page that works, I tend to do a Save As to a different name and then tweak, rather than start again from scratch. With the current project, that works perfectly for all the different forms I need to build. :>)

OK Mike - you’ve created a monster here. <G> I’m trying to get a bit fancier with the form I’ve built but for the life of me can’t figure out why I can’t get a radio button value to pass into the database. I have the buttons set up on the html page and they display on the form but no matter which option I click (yes or no at present), nothing goes into the database. Is there some other way the insertion is handled than the way you taught me above (on the separate page using real_escape_string etc.)? Or is there a better way to allow the user to make selections? I’ve been struggling with this for about 4 hours now and can’t figure it out. I’d just like people to be able to choose which of six options they offer.

Thats a bit unfair.

Photoshop keeps getting bulkier, but i dont know of an image editing software that compares, if i had a windows machine I would definately think about getting a new one.

i have had the pleasure of using their flash editor too, not necasarily editing, but creating new animated flash objects with listners, clicking those little keys and typing your little block of code is much easier than trying to learn the entire language(i dread that day).

@Helen are the name and value set?
what are you trying to catch the value with?
<input type=“radio” value=“yes” name=“options” />Yes<br />
<input type=“radio” value=“no” name=“options” />No<br />

Uhm… Photoshop doesn’t “make code for you”, so that doesn’t make any sense… It’s a totally fair assessment of anything Adobe makes that creates code for you or provides code templates as opposed to making code yourself; you might as well be using Frontpage for all the good it does you. From it’s idiotic “lets use javascript to do CSS’ job” to the “What re-re writes php like that” wizards, it’s a laundry list of how NOT to build a website.

… and if you don’t use it’s templates, wizards or the train wreck that is the WYSIWYG, congratulations you just spent the cost of entire computer on a over-glorified copy of notepad with a crippleware FTP client… at which point you could have just downloaded notepad2, editplus, text wranger, etc with a copy of filezilla.

Thanks for your response, JamesKenny. What I was having trouble with (and did finally figure out) was what to put on the insert.php page to get the button values to go into the database. Then once I figured that out I decided that I didn’t like the radio buttons once I had them all done (6 sets so they looked bloody awful <LOL>) so switched to checkboxes instead. I tried to figure out how to do the checkboxes as an array but gave up on that and just inserted the values individually into a field for each checkbox. Probably clunky but it works and at least I figured it out! :>) Then this morning I figured out how to get a field to automatically calculate an expiry date for each record which is 1 year from the date entered. Now at least I have a whole year to try and figure out if it’s possible to have some kind of auto-renewal thingy set up. <LOL>

On the basis of “pride cometh before a fall” I figure I’m going to be in big trouble soon because I’m feeling pretty proud of myself right now. <G>

Thats probably a better statement than “Anything Adobe”

Helen Gratz on the functinality

Their are 2 ways to use checkboxes as an array and the go through them

The standard array:

<input type=“checkbox” name=“boxname” value=“1” />Value 1
<input type=“checkbox” name=“boxname” value=“2” />Value 2
<input type=“checkbox” name=“boxname” value=“3” />Value 3

and then cycle through the array with something like:

foreach($_REQUEST[“boxname”] as $value){
echo $value.“<br />”;
}

and a key value array:
<input type=“checkbox” name=“boxname[sitepoint]” value=“1” />Value 1
<input type=“checkbox” name=“boxname[kicks]” value=“2” />Value 2
<input type=“checkbox” name=“boxname[ass]” value=“3” />Value 3

and the cycle through the key values like this:

foreach($_REQUEST[“boxname”] as $key=>$value){
echo $key.“-”.$value.“<br />”;
}

of course you will have to change the echo part to match your code

Which was based on the paragraph BEFORE IT… Which apparently you didn’t read and just knee-jerk reacted to the short statement all on a line by itself, then quoted it out of context.

NOT to stand around quoting myself:

Seriuosly guy?

I read and understood what you said very well, I guess you missed my input about the flash editor in the response? I have also read your original statement a couple more times and the rest of the thread to. Your overall attitude on the topic added with your comments, Guess what? It still looks like a direct “Discredit” to Adobe altogether.

Oh yeah, I would appreciate not being sent silly little Im’s like that its a bit childish. if I wanted to argue and listen to a bunch of drama I would talk to my wife.

Okay, let’s get this thread out of the personal and keep it on target. If you have something more to add that will help Helen, the OP, the add it. If you don’t, then zip it.

If you have a problem with a post that you feel is offensive, use the flag to report it instead of airing your grievances within this thread.

Thanks for the tutorial on using arrays. That makes MUCH more sense than what I’d been reading and couldn’t get to work. Building the array I can do, no problem; it was the php code I couldn’t figure out. Thanks JamesKenny (and Shypower).

You’re welcome.

“Shypower” I like that. :slight_smile: May have to change my name! :irock:

Oops - sorry!

One thing about that array method, is I would NEVER trust user input for iterating an array blindly for keys. This quite often results in being able to ‘fake’ values you might not want set. That happened in SMF 1.7 where a massive exploit was found in the avatar system because they did that… and you could pass a directory name/key that was supposed to only be set by the program from the form by faking an input/key.

You should consider putting the various fields you will have into an array. The key would be your index, and the value could also be used as the label. This would let you not only verify the form values you are recieving back are in fact indexes you want to have set, but it also means you could use the same array to build your form – that way you don’t have to create your values twice – to add one, you just add it to the array.

For example:

The array of keys, labels and values (checked or unchecked).


$checkBoxList=array(
	'sitepoint' => array(
		'label' => 'SitePoint',
		'checked' => true
	),
	'kicks' => array(
		'label' => 'Kicks all kinds',
		'checked' => false
	),
	'ass' => array(
		'label' => 'of ass!',
		'checked' => false
	)
);

Outputting the form:


foreach ($checkBoxList as $key -> $data) {
	$id='box_'.$key;
	echo '
		<label for="',$id,'">',$data['label'],'</label>
		<input
			type="checkbox"
			name="boxName[',$key,']"
			id="',$id,'"
			',($data['checked'] ? 'checked="checked"' : ''),'
			value="1"
		/>
		<br />';
}

Notice that being these are checkboxes I added the ability to set them checked or unchecked; I used the XML construct for checked, for HTML you would just say “checked” instead of ‘checked=“checked”’ – in either case, the false state is simply to omit it, hence the inline eval.

Then reading it from the form:


foreach ($checkBoxList as $key -> $data) {
	$target='boxname['.$key.']';
	echo $data['label'];
	if (isset($_POST[$target])) {
		echo ' = ',$_POST[$target];
	) else echo ' is not set!';
	echo '<br />';
}

Basic rule – all user input is suspect – as such blindly iterating through a returned array is probably NOT a good idea, especially if you are going to start taking those values and plugging them into a database query… which is typically what a form is for.

Thanks for the detailed information, deathshadow60. Unfortunately it’s all pretty much WAY over my head at the moment but I’ve flagged it for future reference once I’m further up the learning curve. :>) At this point, I don’t even know what the difference is between a regular array and a key value array but I’m sure I’ll figure it out as I go along.