TGWSE_GY Posted January 8, 2010 Share Posted January 8, 2010 Ok so here is the link http://hmtotc.com/dev/projects/vrassociates/jeweler_dev/admin/index.php?id=arrange&loc=4 I am wondering if there is a way to have the text field hold a hidden value so I can keep track of the image id so I can manipulate the order of the images once the submit button has been pressed. Maybe I am going about it the wrong way. Thanks Guys Quote Link to comment https://forums.phpfreaks.com/topic/187721-writting-a-script-to-arrange-images-need-some-help/ Share on other sites More sharing options...
TGWSE_GY Posted January 8, 2010 Author Share Posted January 8, 2010 Should I just have a hidden field after each image and text field that has the row ID attached to it and just store all the values for both the text fields and hidden stored in arrays. IE <input type="text" name="orders[]" value="1"><input type="hidden" name="rowids[]"> and then just itterate through the arrays at the same time? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/187721-writting-a-script-to-arrange-images-need-some-help/#findComment-991073 Share on other sites More sharing options...
laffin Posted January 8, 2010 Share Posted January 8, 2010 why not just use the image id as the index of the array? <input type="text" name="orders[image_id]" value="1"> Quote Link to comment https://forums.phpfreaks.com/topic/187721-writting-a-script-to-arrange-images-need-some-help/#findComment-991079 Share on other sites More sharing options...
TGWSE_GY Posted January 8, 2010 Author Share Posted January 8, 2010 HAHAHAHAHAHA Laffin y didnt I think of that brilliant idea, ill give it a go THANKS MAN!!!!!!!!!!!!!!!!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/187721-writting-a-script-to-arrange-images-need-some-help/#findComment-991096 Share on other sites More sharing options...
TGWSE_GY Posted January 8, 2010 Author Share Posted January 8, 2010 ok so <input type="text" name="imgid[23]" value="2" width="5" ></td></tr><tr valign="top"><td><input type="submit" value="Change Image Order"> To access the value of 2 I would need to access imgid[23] to get the value of 2 but how do I grab the index of the array to use that data, as I know you can but I have never used the index of an array other than a pointer location? Quote Link to comment https://forums.phpfreaks.com/topic/187721-writting-a-script-to-arrange-images-need-some-help/#findComment-991103 Share on other sites More sharing options...
laffin Posted January 8, 2010 Share Posted January 8, 2010 u can grab the array keys with $keys=array_keys($array) this gives a new array of the keys but if yer working with code an array element at a time its easier using foreach foreach($array as $key=>$val) { } using foreach is by far very easy to use Quote Link to comment https://forums.phpfreaks.com/topic/187721-writting-a-script-to-arrange-images-need-some-help/#findComment-991110 Share on other sites More sharing options...
TGWSE_GY Posted January 8, 2010 Author Share Posted January 8, 2010 <input type="text" name="orders[image_id]" value="1"> is there a way to get the value assigned as the value of "orders[image_id]" to where image_id key holds value="1" or if I am not mistaken that already happens by putting the name into an array correct? Quote Link to comment https://forums.phpfreaks.com/topic/187721-writting-a-script-to-arrange-images-need-some-help/#findComment-991129 Share on other sites More sharing options...
laffin Posted January 9, 2010 Share Posted January 9, 2010 correct <input type="text" name="orders[image_id]" value="1"> will return as $_POST['orders'][image_id] = 1 Quote Link to comment https://forums.phpfreaks.com/topic/187721-writting-a-script-to-arrange-images-need-some-help/#findComment-991827 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.