Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Retrieve information with radio buttons

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 13-05-2009
Member
 
Join Date: Nov 2008
Posts: 1,022
Retrieve information with radio buttons
  

I created a site with the help of HTML and PHP for myself to maintain database.

On my site, I have a form that has 3 radio buttons (1 for "Request for appointment", 2 for "Request for information", 3 for other purposes).

Everything is ok except for radio buttons.

My HTML code for the form:

HTML Code:
 <FORM Method= "POST" action= "do_sendform.php" name= "Contact"> 
      <p align= "center"> <font face= "Bell Gothic Std Black"> Reason for contact: </font> </p> 
      <p align= "center"> 
	  <input type= "radio" name= "DemandYou" value= "Demand meeting you"> <font face= "Bell Gothic Std Black"> Application for appointment</font> 
	  <input type= "radio" name= "Intelligence" value= "Intelligence"> <font face= "Bell Gothic Std Black"> Inquiry </font> 
	  <input type= "radio" name= "Other" value= "Other"> <font face= "Bell Gothic Std Black"> Other: </font> <input type= "text" name= "Other"> </p> 
      <p align= "center"> <font face= "Bell Gothic Std Black"> Your First & Last Name: </font> <br> 
  <INPUT Type= "text" name= "sender_name" size= 30> 
  </p> 
      <p align= "center"> <font face= "Bell Gothic Std Black"> Your email address: </font> <br> 
  <INPUT Type= "text" name= "sender_email" size= 30> 
  </p> 
      <p align= "center"> <font face= "Bell Gothic Std Black"> Message: </font> <br> 
  <textarea name= "message" cols= "63" rows= "8"> </textarea> 
  </p> 
      <p align= "center"> <font face= "Bell Gothic Std Black"> <INPUT type= "submit" value= "SEND"> </font> </p> 
  </FORM>
and the PHP code

PHP Code:
<?php 
  $msg 
.= "Sender E-Mail: \t $sender_email \n"
  
$msg .= "Message: \t $message \n \n"
  
$recipient "xyz@gmail.com"
  
$mailheaders "Need fragrance <> \n"
  
$mailheaders .= Reply-to$sender_email n n "; 
  $subject = "
subject$contact n n"; 

  Mail ($recipient, $subject, $msg, $mailheaders);  

  echo "
<html> <head>"; 
  echo "
<titleNeed fragrance Contacts </title> </head> <body>; 
  echo 
"<h1 align=center> THANKS, $sender_name </h1>"
  echo 
"<p align=center>"
  echo 
"Your mail has been sent. </p>"
  echo 
"</body> </html>"
  
?>
I tried all the tests with the radio buttons but depending on the selected radio button, the subject of the email sent is changed to one of the 3 titles listed above.

Reply With Quote
  #2  
Old 13-05-2009
Member
 
Join Date: Feb 2008
Posts: 194
Re: Retrieve information with radio buttons

Are the radio buttons of the same "name"? If yes then you can easily retrieve the "value" of the selected radio in $_POST ['name_of_radios']
Reply With Quote
  #3  
Old 13-05-2009
Member
 
Join Date: Nov 2008
Posts: 1,022
Re: Retrieve information with radio buttons

I was just testing what you told me and it works. But I still have some questions:

1. I added a text box for radio buttons. Is this possible, when this button is activated it retrieves the value of the text box?

2. As soon as the form is valid, I come on a white page that returns a message to the user and say that the message was taken. I want to add a button over there namely "Back". Is it possible? How?
Reply With Quote
  #4  
Old 13-05-2009
Member
 
Join Date: Feb 2008
Posts: 194
Re: Retrieve information with radio buttons

1 - Its very simple. If the third option is selected, you use the $_POST ['name_of_field'] to get its value.

2 - I do not understand what you are trying to achieve.
Reply With Quote
  #5  
Old 13-05-2009
Member
 
Join Date: Nov 2008
Posts: 1,022
Re: Retrieve information with radio buttons

1. Thanks for the solution

2. Once the user clicked to send the form, with the help of php code, the user gets a message saying the message has been sent. The problem is that the only way to go back is to click on the button "Back" of the browser. I would like to add a button on this page to return for example on the home page?
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Retrieve information with radio buttons"
Thread Thread Starter Forum Replies Last Post
Android apps that can stream Bloomberg Radio and Hot 97 Radio Stations? Aalap Portable Devices 6 01-07-2011 10:21 PM
Getting error: Windows could not retrieve information about the disks on this computer Samaria Operating Systems 4 16-12-2010 10:26 PM
VBSript - Fancy radio buttons milnet Software Development 3 13-05-2010 01:56 PM
Convert information to radio button KADEEM Software Development 3 31-10-2009 02:47 PM
How to retrieve information from delphi getappname method Lord of the RIG Software Development 3 11-08-2009 02:31 PM


All times are GMT +5.5. The time now is 04:38 PM.