Even more improvements to make code types flexible
[openemr.git] / interface / language / lang_constant.php
blobe085222603ae88f74bd6ec2c652cb8f54ed10c02
1 <?php
2 require_once("language.inc.php");
5 if ($_POST['add']){
6 //validate
7 if ($_POST['constant_name'] == "") {
8 echo htmlspecialchars(xl('Constant name is blank'),ENT_NOQUOTES).'<br>';
9 $err='y';
11 $sql="SELECT * FROM lang_constants WHERE constant_name=? limit 1" ;
12 $res=SqlQuery($sql, array($_POST['constant_name']) );
13 if ( $res ) {
14 echo htmlspecialchars(xl('Data Alike is already in database, please change constant name'),ENT_NOQUOTES).'<br>';
15 $err='y';
17 if ($err=='y'){
18 $val_constant=$_POST['constant_name'];
19 } else {
20 //insert into the main table
21 $sql="INSERT INTO lang_constants SET constant_name=?";
22 SqlStatement($sql, array($_POST['constant_name']) );
24 //insert into the log table - to allow persistant customizations
25 insert_language_log('','',$_POST['constant_name'],'');
27 echo htmlspecialchars(xl('Constant','','',' ') . $_POST['constant_name'] . xl('added','',' '),ENT_NOQUOTES).'<br>';
32 // echo "$sql here ";
37 <TABLE>
38 <FORM name="cons_form" METHOD=POST ACTION="?m=constant" onsubmit="return top.restoreSession()">
39 <TR>
40 <TD><?php echo htmlspecialchars(xl('constant name'),ENT_NOQUOTES); ?></TD>
41 <TD><INPUT TYPE="text" NAME="constant_name" size="100" value="<?php echo htmlspecialchars($val_constant,ENT_QUOTES); ?>"></TD>
42 </TR>
43 <TR>
44 <TD></TD>
45 <TD><INPUT TYPE="submit" name="add" value="<?php echo htmlspecialchars(xl('Add'),ENT_QUOTES); ?>"></TD>
46 </TR>
47 </FORM>
48 </TABLE>
49 <span class="text"><?php echo htmlspecialchars(xl('Please Note: constants are case sensitive and any string is allowed.'),ENT_NOQUOTES); ?></span>