godrob Posted March 27, 2011 Share Posted March 27, 2011 Hi Guys, Appreciate any help here please... Basically I want to hide some inputs on my registration page and populate them will default values. Everything works okay, apart from the input below: <input type="hidden" name="seek_location" value="Anywhere"> When I use the above, the MYSQL database field for seek_location is left empty... I've noticed that the code below pulls the location into a dropdown list. You know the kind of thing, Australia, UK, USA etc etc: $seek_location = $wcr[$seek_location]; <? $p=0;asort($wcr);reset($wcr); while (list ($p, $val) = each ($wcr)) { echo '<option value="'.$p.'">'.$val; } ?> So, all I want to do is have: <input type="hidden" name="seek_location" value="Anywhere"> Populate seek_location with Anywhere Any help appreciated Thanks Rob Link to comment https://forums.phpfreaks.com/topic/231883-help-with-input-type-hidden/ Share on other sites More sharing options...
Skewled Posted March 27, 2011 Share Posted March 27, 2011 $seek_location = 'Anywhere'; This may simply just drop the whole dynamically created dropdown box and allow Anywhere to pass to the database. BUT I don't have the entire script your working with to clearly see what's going on so this is just my guess. The only issue I could see is if there are checks to see if $seek_location equals a set value before it's passed to the database. Link to comment https://forums.phpfreaks.com/topic/231883-help-with-input-type-hidden/#findComment-1192976 Share on other sites More sharing options...
godrob Posted March 27, 2011 Author Share Posted March 27, 2011 Hi thanks for your reply. I've tried changing the code as per your suggestion, but I'm afraid it sill doesn't populate the database. Any ideas? Thanks for your help Regards Rob. Link to comment https://forums.phpfreaks.com/topic/231883-help-with-input-type-hidden/#findComment-1192996 Share on other sites More sharing options...
godrob Posted March 27, 2011 Author Share Posted March 27, 2011 I fixed it... The variable was actually looking for a number not a string. Entering a 0 returned Anywhere Thanks for your help Rob. Link to comment https://forums.phpfreaks.com/topic/231883-help-with-input-type-hidden/#findComment-1193006 Share on other sites More sharing options...
Skewled Posted March 27, 2011 Share Posted March 27, 2011 No problem Link to comment https://forums.phpfreaks.com/topic/231883-help-with-input-type-hidden/#findComment-1193007 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.