eaglelegend Posted April 13, 2008 Share Posted April 13, 2008 I have coded this, however is it correct? it is meant to choose between 1 or 2 depending on what the user has clicked on, it is a mail system, and this shows the username and if it is their email account they want to send it from thats what they have to choose it from... Parse: Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /misc/39/000/171/334/2/user/web/eaglelegend.com/mail2.php on line 75 Code:(around 75) if($mailf != '') { $1 = if($a == 'sendmsg' && $_POST['type'] == 1); $2 = if($a == 'sendmsg' && $_POST['type'] == 2); if($mailf > $1) { print "$user"; } if($mailf > $2) { print "[email protected]"; } Link to comment https://forums.phpfreaks.com/topic/100957-parse/ Share on other sites More sharing options...
Orio Posted April 13, 2008 Share Posted April 13, 2008 You can't have numbers as variable names. Replace with strings that start with A-Za-z or a underscore. Problem2 - you can't put an "if" in an assignment. What are you trying to do? Orio. Link to comment https://forums.phpfreaks.com/topic/100957-parse/#findComment-516312 Share on other sites More sharing options...
eaglelegend Posted April 13, 2008 Author Share Posted April 13, 2008 Thanks I didnt realise I couldnt have numbers >_< Link to comment https://forums.phpfreaks.com/topic/100957-parse/#findComment-516315 Share on other sites More sharing options...
Xeoncross Posted April 13, 2008 Share Posted April 13, 2008 <?php $1 = if($a == 'sendmsg' && $_POST['type'] == 1); $2 = if($a == 'sendmsg' && $_POST['type'] == 2); ?> Should be: <?php $var1 = ( ($a == 'sendmsg') && ($_POST['type'] == 1) ? true : false); $var2 = ( ($a == 'sendmsg') && ($_POST['type'] == 2) ? true : false); ?> You can use conditions in assignment if you use short hand Link to comment https://forums.phpfreaks.com/topic/100957-parse/#findComment-516316 Share on other sites More sharing options...
eaglelegend Posted April 13, 2008 Author Share Posted April 13, 2008 thanks, I shall try what you guys have given me to try and thank you Link to comment https://forums.phpfreaks.com/topic/100957-parse/#findComment-516317 Share on other sites More sharing options...
eaglelegend Posted April 13, 2008 Author Share Posted April 13, 2008 print "<h2>Send Message</h2><p> <form action='/mail2.php?action=sendmsg' method='post'> <input type='radio' name='type' value='1' class='text_box'> Email<br> <input type='radio' name='type' value='2' checked class='text_box'> Private Message<br> To<br> <input type='text' name='to' class='text_box'><p> From<br> <input type='text' name='from' class='text_box' value='$mailf'><p> Subject<br> <input type='text' name='subject' size='30' class='text_box'><p> Message<br> <textarea rows=6 cols=60 nowrap name='message' class='text_box'></textarea><p> <input type='submit' value=' Send Message ' class='text_box'></form>"; see value='$mailf' , Thats there because I want it to show the "result" of the clickity thing above and what you just fixed for me you know? the user clicks on a check thing, then it changes depending if user would like to use the email or PM from that form! what would be a proper way to do that? Link to comment https://forums.phpfreaks.com/topic/100957-parse/#findComment-516321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.