Jump to content

Parse


eaglelegend

Recommended Posts

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

<?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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.