You can do it easily using jQuery. Once page is loaded change class using jQuery.
You can do it easily using jQuery. Once page is loaded change class using jQuery.
If you are working in local system, mail function will not work due to SMTP.
Once you upload it on live server it will work as most live server have SMTP default set.
Hi riah, I am not sure what mandarAlCarro function is doing.. If it is submitting form imagenv then you must get imagenv value. Can you debug by this code so you can know how many variables are passed to next page.
echo '<pre>';
print_r($_POST);
print_r($_GET);
exit;
Are you sure your image src points to valid image?
What is the need of mediator page 2?
If you still want page 2, as diafol told you on http://www.daniweb.com/web-development/php/threads/422848/read-a-file-content-without-uploading-it-to-the-server you need to read file data first on page 2 and then use it as a hidden var and pass it to page 3.
My dear you are just changing window url using onclick. In this case form data will not be available to you in next page.
You need to submit form data using submit button, then only you can get hidden variable via post.
<? echo $_POST['imagenv'];?>
<form id="imagen" method="post" name="imagen" action="#">
Con Corte - AƱadir carro
<input id="imagenv" type="hidden" value="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAACA0lEQVR4nO3cwUsUYRzG8UdhKa0oEREpCjoUSOlJgiAWIbp26FZQt+iS2CH0ImwGXj2IWiePhnSo6L5/2nQoqFmVRvd93+edfb+f8/B7vzDsLDvzzkoAAAAAAAAAAAAAAAAAAPxrU11tquvOwG8P1VOlnipJHyR9dAeV6rDBMfvRKyBJmjzj8QdRKjC0BXfAqOkEmLERYAYkvQ0466KksYDzinMn0tzxSHMxhNvugLbZSbBGrE8ghjDnDmiDp+4AAANm3QG5emNc+7NxbZzinjsgJ4vuANS9cAf88dwdgONuuQPcrrkDBhR/E3LFHXCCLXcAICnvy4Pzd5FNjperos27A/7jujsAdQ/cASjYd3dAQ8vugFTuugMaeuUOQIFCbIBL4+/G7pH2zh3QWCEn5LE74Ix23QGo++QOQN2qOyCml+6Ac3jtDoijvV+Q6+6AONp7Qr64A2KacgecQ8h3VbJzwR0AAKNrzx2Aupw3YhSn+F2MubnpDkhhwh3Q0CV3QCpt2VpzxR2QypI7oIFtd0BKI30ru41+uANQl/O1Obd3VYp2wx2AnvrqqS/pqjvF7Zs7QFKbH5gFl8P/Vh25A3LzyLRuRzwky8aaOyBrlVRVSnIN/5pgjfaLfEI6kp5Eml2EZwFmTIs7AcG9lzTT8NjLkn5Kuh8vBwAAAAAAAACAJn4Bse83Wq3XeMoAAAAASUVORK5CYII=" name="imagenv">
<input name="submit" value="submit" type="submit" />
</form>
Why are you using onclick and not using submit button?
Your code works for me.
Where is submit button?
Are you using javascript for rediretion?
but in action I cant put a link because it is dynamically generated.
Your form name and hidden field name is same. i.e. imagen
name must be unique.
Can you try by changing both's name and id.
Did it worked?? Make thread solved if it is..
Read post properly.. This function call must be on top of php page. No other code ot HTML should be before function. Always make pratice to write PHP code on upper part of HTML and not below.
Have you tried my last code?? It is storing and fetching from cookie only.
On top of page you need to add session_start()
.
After that function if you have set any session i.e. $_SESSION['username'] = 'john';
you can get it's value on second page by echo $_SESSION['username'];
, but make sure on second page you have included sesson_start()
function on top of page.
If you don't want to save it in cookie, set image data in input type hidden.
When form is submitted you can save hidden data in database and further can use it.
I ahve created demo code again :) Try now:
<html>
<header>
<script src="http://www.nihilogic.dk/labs/canvas2image/canvas2image.js"></script>
<script src="http://www.nihilogic.dk/labs/canvas2image/base64.js"></script>
</header>
<body>
<canvas width="200" height="200" style="border:1px solid black;" id="thecanvas"></canvas>
<input name="btn" value="Save in cookie" type="button" onClick="saveCookie();" >
<input name="btn" value="Show cookie" type="button" onClick="showCookie();">
<input name="btn" value="Draw image from cookie" type="button" onClick="drawImage();"> <br><br><br><br>
<img id="myImg" src=""/>
<script language="javascript">
var oCanvas = document.getElementById("thecanvas");
var oCtx = oCanvas.getContext("2d");
var iWidth = oCanvas.width;
var iHeight = oCanvas.height;
oCtx.fillStyle = "rgb(255,255,255)";
oCtx.fillRect(0,0,iWidth,iHeight);
oCtx.fillStyle = "rgb(255,0,0)";
oCtx.fillRect(20,20,30,30);
oCtx.fillStyle = "rgb(0,255,0)";
oCtx.fillRect(60,60,30,30);
oCtx.fillStyle = "rgb(0,0,255)";
oCtx.fillRect(100,100,30,30);
oCtx.beginPath();
oCtx.strokeStyle = "rgb(255,0,255)";
oCtx.strokeWidth = "4px";
oCanvas.onmousedown = function(e) {
bMouseIsDown = true;
iLastX = e.clientX - oCanvas.offsetLeft + (window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft);
iLastY = e.clientY - oCanvas.offsetTop + (window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop);
}
oCanvas.onmouseup = function() {
bMouseIsDown = false;
iLastX = -1;
iLastY = -1;
}
oCanvas.onmousemove = function(e) {
if (bMouseIsDown) {
var iX = e.clientX - oCanvas.offsetLeft + (window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft);
var iY = e.clientY - oCanvas.offsetTop + (window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop);
oCtx.moveTo(iLastX, iLastY);
oCtx.lineTo(iX, iY);
oCtx.stroke();
iLastX = iX;
iLastY = iY;
}
}
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
return unescape(y);
}
}
}
function saveCookie()
{
var strDataURI = oCanvas.toDataURL();
setCookie("myImage",strDataURI,5);
}
function showCookie()
{
alert(getCookie('myImage'));
}
function drawImage()
{
document.getElementById('myImg').src = getCookie('myImage');
}
</script>
</body>
</html>
I didn't get saveAsPNG function.
I have tried with demo code as shown below.. It may be help you:
<html>
<body>
<canvas height="100" width="100" id="canvas"></canvas>
<script language="javascript">
var canvas=document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.beginPath();
ctx.arc(75, 75, 10, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();
var img = canvas.toDataURL("image/png");
alert('Your image is :'+img);
document.write('<br><br><br>Your image in canvas: <img src="'+img+'"/>');
</script>
</body>
</html>
All subpages are core html pages? Or it are in php and you have rewrite it?
post your code.
>
Change onclick
onClick="$('.fulldesc').hide();$('#full<?=$count?>').toggle('slow');"
Ohh..
ReplaceonClick="$('#full<?=$count?>').toggle("slow");"
with
onClick="$('#full<?=$count?>').toggle('slow');"
Add below code in htaccess file and remove rest code.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Try this:
<html>
<head>
<title>Demo</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<style type="text/css">
.shortdesc{ color:red;}
.fulldesc{ color:green; display:none;}
</style>
</head>
<body>
<table>
<?php
for($count=1; $count<=10; $count++)
{?>
<tr id="short<?=$count?>" onClick="$('#full<?=$count?>').toggle("slow");;" class="shortdesc"><td><?=$count?> Short description</td></tr>
<tr id="full<?=$count?>" class="fulldesc"><td>My Name is <?=$count?> and this is full description </td></tr>
<?php
}
?>
</table>
</body>
</html>
Change your while loop with following code:
<?
$cnt = 1;
while($row = mysql_fetch_array($result))
{ ?>
<p class="numblocks num-1">
<?
echo $cnt.' - '.$row['chanson'].', '.$row['artiste'];
$cnt++;
?>
</p>
<?
}
?>
Check this post for examples.
http://www.daniweb.com/web-development/php/threads/369623/syntax-prpblems#post1588766
Try this code:
function getRandomString($length=5)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$string = '';
for($i = 0; $i < $length; $i++)
{
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}
$number = getRandomString($_POST[max]);
n, i get results.what is the problem ? the variable $sku is already asigned from another table.
Have you echo query? And does echoed query work in phpmyadmin?
<td><?php echo nl2br($row2['detail']); ?></td>
When you echo details on page use nl2br function.
echo nl2br($detail);
getPlanbook
Sorry i don't know symfony.
But trying.. Add below function in PlanbookTable class.
public function getPlanbook()
{
return Doctrine::getTable("Planbook")->findAll;
}
Have you created all classes by your own?
Where is getPlanbook function defined?
You forgot " after name password.<tr><h3 class="website">Please enter your Password<input type = "password" name="password"/>
If you want to use session in any of php page make sure you add session_start(); at top of page.
Whe username is correct you can set it in session i.e. $_SESSION['username'] = $username;
On other pages where login is required on top of that pages check
if(!isset($_SESSION['username']))
{
header('location:login.php');
exit;
}
When you are using string concatination in PHP you need to take care of starting and ending quotes and it's type.
Check this link for more detail
At line no 79.$this->$planbooks->getPlanbook();
should be$this->planbooks->getPlanbook();
If you delete sample and source folder from ckeditor almost 3.5+ size will be reduced.
There is no use of these 2 folder.
SELECT *
FROM tbl_test
WHERE id
IN ( 23,4,56,21,9)
ORDER BY FIELD( id,23,4,56,21,9 )
@pritaeas: downvote :( As a said i am not experienced but was facing issue for limit in one place.so shared.
I am going search filter via GET parameters.
Below is the code. Try this:
<?
function getCurrPageUrl($unset=array())
{
$currPageName = basename($_SERVER['PHP_SELF']);
$arr = $_GET;
foreach($unset as $one)
{
unset($arr[$one]);
}
return $url = $currPageName.'?'.http_build_query($arr);
}
?>
<a href="<?=getCurrPageUrl(array('category'));?>&category=mobile">Category</a>
<a href="<?=getCurrPageUrl(array('price'));?>&price=100">Price</a>
<a href="<?=getCurrPageUrl(array('color'));?>&color=black">Color-black</a>
<a href="<?=getCurrPageUrl(array('color'));?>&color=white">Color-white</a>
Each time you click on any search parameter page's url is changed accordingly.
We have done this in past but in flash + php. I am also looking for answer if anyone have solution.
Not much experience in this, but better to convert all to mysql. Because 2 databse handeling may be difficult and also mssql doesn't not provide all functionality like mysql. e.g. you can not use limit in mssql.
Below function will return random string.
<?
function getRandomString($length=6)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$string = '';
for($i = 0; $i < $length; $i++)
{
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}
echo getRandomString(10);
?>
Why don't you save work.php as index.php ?
Is your text input name is contact[first_name]
??
Post your form code.
<?php
include "class.php";
$account = new account(0);
$id = $_GET['id'];
$u = $_COOKIE['username'];
$a = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE id='$id'"));
$path = $_SERVER['DOCUMENT_ROOT'].$a['actualPath']; // make sure file exists at this path
$fullPath = $path.$_GET['download_file'];
if ($fd = fopen ($fullPath, "r")) {
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);
switch ($ext) {
case "pdf":
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
default;
header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
}
header("Content-length: $fsize");
header("Cache-control: private");
while(!feof($fd)) {
$buffer = fread($fd, 2048);
echo $buffer;
}
}
fclose ($fd);
exit;
?>
This is one of my favorite website: Click Here
Here htaccess code is generated based on your selection, you just need to add it in root of your project.
Use join for good practice:
"SELECT roomrent.* FROM `roomrent`
LEFT JOIN guests ON guests.id = roomrent.guest_id
WHERE `room_id`='$_REQUEST[id]' AND `checkout_datetime`='0000-00-00 00:00:00' AND `id`='$_REQUEST[roomrent_id]' ORDER BY `id` DESC"
Also why are you updating in whle loop? Where is the code for inserting into table?
Whenever any select input is submitted it will take it's value not label.
I was struggling long for proper image resize function for maintaining image ratio.
Finally i end end up with merging and changing all codes and it works !
function resizeImage($sourceFile,$destFile,$width,$height)
sourceFile => Full path along with filename
destinationFile => Full path along with filename
I hope this will help coders..
If you are adding your php age in cronjob and assuming it will run daily you can use '<=' as shown below query
.
select email from myusers where WHERE DATE_ADD(FROM_UNIXTIME(prelogin), INTERVAL 30 DAY) <= CURDATE()";
Because many times it happends that i want to search something from my past posts.
Anyways thanks for reply.