SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 36 of 36
  1. #26
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JamesKenny View Post
    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.
    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.

  2. #27
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Location
    British Columbia, Canada
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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>

  3. #28
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Location
    Florida
    Posts
    58
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    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;
    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

  4. #29
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JamesKenny View Post
    Thats probably a better statement than "Anything Adobe"
    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:

    Quote Originally Posted by deathshadow60 View Post
    avoid any stupid 'wizards' to make code for you. NEVER works, road to failure.

    ESPECIALLY if it has the name "Adobe" on it.

  5. #30
    SitePoint Enthusiast
    Join Date
    Nov 2011
    Location
    Florida
    Posts
    58
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    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.

  6. #31
    Word Painter silver trophy Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,053
    Mentioned
    142 Post(s)
    Tagged
    2 Thread(s)
    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.
    Linda Jenkinson
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

  7. #32
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Location
    British Columbia, Canada
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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).

  8. #33
    Word Painter silver trophy Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,053
    Mentioned
    142 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Helen W Lee View Post
    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. May have to change my name!
    Linda Jenkinson
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

  9. #34
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Location
    British Columbia, Canada
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops - sorry!

  10. #35
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    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).
    Code:
    $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:
    Code:
    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:

    Code:
    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.

  11. #36
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Location
    British Columbia, Canada
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •