Jump to content

array challenge


proctk

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.