proctk Posted February 9, 2008 Share Posted February 9, 2008 Hi the below code works except I want I'm having a hard time setting the value for "relation". the value of $value is returning family[100]. I only want the word 'family' and drop the key value. any ideas how to do this $except_request = $_POST['relationship']; if(isset($_POST['except_request'])){ if(is_array($except_request)) { foreach($except_request as $key=>$value){ mysql_query ("UPDATE buddylink SET relation ='$value', status='2' WHERE buddylink_id = '$key'")or die("SQL Error:" . mysql_error()); } Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 9, 2008 Share Posted February 9, 2008 Maybe it is just me, but could you explain more and/or rephrase that? Quote Link to comment Share on other sites More sharing options...
monkeypaw201 Posted February 9, 2008 Share Posted February 9, 2008 Maybe it is just me, but could you explain more and/or rephrase that? +1 Quote Link to comment Share on other sites More sharing options...
proctk Posted February 9, 2008 Author Share Posted February 9, 2008 There are two radio buttton on aform and the value will be either friend[] or family[] when I pass the value through my foreach function the key= the value in the [] which is good I want the word before the [] its either family or friend. input type="radio" name="relationship[<?php echo $row_request['buddylink_id']; ?>]" id="relationship" value="friend[<?php echo $row_request['buddylink_id']; ?>]" /> Quote Link to comment Share on other sites More sharing options...
Barand Posted February 9, 2008 Share Posted February 9, 2008 You have the key in the field name. Why put it in the value as well? Quote Link to comment Share on other sites More sharing options...
proctk Posted February 9, 2008 Author Share Posted February 9, 2008 in the mysql table i need to no which people are friends and which are family. the key is used to find the record to change and the work before the key is the value that I want the record. Quote Link to comment 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.