Jump to content

[SOLVED] Last character removed


jmr3460

Recommended Posts

I have created a string from an array. I have inserted commas from my form values. I am trying to remove the last comma from the string and can't seem to remove it. I have tried chop, rtrim, substr, substr_remove, trim and none of them seem to remove the last comma.

$sql_meeting2 = "SELECT * FROM meeting WHERE location_id = '$location_id' ORDER BY day_id";
$result_meeting2 = mysql_query($sql_meeting2) or die(mysql_error());
			while($data_meeting2 = mysql_fetch_array($result_meeting2)){
$day = $data_meeting2['day'];
$times = $data_meeting2['time'];
$open = $data_meeting2['open'];
$format = $data_meeting2['format'];

$format is the string I am trying to rtrim from.

This is my form code

		<td style="padding-left:15px;">
			<input type="checkbox" name="format[]" value="Discussion,">Discussion<br />
			<input type="checkbox" name="format[]" value="Basic Text Study,">Basic Text Study<br />
			<input type="checkbox" name="format[]" value="It Works Study,">It Works Study<br />
			<input type="checkbox" name="format[]" value="IP Study,">IP Study<br />
			<input type="checkbox" name="format[]" value="Topic,">Topic<br />
			<input type="checkbox" name="format[]" value="Candlelight,">Candlelight<br />
			<input type="checkbox" name="format[]" value="Speaker,">Speaker<br />
			<input type="checkbox" name="format[]" value="Birthday,">Birthday<br />
			<input type="checkbox" name="format[]" value="Men,">Men<br />
			<input type="checkbox" name="format[]" value="Women,">Women<br />
			<input type="checkbox" name="format[]" value="Varies,">Varies<br />
			<input type="checkbox" name="format[]" value="Other">Other
			</td></tr>

I have manipulated this form information with this:

$formats = $_POST['format'];
	$format = implode(' ',$formats);

Can anyone help?

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/179587-solved-last-character-removed/
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.