By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

Email PHP Form "Confirmation email" - Radio Group Problem

P: 2

I have a form on a site I am working on. 99% of it all works fine, but there is one thing that is not working.

This is the form:

The problem area is the four radio buttons.
actually - just the IT services one.

The validation is all fine. its just when the email confirmation gets sent to the client, one thing is not working. I have spent a while on this and i have it as close as i can get.

If i select IT services - the confirmation email is CORRECT.
However, if i select anything else, the one that is correct will appear, but it will also show that i have selected IT services. I have tried various different things. I will put the relevant code here:

iquote page
Expand|Select|Wrap|Line Numbers
  1. <label>
  2. <input type="radio" name="rdGroup" value="iphone" id="iphone" />
  3. iPhone </label>
  4. <label>
  5. <input type="radio" name="rdGroup" value="ipad" id="ipad" />
  6. iPad </label>
  7. <label>
  8. <input type="radio" name="rdGroup" value="ipod" id="ipod" />
  9. iPod Touch</label>
  10. <label>
  11. <input type="radio" name="rdGroup" value="it" id="it" />
  12. IT issue</label>
iquote thanks page
Expand|Select|Wrap|Line Numbers
  1. $it = "iT Services";
  2. $fullmessage .= "Which service are you enquiring about\r\n";
  3. $fullmessage .= "---------------------------------------------------";
  4. if ($rdGroup="iphone") {$fullmessage .= "$iPhone\r\n";}
  5. if ($rdGroup="ipad") {$fullmessage .= "$iPad\r\n";}
  6. if ($rdGroup="ipod") {$fullmessage .= "$iPod\r\n";}
  7. if ($rdGroup!="iphone" || $rdGroup!="ipad" || $rdGroup!="ipod") {$fullmessage .= "$it\r\n";}
  9. I tried this before - also didn't work.
  10. if ($rdGroup="it") {$fullmessage .= "$it\r\n";}
  12. if ($rdGroup="it") {$fullmessage .= "IT";}
Any help would be much appreciated!
May 7 '12 #1
Share this Question
Share on Google+
2 Replies

P: 1,059
in php = is assignment operator.

Expand|Select|Wrap|Line Numbers
  1. //say you have selected "ipod"
  2. //if your try this code what happen is important
  4. if ($rdGroup="it") //FIRST IT SET the value of $rdGroup to "it" and then it varify the statement, which is true
  5. {
  6. //it enter here.
  7.  $fullmessage .= "$it\r\n";
  9. }
  11. if ($rdGroup="it") //then again same thing and it enter here
  12. {
  13. $fullmessage .= "IT";
  15. }
the corrected code for comparing two argument for equality is ==
as example
Expand|Select|Wrap|Line Numbers
  1. if($i==3) .. //do action
some compiler dont allow to assign in the if statement but php does, so be careful
May 7 '12 #2

P: 2
I'm sorry, I'm not understanding completely what I have to do. When I I try anything like that it does not work.
May 7 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.