Jump to content

xenia

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

xenia's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=384499:date=Jun 16 2006, 03:51 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 16 2006, 03:51 AM) [snapback]384499[/snapback][/div][div class=\'quotemain\'][!--quotec--] I think you just need to redesign the whole method but it's hard to understand the purpose of the code from the long post you should think of using a database to store the car data and then all you have to do is add the last viewed cars as car_id. this would simply the whole process. then you can just query the car data from the database in the form. [/quote] Thank you for your suggestion joquius.I cannot use a database as the customer prefers not to have. However, I manage to solve it. Instead of making all these sessions on page quote i make <input type="hidden" name="price" value="<?php echo $price8;?>"> <input type="hidden" name="image" value="smartfourtwo.jpg"> <input type="hidden" name="model" value="Smart four two"> and on the next page enquiry_from.php I put if(isset($_POST['price'])){ $_SESSION['price']=$_POST['price']; } if(isset($_POST['image'])){ $_SESSION['image']=$_POST['image']; } if(isset($_POST['model'])){ $_SESSION['model']=$_POST['model']; } thanks, Xenia
  2. Hello, I have developed a website for a car rental company in which the user can select the pickup date and drop off date and can see a list of all the cars with their price depending on the selected date.The user select one car and is being redirected to an enquiry form in order to complete his personnal details in order the company to communicate with the customer and inform him if the specific car is availabel or not. In the page(enquiry_form.php) with the enquiry form I am displaying the pickup dates/hour and drop off dates/hour that the use has select from the previous page(quote.php)which I have save them in sessions in the page quote.php.Using the sessions I manage to keep the information for the dates even if the user submit as many times the form(I have put error validation). What I am trying to do now is to display also the information for the specific car that the user selected.More specific the image ,model and price.In the page quote.php that the cars are listed ,every car I have put it in a different form and the information for the image ,model and price I save them in sessions.Totally are 8 cars so I have put 8 forms and in every form I have put manually the image of the car,the price from a php function I created for calculating the price,and the model (I do not use database,as it is static). In the page enquiry_form.php I call the sessions in order to display the image and the price. The problem I have is that when the user select one of the cars(quote.php) and go to the next page enquiry_form is going to display the image and price of the last car.Thus,it maybe the session overwrites all the other cars and display the latest. The site map of the website is the following: index.php->quote.php->enquiry_form.php I will post also my code and I would be greatfull if you could help me. [code=php:0] <!-- quote.php --> <? session_start(); //assign the pick up drop off details in sessions and i will use them in all the other pages $_SESSION['pickupdate']=$_POST['pickupdate']; $pickupdate=$_SESSION['pickupdate']; $_SESSION['pickuphours']=$_POST['pickuphours']; $pickuphours=$_SESSION['pickuphours']; $_SESSION['pickupmin']=$_POST['pickupmin']; $pickupmin=$_SESSION['pickupmin']; $_SESSION['dropoffdate']=$_POST['dropoffdate']; $dropoffdate=$_SESSION['dropoffdate']; $_SESSION['dropoffhours']=$_POST['dropoffhours']; $dropoffhours=$_SESSION['dropoffhours']; $_SESSION['dropoffmin']=$_POST['dropoffmin']; $dropoffmin=$_SESSION['dropoffmin']; <table width="675" border="0" cellpadding="0" cellspacing="0"> <tr> <td > </td> <td >Car Type</td> <td >Car Info </td> <td >Capacity </td> <td > </td> <td >Price</td> <td >Email Quote </td> </tr> <tr> <td > </td> <td ><img src="smartfourtwo.jpg" alt="smart for two" /></td> <td > </td> <td > <!--The information for the first car --> <form id="form8" name="form8" method="post" action="enquiry_form.php" > <table width="200" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td >€ <? $price8= calculate($a[0],$b[0],$c[0],1); echo $price8; ?> </span></td> <td ><? $_SESSION['price']=$price8; $price8= $_SESSION['price']; $_SESSION['image']="smartfourtwo.jpg"; $image=$_SESSION['image']; $_SESSION['model']= "Smart four two"; $model=$_SESSION['model']; ?></td> <td width="40"><input name="price8" type="hidden" value="<? echo $_SESSION['price']; ?>" /></td> <td width="84"><input name="Submit" type="image" value="Book" src="book1.jpg" width="65" height="25" /></td> </tr> </table> </form></td> </tr> <!--The information for the second car --> <tr > <td > </td> <td ><img src="suzukialtob.jpg" width="330" height="92" /></p></td> <td > </td> <td > <form id="form2" name="form2" method="post" action="enquiry_form.php" > <table width="200" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="36" class="body">€ <? $price= calculate($a[0],$b[0],$c[0],0); echo $price; ?> </td> <td width="40"><? $_SESSION['price'][]=$price; $price= $_SESSION['price']; $_SESSION['image']="suzukialtob.jpg"; $image=$_SESSION['image']; $_SESSION['model']= "Suzuki Alto"; $model=$_SESSION['model']; ?></td> <td width="40"><!--<input name="price" type="hidden" value="<? //echo $_SESSION['price']; ?>" />--></td> <td width="84"><input name="Submit" type="image" value="Book" src="book1.jpg" width="65" height="25" /></td> </tr> </table> </form></td> </tr> <tr> <td class="quotetable"> </td> <td colspan="3" class="quotetable"><img src="suzukiswiftb.jpg" width="330" height="92" /></td> <td class="quotetable"> </td> <td colspan="2" valign="middle" class="quotetable"> <form id="form3" name="form3" method="post" action="enquiry_form.php" > <table width="200" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="36" class="body"> € <? $price2= calculate($a[0],$b[0],$c[0],0); echo $price2; ?></td> <td width="40"> <? $_SESSION['price']=$price2; $price2= $_SESSION['price']; $_SESSION['image']="fiatseicento.jpg"; $image=$_SESSION['image']; $_SESSION['model']= "Fiat Seicento"; $model=$_SESSION['model']; ?> </td> <td width="40"> <input name="price" type="hidden" value="<? echo $price2; ?>" /></td> <td width="84"> <input name="Submit" type="image" value="Book" src="book1.jpg" width="65" height="25" /></td> </tr> </table> </form> </td> </tr> <tr> <td > </td> <td ><img src="daewoomatiz.jpg" width="330" height="92" /></td> <td > </td> <td > <form id="form5" name="form5" method="post" action="enquiry_form.php" > <table width="200" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="36" class="body">€ <? $price4= calculate($a[0],$b[0],$c[0],0); echo $price4; ?> </td> <td width="40"> <? $_SESSION['price']=$price4; $price4= $_SESSION['price']; $_SESSION['image']="daewoomatiz.jpg"; $image=$_SESSION['image']; $_SESSION['model']= "Daewoo Matiz"; $model=$_SESSION['model']; ?></td> <td width="40"> <input name="price" type="hidden" value="<? echo $_SESSION['price']; ?>" /></td> <td width="84"><input name="Submit" type="image" value="Book" src="book1.jpg" width="65" height="25" /></td> </tr> </table> </form></td> </tr> <tr> <td class="quotetable"> </td> <td colspan="3" class="quotetable"><br> <span class="bodytitlesmall"><a href="quote.php#top" class="bodytitlesmall">> Return to top of Page</a><br> <br> </span></td> <td class="quotetable"> </td> <td class="quotetable"> </td> <td class="quotetable"> </td> </tr> </table> <!-- enquiry_form.php --> <? session_start(); ?> <table width="380" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td ><label>Pick up date:</label></td> <td ><? echo $pickupdate; ?></td> <td ><? echo $pickuphours; ?> : <? echo $pickupmin; ?></td> <td ><label>Price:</label></td> <td >€ <? echo $price; ?></td> </tr> <tr> <td ><label>Drop off date:</label></td> <td ><? echo $dropoffdate; ?></td> <td><? echo $dropoffhours; ?> : <? echo $dropoffmin; ?></td> <td> </td> <td> </td> </tr> </table> [/code] Thank you in advance, Xenia
  3. [!--quoteo(post=383365:date=Jun 13 2006, 12:07 PM:name=nogray)--][div class=\'quotetop\']QUOTE(nogray @ Jun 13 2006, 12:07 PM) [snapback]383365[/snapback][/div][div class=\'quotemain\'][!--quotec--] You are most likely uploading gif images, and using the imagecreatefromjpeg() function. You'll need to check if the image is jpg or gif and use the appropriate function. [/quote] Thanks nogray but I found the error,as I increased the maximun size of the uploded and not it is working.
  4. Hello everyone, I have a very strange problem with uploading and resizing images. I have developed an e-commerce website that the customers can buy online cloths.I have also created an administrator panel for the admin to insert items in the database uploading also their image. The image of the item will be displayed in three different sizes in the e-commerce site, the enlarge,large and small. The image that the user uploads has the dimension width:310 and from that width I use to make the dimensions of the large and small image. The code that I am using to upload the image is the following: [code=php:0] <? //copy the image to the server named enlarge_name of image copy($_FILES['image']['tmp_name'],"../enlarge_". $_FILES['image']['name']); ?> <? //make the image large echo $_POST['txt']; $uploadedfile = $_FILES['image']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); list($width,$height)=getimagesize($uploadedfile); $newwidth=$width * 0.35 ; $newheight=$height * 0.35; $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $filename = "../large_". $_FILES['image']['name']; imagejpeg($tmp,$filename,100); imagedestroy($src); imagedestroy($tmp); ?> <? //make the image small echo $_POST['txt']; $uploadedfile = $_FILES['image']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); list($width,$height)=getimagesize($uploadedfile); $newwidth=36; $newheight=40; $tmp=imagecreatetruecolor($newwidth,$newheight);//small imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);//small $filename = "../small_". $_FILES['image']['name'];//small imagejpeg($tmp,$filename,100);//small imagedestroy($src); imagedestroy($tmp); ?> [/code] The problem I get is that in some images that I upload it displays a black square instead of the image. The strange thing is that some times the same image might display it and the next time it will not. As I can understand it uploads them in the server but cannot display them correctly. I have search everywhere and I did a lot of testing to find the problem but I haven't yet ,so I would be very greatful if you could help me. Thank you , Xenia
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.