I have a page dynamically filled with content from PHP and databases, the content is loaded into an iframe. Now when I make a custom search, the results are coming out fine on all browsers BUT IE8 (and maybe earlier versions). The browser sorts the results in a new window instead of filling the iframe!
my php search page:
<?php
if (isset($_REQUEST[searchname])) {
$searchname = $_REQUEST[searchname];
if (strlen($searchname) < 3) {
$location = "necrologies_iframe.php?action=tooshort";
header("Location: {$location}");
} else {
$location = "necrologies_iframe.php?action=search&nom={$searchname}";
header("Location: {$location}");
}
}
?>
Is there a way to fill the iframe with results instead of opening a new window?
Edit
The search form/button:
<form id="form1" name="form1" method="get" target="frame" action="http://www.cablevision.qc.ca/fr/code/necrologies_search.php">
<p><strong><a href="javascript:void(0);" onClick="necro_search('est');" >Abitibi-Est</a> | <!--//href="index.php?option=com_content&view=article&id=123&Itemid=146&action=est-->
<a href="javascript:void(0);" onClick="necro_search('ouest');" >Abitibi-Ouest</a> | <!--//href="index.php?option=com_content&view=article&id=123&Itemid=146&action=ouest"-->
<a href="javascript:void(0);" onClick="necro_search('rn');" >Rouyn-Noranda</a> | <!--//href="index.php?option=com_content&view=article&id=123&Itemid=146&action=rn"-->
Témiscamingue <!--//href="index.php?option=com_content&view=article&id=123&Itemid=146&action=temis"-->
</strong> |
<input name="searchname" type="text" id="searchname" value=<?php if (isset($_REQUEST[nom])) { echo '"' . $_REQUEST[nom] . '"'; } else { echo '"rechercher les archives"'; } ?> size="25" />
<input type="submit" name="submit" id="submit" value="Rechercher" />
The iframe part of the page
<iframe id="frame" "width="638px" frameborder="0" src="code/necrologies_iframe.php" scrolling="yes" horizontalscrolling="no" verticalscrolling="yes"></iframe>
the iframe page code
<style type="text/css">
<!--
table
{
line-height: 135%;
font-family: Arial, Helvetica, sans-serif;
font-size:13px;
}
.border {
border: 1px solid #000000;
}
.borderbas {
border-bottom: 1px solid #000000;
}
.padding {
padding: 5px;
}
-->
</style>
<?php
// fichier de connection a la DB
require_once("includes/connection.php");
require_once("includes/functions.php");
?>
<?php
$action = $_REQUEST[action];
$datedujour = date("Y-m-d");
switch ($action) {
case "search":
$searchname = utf8_decode(mysql_prep($_REQUEST[nom]));
$necroresult = mysql_query("SELECT * FROM necrologies WHERE nom LIKE '%{$searchname}%' AND approuve = '1' ORDER BY id DESC ");
if (mysql_affected_rows() == 0) {
// message que je fais afficher si il ne trouve rien (au lieu d'une page blanche qui ne veux rien dire
$message = "<br /><br /><br /><br /><h3>Aucun résultat trouvé </h3><br>Veuillez modifier le nom de la recherche...<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />";
} else {
// sinon on affiche le nombre de resultats trouvés
$necro_num_rows = mysql_num_rows($necroresult);
$message = $necro_num_rows . " résultat(s) trouvés...";
$affiche_liste = 1;
}
break;
case "tooshort":
echo "<br><br><center>Recherche trop courte, veuillez entrer plus de 4 caractères...</center><br><br><br><br><br><br><br><br><br><br><br><br><br>";
break;
case "est":
case "ouest":
case "rn":
case "temis":
$affiche_liste = 1; // pour faire afficher la liste des necro
$necroresult = mysql_query("SELECT * FROM necrologies WHERE datefin > '{$datedujour}' AND approuve = '1' AND region = '{$action}' ORDER BY id DESC ");
break;
default:
// default on vois toutes les necro de toute les regions
$necroresult = mysql_query("SELECT * FROM
necrologies WHERE datefin > '{$datedujour}' AND approuve = '1'
ORDER BY id DESC ");
$affiche_liste = 1;
}
?>
<br />
<?php
// affichage du message
if (isset($message)) {
echo "<br><strong><center>" . $message . "</strong></center><br>";
}
// liste des necro dans des tables
if ($affiche_liste == 1 || !isset($_REQUEST[action])) {
while ($row = mysql_fetch_array($necroresult)) {
?>
<!-- Debut de la table fancy round corner -->
<div align="center">
<table border="0" align="left" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td width="16"><img src="/fr/images/roundtable/top_lef.gif" width="16" height="16"></td>
<td height="16" background="/fr/images/roundtable/top_mid.gif"><img src="/fr/images/roundtable/top_mid.gif" width="16" height="16"></td>
<td width="24"><img src="/fr/images/roundtable/top_rig.gif" width="24" height="16"></td>
</tr>
<tr>
<td width="16" background="/fr/images/roundtable/cen_lef.gif"><img src="/fr/images/roundtable/cen_lef.gif" width="16" height="11"></td>
<td align="center" valign="middle" bgcolor="#FFFFFF">
<!-- Debut du content de la table fancy round corner -->
<table width="576" border="0" cellspacing="0" cellpadding="0" class="border" >
<tr >
<td rowspan="2" valign="top"><img src="/fr/images/necrologies/<?php echo utf8_encode($row['photo']); ?>" alt="photo" /><br><img src="/fr/images/cnq/imprimable.gif" border="0" width="150" height="50"></td>
<td width="200" bgcolor="#DFEFFF" class="borderbas" style="border-left: 1px solid #000000; border-right: 1px solid #000000"><center><?php echo nl2br(mb_convert_encoding($row['nom'], "UTF-8", "Windows-1252")); ?></center></td>
<td bgcolor="#DFEFFF" class="borderbas">
<center>
<strong>
<?php
$maison = $row[maison];
if ($maison == "N/D") {
echo "(information non disponible)";
} else {
if (substr($maison, 0, 6) == "La dir") {
echo utf8_encode($maison);
} else {
echo "La direction des funérailles a été confiée à/aux <br>";
echo utf8_encode($maison);
}
}
?>
</strong></center></td>
</tr>
<tr>
<td style="border-left: 1px solid #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;" colspan="2"><div class="padding" align="left"><?php echo nl2br(mb_convert_encoding($row['description'], "UTF-8", "Windows-1252")); ?></div></td>
</tr>
</table>
<!-- Fin du content de la table fancy round corner -->
</td>
<td width="24" background="/fr/images/roundtable/cen_rig.gif"><img src="/fr/images/roundtable/cen_rig.gif" width="24" height="11"></td>
</tr>
<tr>
<td width="16" height="16"><img src="/fr/images/roundtable/bot_lef.gif" width="16" height="16"></td>
<td height="16" background="/fr/images/roundtable/bot_mid.gif"><img src="/fr/images/roundtable/bot_mid.gif" width="16" height="16"></td>
<td width="24" height="16"><img src="/fr/images/roundtable/bot_rig.gif" width="24" height="16"></td>
</tr>
</table>
</div>
<!-- Fin de la table fancy round corner -->
<!--[if IE 8]>
<style type="text/css">
.tb{
float:left;
align:left;
width:550px;
scrolling-horizontal:none;
}
</style>
<![endif]-->
<!--[if IE 7]>
<style type="text/css">
.tb{
float:left;
align:left;
width:550px;
scrolling-horizontal:none;
}
</style>
<![endif]-->
<!--[if IE 6]>
<style type="text/css">
.tb{
float:left;
align:left;
width:550px;
scrolling-horizontal:none;
}
</style>
<![endif]-->
<br /><br />
<?php
}
}
?>
<?php
// close la connection
mysql_close($connection);
?>
Targets should be named frames or windows; older browsers do not use a frame's ID. So change:
<iframe id="frame" ...
To
<iframe name="frame" id="frame" ...
Related
I know that I need to change to MySQLi !
The problem here is: in some browsers it doesn't post after submitting, like in Chrome, Opera, Mozilla but it works and it post after submitting from Internet Explorer and Microsoft Edge.
At the beginning it worked with no problems in all browsers.
Live website link: Check out here !
To TEST it you should post only links like this: steam://joinlobby/730/109775244931424928/76561198819667596
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-118227878-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-118227878-1');
</script>
<meta name="description" content="THE BEST CS:GO DERANK LOBBY FINDER SERVICE">
<meta name="keywords" content="CSGO, CS:GO, COUNTER-STRIKE:GLOBAL OFFENSIVE, DERANK, STEAM, LOBBY, FINDER, LOBBIES, DERANK LOBBIES, ROAD TO SILVER, DERANKING, FALLING RANKS">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel='shortcut icon' href='https://www.xeongameshop.com/img/newXEONlogo.png' type='image/x-icon' />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
.styled-select select {
background: #222222;
color: white;
width: 200px;
padding: 5px;
font-size: 16px;
line-height: 1;
border: 1px solid;
border-radius: 3px;
height: 44px;
font-family:"Trebuchet MS", Helvetica, sans-serif;
}
</style>
<style>
input[type=url] {
padding: 12px 20px;
background-color: #222222;
color: #FFFFFF;
margin: 8px 0;
box-sizing: border-box;
border: 1px solid;
border-radius: 5px;
outline: none;
}
input[type=url]:focus {
background-color: #222222;
}
</style>
<style>
::placeholder {
color: #FFFFFF;
opacity: 1; /* Firefox */
}
:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: #FFFFFF;
}
::-ms-input-placeholder { /* Microsoft Edge */
color: #FFFFFF;
}
</style>
<style>
.inputFont{
font-family:"Courier New", Courier, monospace;
}
</style>
<title>XEON™ CS:GO DERANK</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor/perfect-scrollbar/perfect-scrollbar.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!--===============================================================================================-->
</head>
<body background="BG005.jpeg">
<script type="text/javascript">
//auto expand textarea
function adjust_textarea(h) {
h.style.height = "20px";
h.style.height = (h.scrollHeight)+"px";
}
</script>
<br/>
<br/>
<center>
<img src="XEONLogo.png"/>
</center>
<div align="center">
<form action="index.php" method="post">
<table style="width:10%" border="0" cellspacing="8" cellpadding="0" >
<tr>
<td><input class="inputFont" pattern="steam?://.+" placeholder="steam://joinlobby/730/" type="url" name="lobby" size="58"></td>
<td><input type="image" src="post.png" alt="Submit Form" value="SUBMIT" name="submit" /></td>
</tr>
</table>
<table style="width:10%" border="0" cellspacing="8" cellpadding="0" >
<tr>
<td class="styled-select">
<select required name="Location">
<option value="U.S.A.">U.S.A.</option>
<option value="Europe">Europe</option>
<option value="Brazil">Brazil</option>
<option value="Russia">Russia</option>
<option value="Asia">Asia</option>
<option value="Australia">Australia</option>
</select>
</td>
<td class="styled-select">
<select required name="ranks">
<option value="Any rank">Any rank</option>
<option value="Silver ONLY">Silver ONLY</option>
<option value="Gold Nova and below">Gold Nova and below</option>
<option value="Master Guardian and below">Master Guardian and below</option>
<option value="Global and below">Global and below</option>
</select>
</td>
<td class="styled-select">
<select required name="playstyle">
<option value="AFK ONLY">AFK ONLY</option>
<option value="NO AFK">NO AFK</option>
<option value="AFK and NO AFK">AFK and NO AFK</option>
<option value="MOLOTOV TACTICS">MOLOTOV TACTICS</option>
</select>
</td>
<td class="styled-select">
<select required name="rounds">
<option value="WIN 3 rounds">WIN 3 rounds</option>
<option value="NO 3 rounds">NO 3 rounds</option>
</select>
</td>
<td class="styled-select">
<select required name="players">
<option value="Need 1 player">Need 1 player</option>
<option value="Need 2 players">Need 2 players</option>
<option value="Need 3 players">Need 3 players</option>
<option value="Need 4 players">Need 4 players</option>
</select>
</td>
</tr>
</table>
</form>
</div>
<br/>
<div align="center">
<b>
<a href="AFK.rar">
<font style="font-family:Trebuchet MS, Helvetica, sans-serif;" color="#E56717">
(Download AFK.CFG)
</font>
</a>
<font face = "Times New Roman" color="white">
- UNRAR and put the AFK.cfg file into your
</font>
<font style="font-family:Trebuchet MS, Helvetica, sans-serif;" color="white">
( C:\Program Files\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg )
</font>
<br/>
<font face = "Times New Roman" color = "white">
To run the config in CS:GO write in the console
<font style="font-family:Trebuchet MS, Helvetica, sans-serif;" color="#E56717">
exec AFK.cfg
</font>
</font>
<br/>
<font face = "Times New Roman" color="white">
To turn
</font>
<font style="font-family:Trebuchet MS, Helvetica, sans-serif;" color="#E56717">
(ON / OFF)
</font>
<font face = "Times New Roman" color="white">
the AFK MODE just type in the console
<font style="font-family:Trebuchet MS, Helvetica, sans-serif;" color="#E56717">
(afk)
</font>
</font>
</b>
</div>
<br/>
<?php
mysql_connect("sql.domain.com", "user05755", "pass");
mysql_select_db("user05755");
$dbLink = mysql_connect("sql.domain.com", "user05755", "pass");
mysql_query("SET character_set_client=utf8", $dbLink);
mysql_query("SET character_set_connection=utf8", $dbLink);
function time_elapsed_string($datetime, $full = false) {
$now = new DateTime;
$ago = new DateTime($datetime);
$diff = $now->diff($ago);
$diff->w = floor($diff->d / 7);
$diff->d -= $diff->w * 7;
$string = array(
'y' => 'year',
'm' => 'month',
'w' => 'week',
'd' => 'day',
'h' => 'hour',
'i' => 'minute',
's' => 'second',
);
foreach ($string as $k => &$v) {
if ($diff->$k) {
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
} else {
unset($string[$k]);
}
}
if (!$full) $string = array_slice($string, 0, 1);
return $string ? implode(', ', $string) . ' ago' : 'just now';
}
function cleanInput($input) {
$search = array(
'#<script[^>]*?>.*?</script>#si', // Strip out javascript
'#<[\/\!]*?[^<>]*?>#si', // Strip out HTML tags
'#<style[^>]*?>.*?</style>#siU', // Strip style tags properly
'#<![\s\S]*?--[ \t\n\r]*>#' // Strip multi-line comments
);
$output = preg_replace($search, '', $input);
return $output;
}
function sanitize($input) {
if (is_array($input)) {
foreach($input as $var=>$val) {
$output[$var] = sanitize($val);
}
}
else {
if (get_magic_quotes_gpc()) {
$input = stripslashes($input);
}
$input = cleanInput($input);
$output = mysql_real_escape_string($input);
}
return $output;
}
$lobby = sanitize($_POST['lobby']);
$Location = sanitize($_POST['Location']);
$ranks = sanitize($_POST['ranks']);
$playstyle = sanitize($_POST['playstyle']);
$rounds = sanitize($_POST['rounds']);
$players = sanitize($_POST['players']);
$submit = sanitize($_POST['submit']);
if($submit) {
$timestamp = date('d/m/Y H:i:s');
if(
$lobby &&
$Location &&
$ranks &&
$playstyle &&
$rounds &&
$players &&
$timestamp
) {
$insert=mysql_query("INSERT INTO derank (lobby,Location,ranks,playstyle,rounds,players,timestamp) VALUES ('$lobby','$Location','$ranks','$playstyle','$rounds','$players','$timestamp') ");
echo "<meta HTTP-EQUIV='REFRESH' content='0; url=index.php'>";
}
}
?>
<?php
$dbLink = mysql_connect("sql.domain.com", "user05755", "pass");
mysql_query("SET character_set_results=utf8", $dbLink);
mb_language('uni');
mb_internal_encoding('UTF-8');
$getquery=mysql_query("SELECT * FROM `derank` WHERE id > (SELECT MAX(id) AS mID FROM `derank`)-5 ORDER BY id DESC");
$counter=mysql_query("SELECT * FROM `derank`");
$num_rows=mysql_num_rows ( $counter);
if($num_rows > 5){
$delete=mysql_query("DELETE FROM derank ORDER BY id ASC LIMIT 1");
}
?>
<div>
<div align='center' >
<div class='wrap-table100'>
<div class='table100 ver3 m-b-110'>
<div class='table100-head'>
<table>
<thead>
<tr class='row100 head'>
<th class="cell100 column1">Posted</th>
<th class="cell100 column8">Location</th>
<th class="cell100 column2">Ranks</th>
<th class="cell100 column3">Playstyle</th>
<th class="cell100 column4">Rounds</th>
<th class="cell100 column5">Players</th>
<th class="cell100 column6">Join Lobby</th>
<th class="cell100 column7"> </th>
</tr>
</thead>
</table>
</div>
<div class='table100-body js-pscroll'>
<table>
<tbody>
<?php
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_assoc($getquery))
{
// Print out the contents of each row into a table
echo '<tr class="row100 body">';
echo '<td style="font-family:Trebuchet MS, Helvetica, sans-serif;" class="cell100 column1">';
$date = DateTime::createFromFormat('d/m/Y H:i:s', $row['timestamp']);
echo time_elapsed_string($date->format('Y-m-d H:i:s'));
echo '</td>';
echo '<td style="font-family:Trebuchet MS, Helvetica, sans-serif;" class="cell100 column8">';
echo "<span style='width:1em'><img style='margin-right:1em' src='".$row['Location'].".png'/></span>";
echo $row['Location'];
echo '</td>';
echo '<td style="font-family:Trebuchet MS, Helvetica, sans-serif;" class="cell100 column2">';
echo $row['ranks'];
echo '</td>';
echo '<td style="font-family:Trebuchet MS, Helvetica, sans-serif;" class="cell100 column3">';
echo $row['playstyle'];
echo '</td>';
echo '<td style="font-family:Trebuchet MS, Helvetica, sans-serif;" class="cell100 column4">';
echo $row['rounds'];
echo '</td>';
echo '<td style="font-family:Trebuchet MS, Helvetica, sans-serif;" class="cell100 column5">';
echo $row['players'];
echo '</td>';
echo '<td style="font-family:Trebuchet MS, Helvetica, sans-serif;" class="cell100 column6">';
echo '<a href="'.$row[lobby].'">';
echo '<img src="JOIN.png"/>';
echo '</a>';
echo '</td>';
echo '<td class="cell100 column7"> </td>';
echo "</tr>";
echo "</tbody>";
}
echo "</table>";
echo '
</div>
</div>
</div>
</div>
</div>
';
?>
<!--===============================================================================================-->
<script src="vendor/jquery/jquery-3.2.1.min.js"></script>
<!--===============================================================================================-->
<script src="vendor/bootstrap/js/popper.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<!--===============================================================================================-->
<script src="vendor/select2/select2.min.js"></script>
<!--===============================================================================================-->
<script src="vendor/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<script>
$('.js-pscroll').each(function(){
var ps = new PerfectScrollbar(this);
$(window).on('resize', function(){
ps.update();
})
});
</script>
<!--===============================================================================================-->
<script src="js/main.js"></script>
<center><font style="font-family:Trebuchet MS, Helvetica, sans-serif;" color="#FFFFFF">2015-<?php echo date("Y"); ?> XEONGameShop</font><font color = "white">™</font></center>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
</body>
</html>
I'm writting a page which has a 'Personal Notes' section using textarea. When I click at 'Save' it actually saves the content to an SQL server but then it displays the old notes information at textarea. What I need it to update the textarea whit the new information after submit.
Here is the code:
<?php
$userlevel = mysqli_query($db,"SELECT level FROM users WHERE username = '$user_check'");
$ar = mysqli_fetch_assoc($userlevel);
if ($ar['level'] == '0')
{
$level = "Utilizador";
}
else
{
$level = "Administrador";
}
if($_SERVER["REQUEST_METHOD"] == "POST") {
$savenotes = mysqli_real_escape_string($db,$_POST['notes']);
mysqli_query($db,"UPDATE users SET notes = '$savenotes' WHERE username = '$username'");
$msg = "Notas pessoais guardadas no servidor.";
}
?>
<div style = "margin:30px">
<ul>
<li><a class="active" onClick="location.href='main.php?action=home'">Home</a></li>
<li><a onClick="location.href='main.php?action=servers'">Servidores</a></li>
<li><a onClick="location.href='main.php?action=users'">Utilizadores</a></li>
<li><a onClick="location.href='main.php?action=account'">Minha Conta</a></li>
<li style="float:right"><a onClick="location.href='logout.php'">Sair</a></li>
<li style="float:right"><a><b>Acesso:</b> <font color=red><?php echo $level; ?></font></a></li>
</ul>
<br><br>
<font size=5><b>Bem-vindo, <?php echo utf8_encode($login_session); ?><br /></b></font><br />
Por favor escolha uma das opções do painel para gerir este servidor. Pode adicionar/remover/alterar servidores de jogo e voz bem como utilizadores deste painel.<br />
Qualquer bug ou sugestão contactar mail#mail.com.<br /><br />
Notas Pessoais:<br />
<form action = "" method = "post">
<textarea rows="4" cols="50" type ="text" name ="notes" style="border-radius: 4px; border: solid 1px light-gray; box-shadow: inset 1px 1px 1px 0 #009AFC0; transition: box-shadow 0.3s;";/><?php echo htmlentities($notes);?></textarea><br /><br />
<button class="button" type = "submit" style="vertical-align:middle; width:100px;"><span>Gravar </span></button><br />
</form>
<div style = "font-size:11px; color:#cc0000; margin-top:10px"><?php echo $msg; ?></div>
</div>
Thank you in advance!
You should load $notes after insert.
Right now it's not clear where you load it, but it should be loaded after insert.
I need to do a simple script with two parts. First one is sending just name, phone number etc. and works perfectly already:
But after it i need to send a checklist to the same email, but still is nothing there.
My html:
<form action="contact.php" method="post" id="form" class="contact-form">
<table style="color: DEB441; font-size: 19px; margin-left: 60px; margin-top: 40px; float: left;">
<tr>
<td><font color="FFFFFF">Imie:</td>
<td style="padding:0px">
<textarea style="outline-color: DEB441; margin-left: 23px; margin-bottom: 5px; overflow:auto;width:269px;height:15px;border:1px solid #DEB441;background:#fff;padding:3px 5px;color:#3D1E09;font:14px;font-style:italic;margin:0" name="cf_imie" rows="2" cols="20"></textarea>
</td>
</tr>
<tr>
<td><font color="FFFFFF">Nazwisko:</td>
<td style="padding:0px">
<textarea style="outline-color: DEB441; margin-left: 23px; margin-bottom: 5px; overflow:auto;width:269px;height:15px;border:1px solid #DEB441;background:#fff;padding:3px 5px;color:#3D1E09;font:14px;font-style:italic;margin:0" name="cf_nazwisko" rows="2" cols="20"></textarea>
</td>
</tr>
<tr>
<td><font color="FFFFFF">Adres:</td>
<td style="padding:0px">
<textarea style="outline-color: DEB441; margin-left: 23px; margin-bottom: 5px; overflow:auto;width:269px;height:15px;border:1px solid #DEB441;background:#fff;padding:3px 5px;color:#3D1E09;font:14px;font-style:italic;margin:0" name="cf_adres" rows="2" cols="20"></textarea>
</td>
</tr>
<tr>
<td><font color="FFFFFF">Telefon</td>
<td style="padding:0px">
<textarea style="outline-color: DEB441; margin-left: 23px; margin-bottom: 5px; overflow:auto;width:269px;height:15px;border:1px solid #DEB441;background:#fff;padding:3px 5px;color:#3D1E09;font:14px;font-style:italic;margin:0" name="cf_telefon" rows="2" cols="20"></textarea>
</td>
</tr>
<tr>
<td><font color="FFFFFF">E-mail:</td>
<td style="padding:0px">
<textarea style="outline-color: FFFFFF; margin-left: 23px; margin-bottom: 5px; overflow:auto;width:269px;height:15px;border:1px solid #DEB441;background:#fff;padding:3px 5px;color:#3D1E09;font:14px;font-style:italic;margin:0" name="cf_email" rows="2" cols="20"></textarea>
</td>
</tr>
<tr>
<td style="width: 150px;">
<p style="align: left; margin-top: 2px; margin-right: 10px;"><br>
<font style="font-size: 16px;" color="#FFFFFF" align="left">
Wybierz produkty:<br><br>
<font style="font-size: 12px;" color="#FFFFFF" align="left">
Herbatniki w pudelkach <br>
<hr align="left" width="110px"><bt>
<input type="checkbox" name="thenderese" value="thenderese" />Thenderese<br>
<input type="checkbox" name="petipa" value="petipa" />Petipa<br>
<input type="checkbox" name="biscripts" value="biscripts" />Biscripts<br>
</p>
</td>
<td style="width: 150px;">
<p style="width: 250px; align: left;"><br>
<font style="font-size: 12px;" color="#FFFFFF" align="left">
Herbatniki Pakowane pojedynczo<br>
<hr align="left" width="160px">
<input type="checkbox" name="6g" value="g6g" />6g
<input type="checkbox" name="150g" value="g150g" />150g
<input type="checkbox" name="300g" value="g300g" />300g
</p>
</td>
</tr>
<tr>
<td style="width: 200px; margin-right: 250px;">
<p align="left" style="align: left; margin-top:0px;"><br>
<font style="font-size: 12px;" color="#FFFFFF" align="left">
Inne
<hr align="left" width="150px">
<input type="checkbox" name="folia" value="folia">Biscripts opakowane w folie<br>
<input type="checkbox" name="speculoos1" value="speculoos1" />1,5 kg (proszek speculoos)<br>
<input type="checkbox" name="speculoos2" value="speculoos2" />1,1 kg (pokruszony speculoos)<br>
<input type="checkbox" name="krem" value="krem biscripts" />krem biscripts<br>
</p>
</td>
</tr>
</table>
</form>
and my PHP
<?php
$field_imie = $_POST['cf_imie'];
$field_nazwisko = $_POST['cf_nazwisko'];
$field_adres = $_POST['cf_adres'];
$field_telefon = $_POST['cf_telefon'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = 'serwis#reskomp.pl';
$subject = 'nowe zamowienie '.$field_imie;
$body_message = 'Od: '.$field_imie."\n";
$body_message .= 'Nazwisko: '.$field_nazwisko."\n";
$body_message .= 'Adres: '.$field_adres."\n";
$body_message .= 'Telefon: '.$field_telefon."\n";
$body_message .= 'Email: '.$field_email."\n";
$body_message .= 'Szczegoly zamowienia: '.$field_message;
$thenderese = $_POST['thenderese'];
if ($thenderese != 'Yes') {
$thenderese = 'No';
}
$petipa = $_POST['petipa'];
if ($petipa != 'Yes') {
$petipa = 'No';
}
$biscripts = $_POST['biscripts'];
if ($biscripts != 'Yes') {
$biscripts = 'No';
}
$g6g = $_POST['6g'];
if ($g6g != 'Yes') {
$g6g = 'No';
}
$g150g = $_POST['150g'];
if ($g150g != 'Yes') {
$g150g = 'No';
}
$g300g = $_POST['300g'];
if ($g300g != 'Yes') {
$g300g = 'No';
}
$folia = $_POST['folia'];
if ($folia != 'Yes') {
$folia = 'No';
}
$speculoos1 = $_POST['speculoos1'];
if ($speculoos1 != 'Yes') {
$speculoos1 = 'No';
}
$speculoos2 = $_POST['speculoos2'];
if ($speculoos2 != 'Yes') {
$speculoos2 = 'No';
}
$krem = $_POST['krem'];
if ($krem != 'Yes') {
$krem = 'No';
}
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Zamowienie zostalo przyjete do realizacji.');
window.location = '../herbatniki/index.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Blad wysylania wiadomosci. Prosimy o kontakt na adres: coo.maan#gmail.com');
window.location = 'Contacts.html';
</script>
<?php
}
?>
If somebody could help me...
I know that i should use more css, but this is not the reason.
It looks like you have no way to submit your form.
Further, to add your checkbox data to your email message, you can use something like the following.
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
var_dump($_POST);
$message = '';
$message .= sprintf("Name: %s\n", isset($_POST['name']) ? $_POST['name'] : '');
$message .= sprintf("Foo wanted: %s\n", isset($_POST['foo']) ? 'Yes' : 'No');
$message .= sprintf("Bar wanted: %s\n", isset($_POST['bar']) ? 'Yes' : 'No');
var_dump($message);
}
?>
<form method="POST">
Your Name:<input type="text" name="name" /><br />
<input type="checkbox" name="foo" />You want Foo?<br />
<input type="checkbox" name="bar" />You want Bar?<br />
<input type="submit">
</form>
However please research 'email injection in php'.
You need to add the content to $body_message.
Change
$thenderese = $_POST['thenderese'];
if ($thenderese != 'Yes') {
$thenderese = 'No';
}
to
$thenderese = $_POST['thenderese'];
$body_message .= 'thenderese';
if ($thenderese != 'Yes') {
$body_message .= 'No';
}
else {
$body_message .= 'Yes';
}
$body_message .= '/n';
and continue for the rest of your if statements.
I hav run into a problem - I am not that familiar with cakephp - but I have taken over a project (A webshop project) - and now I have a bit of a problem - I have a field (tracking id for the package) which writes to DB - that works great - but here is the trouble - when I click the button and save the tracking number to the DB - I wan't the system to send an email to the customer with the tracking id.
I can get the system to send a mail - but there is no tracking number on so I guess the email is send before the DB i updated.
Hope someone can point me in the right direction
public function send($order_id = null, $is_resolved = true)
{
if($this->request->is('post'))
{
$this->Order->id = $this->request->data['Order']['id'];
$this->Order->saveField('state', 'resolved');
$this->Order->saveField('date_resolved', date('Y-m-d H:i:s'));
$this->Order->saveField('delivery_label', $this->request->data['Order']['delivery_label']);
$this->Session->setFlash('Ordren er nu sat til "Sendt".'.$this->Session->read('Message.success.message'), null, array(), 'success');
$this->redirect(array('controller' => 'orders', 'action' => 'index'));
}
$order = $this->Order->find('first', array('conditions' => array('Order.id' => $order_id, 'Order.state' => 'packed'), 'recursive' => 4));
// Does the item exist?
if(empty($order))
{
// Tell the user this item did not exist
$this->Session->setFlash('Ordren findes ikke.'.$this->Session->read('Message.warning.message'), null, array(), 'warning');
return $this->redirect($this->referer());
}
if($is_resolved) {
// Send the email receipt
$Email = new CakeEmail('receipt');
$Email->to($order['Customer']['email_address']);
$Email->template('receipt_send')->viewVars( array('order' => $order));
$Email->send();
}
$this->set('order', $order);
}
Here is the receipt_send code
<table style="width:100%; margin-bottom:30px; border-collapse: collapse; color:#777;">
<tr style="vertical-align:middle; border-bottom:1px solid #777;">
<td colspan="3" style="width:45%; padding:10px 0;"><?php echo $this->Html->image('logo.png', array('style' => 'height:50px; margin-top:-15px; vertical-align:middle;', 'fullBase' => true)); ?></td>
</tr>
<tr style="font-size:1em; border-bottom:1px solid #777;">
<td style="padding: 5px 0;"><strong>Kvittering</strong> fra Bundgaards Garn</td>
<td style="padding: 5px 0;">Ordre nr. <strong><?php echo $order['Order']['id']; ?></strong></td>
</tr>
<p style="width:50%; float:right;">Din ordre er afsendt og har fået trackingnummer: <strong><?php echo $order['Order']['delivery_label']; ?></strong></p>
<table style="text-align: left; width:100%; border-collapse: collapse;">
<tr style="border-bottom:2px solid #dddddd;">
<th style="width:35%; padding: 10px 0;">Vare</th>
<th style="width:25%; padding: 10px 0;">Antal</th>
<th style="width:20%; padding: 10px 0; text-align:right;">Pris</th>
<th style="width:20%; padding: 10px 0; text-align:right;">Total</th>
</tr>
<?php foreach ($order['OrderItem'] as $key => $order_item): ?>
<tr style="border-bottom:1px solid #dddddd;">
<!-- PRODCUT LINK -->
<td style="padding: 10px 0; vertical-align: middle;">
<?php if($order_item['yarn_batch_id'] != 0) : ?>
<?php echo $order_item['YarnBatch']['YarnVariant']['Yarn']['name'] . ' - ' . $order_item['YarnBatch']['YarnVariant']['color_code'] . '-' . $order_item['YarnBatch']['batch_code']; ?>
<?php elseif($order_item['needle_variant_id'] != 0) : ?>
<?php echo $order_item['NeedleVariant']['Needle']['name'] . ' - ' . $order_item['NeedleVariant']['product_code']; ?>
<?php elseif($order_item['recipe_id'] != 0) : ?>
Print af <?php echo $order_item['Recipe']['name']; ?>
<?php elseif($order_item['color_sample_id'] != 0) : ?>
Farveprøve af <?php echo $order_item['ColorSample']['name']; ?>
<?php endif; ?>
</td>
<!-- PRODCUT LINK COLLAPSE -->
<td style="padding: 10px 0; vertical-align: middle;">
<?php echo $order_item['amount']; ?>
</td>
<td style="padding: 10px 0; vertical-align: middle; text-align:right;">
<?php if($order_item['yarn_batch_id'] != 0) : ?>
<?php echo $this->Number->currency($order_item['YarnBatch']['price'], 'DKK');?>
<?php elseif($order_item['needle_variant_id'] != 0) : ?>
<?php echo $this->Number->currency($order_item['NeedleVariant']['price'], 'DKK');?>
<?php elseif($order_item['recipe_id'] != 0) : ?>
<?php echo $this->Number->currency($order_item['Recipe']['price'], 'DKK');?>
<?php elseif($order_item['color_sample_id'] != 0) : ?>
<?php echo $this->Number->currency($order_item['ColorSample']['price'], 'DKK');?>
<?php endif; ?>
</td>
<td style="padding: 10px 0; vertical-align: middle; text-align:right;" >
<?php echo $this->Number->currency($order_item['price'], 'DKK');?>
<?php if($order_item['saving'] > 0) : ?>
<br/>
<span style="color:#5cb85c;"><?php echo $this->Number->currency($order_item['saving'], 'DKK');?>´</span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="2"/>
<td style="text-align:right;">
<p>Levering</p>
<?php if($order['Order']['saving'] > 0) : ?>
<p>Rabat</p>
<?php endif; ?>
<p><strong>Subtotal</strong></p>
<p><strong>Moms</strong></p>
</td>
<td style="text-align:right;">
<p><?php echo $this->Number->currency($order['Order']['shipping_price'], 'DKK');?></p>
<?php if($order['Order']['saving'] > 0) : ?>
<p style="color:#5cb85c;"><strong><?php echo $this->Number->currency($order['Order']['saving'], 'DKK');?></strong></p>
<?php endif; ?>
<p><strong><?php echo $this->Number->currency($order['Order']['sub_total'], 'DKK');?></strong></p>
<p><strong><?php echo $this->Number->currency($order['Order']['tax'], 'DKK');?></strong></p>
</td>
</tr>
<tr>
<td colspan="2"/>
<td style="text-align:right;">
<h4>Total:</h4>
</td>
<td style="text-align:right; color:#900000;">
<h4><strong><?php echo $this->Number->currency($order['Order']['price'], 'DKK');?></strong></h4>
</td>
</tr>
</table>
<div style="width:50%; float:left;">
<h4>Ordren sendes til:</h4>
<p>
<strong><?php echo $order['Customer']['first_name'] . ' ' . $order['Customer']['last_name']; ?></strong><br>
<?php echo $order['Customer']['ShippingAddress']['street'] . ' ' .
$order['Customer']['ShippingAddress']['zip_code'] . ' ' .
$order['Customer']['ShippingAddress']['city_name']?><br>
<?php echo $order['Customer']['email_address']; ?><br>
<?php echo $order['Customer']['phone_number']; ?><br>
</p>
</div>
<div style="width:50%; float:left;">
<?php if(!empty($order['Order']['customer_note'])) : ?>
<h4>Note til forhandleren:</h4>
<p>
<?php echo $order['Order']['customer_note']; ?>
</p>
<?php endif; ?>
</div>
<hr style="width:100%; border: 0; border-bottom: 1px solid #ddd;">
<p style="color:#999; font-size:0.8em;">
<strong>Bundggards Garn</strong> <br/>
<a style="color:#777;" href="https://bundgaardsgarn.dk">bundgaardsgarn.dk</a> <br/>
kontakt#bundgaardsgarn.dk <br/>
Saltumvej 46 9700 Brønderslev <br/>
30369522 <br/>
<i>CVR:</i> 34526826 <br/>
</p>
Got it to work by creating a controller and make a button to the information.... Works like a charm.
goodnight need to keep a calendar event laravel and make a calendar but I can not do any other please Amano in this and in advance thank you very much
this is the code of my calendar
<?php
$month=date("n");
$year=date("Y");
$diaActual=date("j");
$diaSemana=date("w",mktime(0,0,0,$month,1,$year))+7;
$ultimoDiaMes=date("d",(mktime(0,0,0,$month+1,1,$year)-1));
$meses=array(1=>"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio",
"Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
?>
<!DOCTYPE html>
<html lang="es">
<head>
<title>calendario </title>
<meta charset="utf-8">
<style>
#calendar {
font-family:Arial;
font-size:12px;
}
#calendar caption {
text-align:left;
padding:5px 10px;
background-color:#003366;
color:#fff;
font-weight:bold;
}
#calendar th {
background-color:#006699;
color:#fff;
width:40px;
}
#calendar td {
text-align:right;
padding:2px 5px;
background-color:silver;
}
#calendar .hoy {
background-color:red;
}
</style>
</head>
<body>
<h1>calendario </h1>
<table id="calendar">
<caption><?php echo $meses[$month]." ".$year?></caption>
<tr>
<th>Lun</th><th>Mar</th><th>Mie</th><th>Jue</th>
<th>Vie</th><th>Sab</th><th>Dom</th>
</tr>
<tr bgcolor="silver">
<?php
$last_cell=$diaSemana+$ultimoDiaMes;
// hacemos un bucle hasta 42, que es el máximo de valores que puede
// haber... 6 columnas de 7 dias
for($i=1;$i<=42;$i++)
{
if($i==$diaSemana)
{
// determinamos en que dia empieza
$day=1;
}
if($i<$diaSemana || $i>=$last_cell)
{
// celca vacia
echo "<td> </td>";
}else{
// mostramos el dia
if($day==$diaActual)
echo "<td class='hoy'>$day</td>";
else
echo "<td>$day</td>";
$day++;
}
// cuando llega al final de la semana, iniciamos una columna nueva
if($i%7==0)
{
echo "</tr><tr>\n";
}
}
?>
</tr>
</table>
</body>
</html>
this is the structure I only need to add the event and select dates mvc but everything goes to get here