need help urgent

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ahtasham82
Forum Newbie
Posts: 10
Joined: Fri Jan 14, 2005 10:42 pm
Location: PAKISTAN
Contact:

need help urgent

Post by ahtasham82 »

hi guys im new here and i need ur help its very urgent and very important there is very small task that i have to do and i dont know how to do.
visit this link

http://www.tshirtcreator.com/createtshirt.php

i want to do the same thing as on this page i mean changing the color of the image writing on the image etc.
i mean exactly the same thing.

guys im counting on you i need this.

waiting for ur replieeeeeeeeeeeeeeeeessss.

ahtasham
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You need separate pictures, all different colors (unless you know GD which you dont sound like you do).

The text is just done with CSS ove the image.

Just use GET to pass different parameters to change the image and text... not much to it ;)

How much PHP do you know already?
ahtasham82
Forum Newbie
Posts: 10
Joined: Fri Jan 14, 2005 10:42 pm
Location: PAKISTAN
Contact:

Post by ahtasham82 »

thx,

i know how to write on the image but dont know how to change the color of the image so whats ur suggestion regarding this
plz reply soon
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

ahtasham82 wrote:thanks

i know how to write on the image but dont know how to change the color of the image so whats your suggestion regarding this
please reply soon
Have a folder with separate images named blue.jpg, red.jpg etc etc...

Then simply have something like...

Code: Select all

switch ($_GET['color']) {
    case 'red': $img = 'red.jpg';
    break;
    case 'blue': $img = 'blue.jpg';
    break;
    default: $img = 'yellow.jpg';
    break;
}
echo '<div style="width:300px; height:400px; background-image:url('.$img.'); background-repeat:no-repeat;">Text</div>';
Then to change the color go to, http://www.yoursite.com/tshirt.php?color=red or http://www.yoursite.com/tshirt.php?color=blue etc etc...

Read the manual on http://www.php.net/ if you haven't done so already.... it's the best resource available for understanding PHP ;)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

POST could also be utilized and the content being processed within the page coding if you want it EXACTLY like that site and don't want to pass it to the URL.

Code: Select all

<?
if($_POST['action'] == "tshirt")
{
  switch($_POST['color'])
  {
  case blue:
    $image = "blue.jpg";
    break;
  case red:
    $image = "red.jpg";
    break;
  case green:
    $image = "green.jpg";
  }
echo "<img src=\"tshirts\$image\" alt=\"".$_POST['color']." Tshirt\">";
} ELSE
{ ?>
<form action="<? echo $PHP_SELF; ?>" method="POST">
<input type="hidden" name="action" value="tshirt">
<select name="color">
<option value="blue">Blue</option>
<option value="red">Red</option>
<option value="green">Green</option>
</select>
// whatever other variables you want here.. like text.. etc
</form>
<? } ?>
Post Reply