unistake Posted August 22, 2009 Share Posted August 22, 2009 Hi all, I have a bit of a problem getting a code to work. The code I have is part of a calculator which works great in a .html page however when I put it in to echo "the calculator"; the outcome never happens. I suspect I have gone wrong by replacing all the " with ' instead of using \" somewhere along the way. The code I am trying to get working is: <?php echo " <form name='calcform'> <label> <input name='box1' type='text' id='num' value='4'> </label> <label> <input type='radio' name='radio' id='radio' onClick='calculator('qualifier', 'result');'> qualifer </label>"; ?> Thanks Quote Link to comment https://forums.phpfreaks.com/topic/171457-html-form-using-or/ Share on other sites More sharing options...
unistake Posted August 22, 2009 Author Share Posted August 22, 2009 i was trying to edit the above! - just to say that the rest of the code works in PHP just not the above. Quote Link to comment https://forums.phpfreaks.com/topic/171457-html-form-using-or/#findComment-904169 Share on other sites More sharing options...
The Little Guy Posted August 22, 2009 Share Posted August 22, 2009 Try this: <?php echo " <form name='calcform'> <label> <input name='box1' type='text' id='num' value='4'> </label> <label> <input type='radio' name='radio' id='radio' onClick='calculator(\"qualifier\", \"result\");'> qualifer </label>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/171457-html-form-using-or/#findComment-904175 Share on other sites More sharing options...
unistake Posted August 23, 2009 Author Share Posted August 23, 2009 thanks, but that has not solved it! Quote Link to comment https://forums.phpfreaks.com/topic/171457-html-form-using-or/#findComment-904192 Share on other sites More sharing options...
newbtophp Posted August 23, 2009 Share Posted August 23, 2009 Try: <?php echo "<form name='calcform'>\n"; echo "<label>\n"; echo "<input name='box1' type='text' id='num' value='4'>\n"; echo "</label>\n"; echo "<label>\n"; echo "<input type='radio' name='radio' id='radio' onClick='calculator('qualifier', 'result');'>\n"; echo "qualifer\n"; echo "</label>\n"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/171457-html-form-using-or/#findComment-904195 Share on other sites More sharing options...
gergy008 Posted August 23, 2009 Share Posted August 23, 2009 Hi all, I have a bit of a problem getting a code to work. The code I have is part of a calculator which works great in a .html page however when I put it in to echo "the calculator"; the outcome never happens. I suspect I have gone wrong by replacing all the " with ' instead of using \" somewhere along the way. The code I am trying to get working is: <?php echo " <form name='calcform'> <label> <input name='box1' type='text' id='num' value='4'> </label> <label> <input type='radio' name='radio' id='radio' onClick='calculator('qualifier', 'result');'> qualifer </label>"; ?> Thanks *sigh* Here: <?php echo " <form name=\"calcform\"> <label> <input name=\"box1\" type=\"text\" id=\"num\" value=\"4\"> </label> <label> <input type=\"radio\" name=\"radio\" id=\"radio\" onClick=\"calculator(\"qualifier\", \"result\");\"> qualifer </label>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/171457-html-form-using-or/#findComment-904227 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.