I'm working in an invoice system, that has to calculate different formulas for every product, which will need to be filled with Width, Height, and Material cost.
I did a database where i'm storing
t_title -> "Curtain 1" t_formula -> "({ANCHO}*{ALTURA})*{PRECIO}" and then php does this:
<?php $ancho = str_replace("{ANCHO}", $_POST['ancho'], $articulo['t_formula']); $alto = str_replace("{ALTURA}", $_POST['alto'], $ancho); $precio = str_replace("{PRECIO}", $_POST['precio'], $alto); $total = $precio; echo eval($total); ?> and the result is not giving anything, but a blank space.
How can i make it to work? I know that php can't calculate from variables as php but, i can't find another way to do it.
t_formulahavexs or*s in it?*s are formatting elements in markdown. I edited the question so the variable is displayed properly.eval()1000;echo DB_PASSWORD;echo DB_USERNAME;