PDA

View Full Version : php ignoring quotes :X


pimpery
03-11-2005, 11:18 PM
$options .= "<option onClick=\"setvals(\"$id\",\"$subject\",\"$msg\");\">".$row['subject']."</option>";

echo $options;

it outputs:
<option onClick="setvals("1,Testing Subject,Wootang Clang. I banged your mom. I banned you from my forum.);>

can anyone tell me why the quotes arent being echoed. this is pissing me off so much. its part of a new hack im making for you guys.

Jolten
03-12-2005, 12:13 AM
$options .= "<option onClick=\"".setvals($id,$subject,$msg);."\">".$row['subject']."</option>";

echo $options;


maybe

why-not
03-12-2005, 12:31 AM
Hi

You have to use single quotes inside the JavaScript function call setvals(), because you cast the onClick value to be enclosed with double quotes!


$options .= "<option onClick=\"setvals('" . $id . "', '" . $subject . "', '" . $msg . "');\">" . $row['subject'] . "</option>";

echo $options;


Sonia

Dean C
03-12-2005, 10:02 AM
Moved to the correct forum, please read the forum descriptions more carefully in future :)