Get textarea data. [Froala Editor] [Codeigniter] - php

I try to get data from text area,When submit form.
<?php
echo form_open_multipart('start/create','class="build_form"');
...
echo form_textarea('proDetail','','id="proDetail"');
...
echo form_submit('submit','Save','class="btn btn-primary"');
echo form_close();
?>
Try to show data in this function.
public function create()
{
echo print_r($this->input->post('proDetail'));
}
It give me a data from textarea, But it's not same when look in textarea.
How it look in textarea.
This is code in textarea.
<p><img class="fr-draggable fr-fir fr-dii" style="width: 300px;" src="http://localhost/siamfunding/img/users/upload/3a5e29ad7b5c64b16a97c56ce2a006cb7f66c7e3.jpg"></p>
<h1 style="text-align: center;">
<strong>asdasddadasdddd</strong>
</h1>
<p style="margin-left: 20px;">qwdqwdasdasasdwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww</p>
<p style="">daaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaas</p>
<p style="">dddddddddddddddddddddddddddddddddddddddddddddddddddddddddd</p>
<p style="">aaaaaaaaaaaaaaaad</p>
And, This is how it look when i try to show data.
This is code.
<p>
<img class="fr-draggable fr-fir fr-dii" xss="removed" src="http://localhost/siamfunding/img/users/upload/3a5e29ad7b5c64b16a97c56ce2a006cb7f66c7e3.jpg">
</p>
<h1 xss="removed">
<strong>asdasddadasdddd</strong>
</h1>
<p xss="removed">qwdqwdasdasasdwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww</p>
<p xss="removed">daaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaas</p>
<p xss="removed">dddddddddddddddddddddddddddddddddddddddddddddddddddddddddd</p>
<p xss="removed">aaaaaaaaaaaaaaaad</p>
<p xss="removed">
<br>
</p>
What happen, How can i make it look like in text area.
Ps.I try to import css and Jquery in page. It's not work.

Related

Using a php code in a variable with multiple line strings

How to give the content of $topic_image to a variable like this at the source part?
The problem is here: --> src="image/<?php echo $topi_image?>" .
$display_content=<<<END_OF_TEXT
<div>
<img src="image/<?php echo $topic_image ?>" style="width:200px;height:150px;">
<p style="float:left">$topic_pris</p>
<p style="float:left">$topic_title</p>
<p style="float:left">$topic_name</p>
</div>
END_OF_TEXT;
Heredoc expands variables itself. You don't need the whole <?php echo $topic_image ?>, just the variable:
$display_content=<<<END_OF_TEXT
<div>
<img src="image/${topic_image}" style="width:200px;height:150px;">
<p style="float:left">$topic_pris</p>
<p style="float:left">$topic_title</p>
<p style="float:left">$topic_name</p>
</div>
END_OF_TEXT;

How to change css in php file

I am using post navigation for my blog. For this portion i wrote some css. It's working fine. But the problem is for the very latest post , it's showing blank space for next post link. Same thing is happened with oldest post, it's showing again bank space for previous post link.
I add code snippet for this portion. Can i anyone suggest how can i modify my css for this portion. Following code is embedded in php file.
<div class="row justify-content-center">
<div class="sewl-more-posts">
<div class="previous-post">
<?php If(previous_post_link()){?>
<span class="post-control-link">Previous Article</span>
<span class="post-name"><?php previous_post_link(); ?></span>
<?php } ?>
</div>
<div class="next-post">
<?php If(next_post_link()){?>
<span class="post-control-link">Next Article</span>
<span class="post-name"><?php next_post_link(); ?></span>
<?php } ?>
</div>
</div>
</div>
First, output the divs only if they'll have content:
<div class="sewl-more-posts">
<?php if (previous_post_link()){?>
<div class="previous-post">
<span class="post-control-link">Previous Article</span>
<span class="post-name"><?php previous_post_link(); ?></span>
</div>
<?php } ?>
<?php if (next_post_link()){?>
<div class="next-post">
<span class="post-control-link">Next Article</span>
<span class="post-name"><?php next_post_link(); ?></span>
</div>
<?php } ?>
</div>
This way, if the previous-post or next-post div is missing, you'll be able to target the remaining one with the :only-child pseudo class:
.sewl-more-posts > div:only-child {
text-align: center;
}
You cannot do this with php once the page is generated client-side, therefore you have to use javascript (for example):
onclick = documet.getElementById('the id you have').style.property = "blue";

Session variable is not displayed online but displayed locally

In the bellow code i have printed a session variable on the output page
<?php ob_start();
session_start();
include("database.php");
include("tracking-header.php");
?>
<div class="dt-content" style="text-align:center;">
<p class="srymsg">Sorry</p>
<p class="srymsg2" style="margin-bottom:110px;">The Vehicle number <span style="color:#000; font-weight:bold; text-transform:uppercase;"><?php print $_SESSION['vehicleno']; ?></span>, not found.<br />please try again.</p>
</div>
<div class="nxtbtn" >
<input type="button" value="BACK" name="back" style="float:left;margin:17px 25px 16px;" />
<?php include("tracking-footer.php");?>
in this print $_SESSION['vehicleno']; is displayed on local but when i upload this file online and then this is not displayed on the page. can any one say what is the problem in it?
Try by switching place of ob_start and session_start function like below
<?php
session_start();
ob_start();
include("database.php");
include("tracking-header.php");
?>
<div class="dt-content" style="text-align:center;">
<p class="srymsg">Sorry</p>
<p class="srymsg2" style="margin-bottom:110px;">The Vehicle number <span style="color:#000; font-weight:bold; text-transform:uppercase;"><?php print $_SESSION['vehicleno']; ?></span>, not found.<br />please try again.</p>
</div>
<div class="nxtbtn" >
<input type="button" value="BACK" name="back" style="float:left;margin:17px 25px 16px;" />
<?php include("tracking-footer.php");?>

print div With unspecified background html,javascript,php

I have a project for kids cards where the child selects the background from specific backgrounds and write his name and print
But the problem is that I only want to print the card (apDiv14 with background) not the full page Or if there was a way to convert certain content to pictures for print
<div id="apDiv14">
<div id="for1">
<h1 ID="head1"> <br>
<h1 ID="head2"> <br>
<h1 ID="head3"> <br>
<br>
</h1>
</div>
<div id="apDiv17"><form name="form1">
<p>
<br>
<input type="text" name="newtitle" size="25">
</p>
<input type="text" name="newtitle2" size="25">
<br>
<br>
<select name="newtitle3" style="width: 150px;">
<option value="">age</option>
</select>
<br>
</p>
<p> <img src="img/BB.gif" width="80" height="45" onClick="ChangeTitle();"><img src="img/PB.gif" width="80" height="45" onClick="pri();"> </p>
<p>
</form> </div></div>
<script>
function pri() {
window.print(); }
</script>
function pic1(apDiv14)
{
// background 1
document.getElementById("apDiv14").style.backgroundImage="url('img/1st card Jeddah.jpg')";
document.body.style.zIndex='4';
document.getElementById("apDiv14").style.backgroundSize = "527px 307px";
document.getElementById("apDiv14").style.backgroundRepeat='no-repeat';
}
function pic2(apDiv14)
{
//background 2
document.getElementById("apDiv14").style.backgroundImage= "url('img/2nd card Jeddah.jpg')";
document.body.style.zIndex='4';
document.getElementById("apDiv14").style.backgroundSize = "527px 307px";
document.getElementById("apDiv14").style.backgroundRepeat='no-repeat';}
You can use a print media stylesheet to limit which content gets printed (by setting other content to display: none but most browsers are configured to not print background images (since they are rarely important and use a lot of ink).
I'd approach this by using some server side code to generate a PDF version for printing and using a form to submit the options to the server.
javascript code:
var content = document.getElementById("divcontents");
var pri = document.getElementById("ifmcontentstoprint").contentWindow;
pri.document.open();
pri.document.write(content.innerHTML);
pri.document.close();
pri.focus();
pri.print();
html code:
<iframe id="ifmcontentstoprint" style="height: 0px; width: 0px; position: absolute"></iframe>

correct place for my form tag to pass correct value in action PROBLEM

i have this code:
<body>
<div class="header">
<?php if (isset($_SESSION['user_id']) && !isset($menu)) { ?>
<div class="menu_holder">
<ul>
<li>
<a href="<?php echo ADDRESS; ?>menu.php" class="green_link">
<img src="<?php echo IMAGES; ?>template/menu.gif" width="51" height="20" border="0" />
</a>
</li>
</ul>
</div>
<?php } ?>
<?php
if (!isset($plainHeader))
{
$plainHeader = " ";
?>
<img src="<?php echo IMAGES; ?>template/logo.gif" width="160" height="94" />
<?php
}
?>
</div>
<br/>
<?php $id_to = $user['profile_id_contact']; ?>
<div class="main_content">
<center>
<div class="innerContainer">
<span class="headings2">FREE CHAT CONTACTS</span>
<form id="message_area" style="display:none" method="post" action="<?php echo ADDRESS; ?>messageSent.php?id=<?php echo $id_to ?>">
<?php
if (count($users) > 0)
{
foreach ($users as $user)
{
//some php here
?>
<a href="#" class="charcoal_link" style="line-height: 20px;" onclick="showMessageArea(this); return false;" >
<?php echo $uniqueCode1?><span class="pink_text"><?php echo $uniqueCode2?></span><?php echo $uniqueCode3?>
</a>
<textarea name="message" rows="10" cols="20"></textarea>
<input name="Submit" type="submit" value="Send"></input>
<?php
}
}
?>
</form>
</div>
</center>
</div>
</body>
as my code is now the form tag is in the wrong place because my tag links does not show.
where must i put my form tag so that when i click on any of the uniquecode links i pass the correct $id_to in the action??? when i move the form tag after the my links show but regardless of which link i click on it passes the first link's $id_to with the action. i have also tried to pass $id_to as a hidden field which i had after the sumbit but still it passes the first link's id
please help? i have been struggeling with this for some time now...i cannot redirect the page via JS becuase this site is for a MOBILE aka mobi site
please help? im desperate
thank you
if i move the form tag and have it like this:
messageSent.php?id=">
and i view the page source $id_to contains correct id but as sson as i go to sentMessage.php the id in the url is incorrect
To pass a id to the next page in a link you need to add "?id='.$id.'" at the end of the url.
e.g.
<a href="<?php echo ADDRESS; ?>menu.php?id=5" class="charcoal_link" style="line-height: 20px;">
To make sure that each link is different you can right click and copy the url to double check.

Categories