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()); } Link to comment https://forums.phpfreaks.com/topic/90164-array-challenge/ 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? Link to comment https://forums.phpfreaks.com/topic/90164-array-challenge/#findComment-462363 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 Link to comment https://forums.phpfreaks.com/topic/90164-array-challenge/#findComment-462364 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']; ?>]" /> Link to comment https://forums.phpfreaks.com/topic/90164-array-challenge/#findComment-462545 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? Link to comment https://forums.phpfreaks.com/topic/90164-array-challenge/#findComment-462556 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. Link to comment https://forums.phpfreaks.com/topic/90164-array-challenge/#findComment-462573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.