Page 1 of 1

Please can someone correct this for me

Posted: Sun Mar 27, 2005 2:18 pm
by phelpsa

Code: Select all

<?php

$wheelsize = $_POST['wheeldiameter'];
$tyrediameter = $_POST['tyrediameter'];
$tyrewidth = $_POST['tyrewidth'];
$inch = '25.4';

$sidewall = $tyrediameter - $wheelsize;
$tyrewidthmm = $tyrewidth * $inch;
$sidewallmm = $sidewall * $inch;
$profile = $sidewallmm / $tyrewidthmm;

echo 'Your tyre size is '$tyrewidthmm'/'$profile'  '$wheelsize ;

?>
Please could someone correct this for me. Where abouts does it need a ',' or ';' in line 13?

Adam

Posted: Sun Mar 27, 2005 2:22 pm
by Ambush Commander
You're not concatenating the strings with periods. Try this:

Code: Select all

echo 'Your tyre size is '.$tyrewidthmm.'/'.$profile.'  '.$wheelsize ;
phenom| fixed typo

Posted: Sun Mar 27, 2005 2:25 pm
by lostboy
You can simply write the vars into the text string when you use double quotes.

Code: Select all

echo "Your tyre size is $tyrewidthmm/$profile $wheelsize" ;

if you want to use the single quotes then you need to concatenate the vars into the string with the . concatenation operator

Code: Select all

echo 'Your tyre size is '.$tyrewidthmm.'/'.$profile.' '.$wheelsize;

Posted: Sun Mar 27, 2005 3:04 pm
by phelpsa
Thanks guys!