Jump to content


Member Since 28 Apr 2013
Offline Last Active May 30 2013 09:13 AM

Posts I've Made

In Topic: foreach() loop for Multidimensional array

30 May 2013 - 09:14 AM

something like:

foreach($food as $k => $v) {
if(isarray($v)) {
foreach($v as $key => $val) {
echo $val;
} else {
echo $v;

That should work for an array like this

$array = (key => val, key2 => val2, key3 => (val 3, val4, val5, val,6))


output : val val2 val3 val4 val5 val6

if yours goes deeper youll have to add extra 'is array' tests. Thats how ive done it previously, probably not the best way but it works :)

In Topic: Validating a Date

17 May 2013 - 05:21 PM

All good suggestions guys, gone with drop downs for now as it seems the most basic way. Here is the code im using to draw the menu:

	<select name="day">
		<?php for ($d=01; $d<=31; $d++) {echo "<option value='$d'>$d</option>";}?>
	<select name="month">
		<?php for ($m=01; $m<=12; $m++) {echo "<option value='$m'>$m</option>";}?>
	<select name="year">
		<?php for ($y=date("Y"); $y>=1970; $y--) {echo "<option value='$y'>$y</option>";}?>

The only issue im having is that the values are coming up as '1, 2, 3, 4' etc etc instead of '01, 02, 03, 04' Is there a way i can force the counter to be at least two digits? I could check values when i process the form but it seems more logical to get this sorted with the actual form values that are submitted.

In Topic: Validating a Date

15 May 2013 - 10:16 AM

been thinking that since i posted.... probably a much better/easier way of doing it!

In Topic: How to post multiple keys to php script?

15 May 2013 - 09:20 AM

if(isset($_POST['<NAME OF SUBMIT BUTTON>'])) {
$userKey = $_POST['key'];
$lic = $_POST['licensekey'];

to see what has been 'sent' to your script use:


if nothing is returned, your sending nothing which is why you have blank space.

In Topic: Checkboxes - Capturing user input, creating an array, and preserving values v...

08 May 2013 - 07:53 AM

You look like you know what youre doing so this should help, found this:



<form action="demo_form.asp">
<input type="checkbox" name="vehicle" value="Bike"> I have a bike<br>
<input type="checkbox" name="vehicle" value="Car" checked> I have a car
<br><input type="submit" value="Submit">


Sorry, totally read that wrong!, you already got this ^^^