Try this: <?php $a = "<font id='e9'></font>"; ?> PHP: or if you are doing error messages you can do this <?php $aOpen = "<font id='e9'>"; $aClose = "</font>"; ?> PHP: Then just echo out your message, here is an example. <?php $aOpen = "<font id='e9'>"; $aClose = "</font>"; echo $eOpen . "Here is the information you are echoing out." . $eClose; ?> PHP: I hope i helped.
The is number "<font id='e9'></font>" extract from JS. I want this number = $a so I can $a > 0, $a < 0.......
The is my full code, file t.php. <font id='p7'></font> comes from JS and a number. how to enroll in Mysql number of <font id='p7'></font> <form action="t.php" method="post" id="settingsForm" name="settingsForm"> <input type="hidden" name="special_discount" id="special_discount" value="0" /> <p><label> <input type="radio" name="vip" value="2" id="v" onclick="calcadv" />1 </br> <input type="radio" name="vip" value="3 id="v" onclick="calcadv" />2</br> </label></p> <p><label> <input type="radio" name="week" value="2" id="w" onclick="calcadv" /> 1 </br> <input type="radio" name="week" value="3" id="w" onclick="calcadv" /> 2</br> </label></p> <p><label> Total: <font id='p7'></font> </label></p> <p> <input class="button" type="submit" value="Изпрати" name=saveu /> </p> </form>
Your question is unintelligible. I'll take a stab at it anyway, is this what you're talking about? <?php $html = "<font id='e9'></font>"; preg_match("/<font\sid='.(\d+)'/i", $html, $matches); $a = $matches[1]; // you now have $a to play with.. echo $a; ?> PHP:
Sorry for my bad English. How do I change the code to be recorded in the mysql result of total <form action="t.php" method="post" id="settingsForm" name="settingsForm"> <input type="hidden" name="special_discount" id="special_discount" value="0" /> <p><label> <input type="radio" name="vip" value="2" id="v" onclick="calcadv" />1 </br> <input type="radio" name="vip" value="3 id="v" onclick="calcadv" />2</br> </label></p> <p><label> <input type="radio" name="week" value="2" id="w" onclick="calcadv" /> 1 </br> <input type="radio" name="week" value="3" id="w" onclick="calcadv" /> 2</br> </label></p> <p><label> Total: <font id='p7'></font> //////////// <- this result I want to save in mysql !!!!!!!!!!!!!!!!!!!!! //////////////// </label></p> <p> <input class="button" type="submit" value="Изпрати" name=saveu /> </p> </form>
Ahh, ok. I think I understand now. In order to pass data to the PHP script (and subsequently MySQL), you will either have to create a form and have your JavaScript events change the value of one of the fields (this could even be a hidden field) or create an Ajax call that passes everything to the script. So, here is the example HTML: <form action="t.php" method="post" id="settingsForm" name="settingsForm"> <input type="hidden" name="special_discount" id="special_discount" value="0" /> <p> <label> <input type="radio" name="vip" value="2" id="v" onclick="calcadv()" />1 </br> <input type="radio" name="vip" value="3 id="v" onclick="calcadv()" />2</br> </label> </p> <p> <label> <input type="radio" name="week" value="2" id="w" onclick="calcadv()" /> 1 </br> <input type="radio" name="week" value="3" id="w" onclick="calcadv()" /> 2</br> </label> </p> <p> <label> <!-- This field has been added --> <input type="hidden" name="result" id="result" /> Total: <font id='p7'></font> </label> </p> <p> <input class="button" type="submit" value="Изпрати" name=saveu /> </p> </form> HTML: Now the JavaScript function you use to to calculate the result would also put said result in the hidden field: function calcadv() { // All of your code here... // assuming 'result' is the right variable document.getElementById("result").value = result; } Code (markup): And finally, in PHP you could see this by looking at $_POST['result'].
Not work Can a $ _POST take info from <div or <span ? example <div id='p7' name="result" ></div> $as = $_POST['result']