I need a html business price quote generator

Asked By 10 points N/A Posted on -
qa-featured

I am selling products on my online store. With the year coming to an end I need to up sales and views on it. I would like to put an    html business price quote generator on it. to attract more customers on it. I need help with people who has background on these kind of things. Is there a Application available for this? or any idea to start creating this program through using in AJAX or can I use javascript?

SHARE
Answered By 0 points N/A #132430

I need a html business price quote generator

qa-featured

Hello,

In order to successfully put price quote generator into your website, you will need to use PHP scripting language  into HTML or use JavaScript into HTML. The most efficient one will be to use PHP. You will have to create the price quotes into a text file named quote.txt for the PHP code to read the quotes from.

An example of PHP code for quote generation is as shown below. The code will give you a guideline to create a quote generator:

<?php

Header ("Content-type: image/gif");

$textfile = "quote.txt";
$quotes = array();
if(file_exists($textfile)){
     $quotes = file($textfile);
     srand ((float) microtime() * 10000000);
     $string = '-'.$quotes[array_rand($quotes)];
     $string = substr($string,0,strlen($string)-2);
}
else{
     $string = "No 'Quote' available at this time.";
}
$font  = 2;
$width  = ImageFontWidth($font)* strlen($string);
$height = ImageFontHeight($font);
$im = ImageCreate($width,$height);

$x=imagesx($im)-$width ;
$y=imagesy($im)-$height;
$background_color = imagecolorallocate ($im, 242, 242, 242); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
$trans_color = $background_color;//transparent colour
imagecolortransparent($im, $trans_color);
imagestring ($im, $font, $x, $y,  $string, $text_color);

imagegif($im);
ImageDestroy($im);
?>

Thank you

Login/Register to Answer

Related Questions