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
phelpsa
Forum Commoner
Posts: 48 Joined: Thu Feb 17, 2005 1:05 pm
Post
by phelpsa » Sun Mar 27, 2005 2:18 pm
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
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Sun Mar 27, 2005 2:22 pm
You're not concatenating the strings with periods. Try this:
Code: Select all
echo 'Your tyre size is '.$tyrewidthmm.'/'.$profile.' '.$wheelsize ;
phenom| fixed typo
lostboy
Forum Contributor
Posts: 329 Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada
Post
by lostboy » Sun Mar 27, 2005 2:25 pm
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;
phelpsa
Forum Commoner
Posts: 48 Joined: Thu Feb 17, 2005 1:05 pm
Post
by phelpsa » Sun Mar 27, 2005 3:04 pm
Thanks guys!