Jump to content

T_STRING error..


croakingtoad

Recommended Posts

I am getting this error-

 

Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/health1/public_html/bedside-manner.php on line 43

 

with this bit of code-

 

35  for ($i = 0; $i < count($array); $i++) {
36
37	//removes characters in $chars from $array items
38	$chars = array(" ", "&", "(", ")", "/");
39	$trim = str_replace ($chars, "", $array[$i]);
40	
41	$message .= "
42		$array[$i]
43			1st		$_POST['$trim-1']
44			2nd		$_POST['$trim-2']
45			3rd		$_POST['$trim-3']
46			
47	";
48	
49	}

 

This is a bit of code I have to try to handle the results of a form submit without having to manually code every var into the phpmail message.  These values are handled the same way in the creation of the form.  Just as an FYI, here's what my form looks like but it is not where I'm having the problem--

 

for ($i = 0; $i < count($array); $i++) {

//removes characters in $chars from $array items
$chars = array(" ", "&", "(", ")", "/");
$trim = str_replace ($chars, "", $array[$i]);

if ($i & 2 != 0) { 
echo "<fieldset>"; } else {
echo "
<fieldset style=\"float: left;\">";	}
echo "
	<legend>$array[$i]</legend>
	<input type=\"text\" name=\"$trim-1\" size=\"30\" /> <label>1st</label> <br />
	<input type=\"text\" name=\"$trim-2\" size=\"30\" /> <label>2nd</label> <br />
	<input type=\"text\" name=\"$trim-3\" size=\"30\" /> <label>3rd</label>
</fieldset>
";
}

 

This form is submitting to itself...

Link to comment
https://forums.phpfreaks.com/topic/57715-t_string-error/
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.