Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

image and variables


ymhik

Recommended Posts

Hello everyone

 

This is what i want to do:

 

1. A user is typing text

2. scrolls through scrolling table of images of fonts

clicks on the font he likes and the next

table should display his text in the font he picked

 

Well i can make everything for one font where you input of font name

and an image is created of the typed text

 

However i am stuck in creating a clickable image from the database that will pass a variable to the file that creates the image

 

This is what i have so far

Code for image list

 

<?php

 

$font_query = tep_db_query("select distinct font_id, font_name, font_image from ". TABLE_FONT);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_BESTSELLERS);

 

new infoBoxHeading($info_box_contents, false, false);

 

 

$rows = 0;

$font_list = '<table border=0 width=100% cellspacing=0 cellpadding=1 class=infoBoxContents>';

while ($fonts_d = tep_db_fetch_array($font_query)) {

$rows++;

if($rows <= 3){

$imagem = $fonts_d['font_image'];

 

$font_list .= '<tr class=infoBoxContents align=center>' . tep_row_number_format($rows) . '.<br>

 

<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('fonts_d')) . '$font_name') . '">

<center>' . tep_image(DIR_WS_IMAGES . $imagem, $fonts_d['font_name'], 60, 80) . '</center><br>' . $fonts_d['font_name'] . '</a><hr></tr>';

 

 

 

}

}

$fonts_list .= '</table>';

 

echo $font_list;

 

Simple code for input and image display

<form method="post" action="<?=$_SERVER['PHP_SELF'];?>">

<input name="text1" type="text" size="20" class="textbox" value="66666">

<input name="size1" type="text" size="20" class="textbox" value="15">

<input name="test" type="file" size="20" class="textbox" value="15">

<input name="font1" type="text" size="20" class="textbox" value="/fonts/comic.ttf">

<input name="text2" type="text" size="20" class="textbox" value="text2">

<input name= "submit" type="submit" class="button" value="Create Image">

<br>

 

 

 

<img src="1.php?text1=<?php echo $_POST['text1'] ?>&size1=<?php echo $_POST['size1']?>&font1=<?php echo $_POST['font1'] ?>">

 

 

Big question:

 

How do i combine these two codes together where the font name is generated from the database

 

I would really appreciate someones help

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...