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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.