Jump to content


Photo

Need help w/ Radio Buttons and Php


  • Please log in to reply
2 replies to this topic

#1 npdeleon

npdeleon
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 03 March 2006 - 11:46 PM

Hi,

I'm a n00b to php and I'm having trouble getting my radio group and buttons to work with my php part, mostly because I'm not sure how to code it. my site is: [a href=\"http://ebiz.uoregon.edu/students/ndeleon/\" target=\"_blank\"]http://ebiz.uoregon.edu/students/ndeleon/[/a]

Here's my script that I have (before I added the radio group to the page, it worked fine):

<?php
    $message = "First Name: {$_POST['firstName']}\r\n";
    $message .= "Last Name: {$_POST['lastName']}\r\n";
    $message .= "Address: {$_POST['address']}\r\n";
    $message .= "City: {$_POST['city']}\r\n";
    $message .= "State: {$_POST['state']}\r\n";
    $message .= "Zip Code: {$_POST['zipCode']}\r\n";    
    $message .= "Phone: {$_POST['phone']}\r\n";    
    $message .= "E-mail from: {$_POST['senderEmail']}\r\n";
    $message .= "E-mail Message: {$_POST['emailMessage']}\r\n";
    if (mail("npdeleon@aol.com","Test php",$message,"From: {$_POST['senderEmail']}")) {
        echo "E-mail message mailed successfully.";
    }
    else {
        echo "Problem sending e-mail";
    }
    if (mail($_POST['senderEmail'],"E-mail from website",$message,"From: helpdesk@ebiz.uoregon.edu")) {
        echo "<br /> A copy has been sent to your e-mail address.";
    }
    else {
        echo "Problem sending e-mail<br /><br />";
    }
?>

If anyone can help me figure out how I'd code the radio group in teh php that'd be great!

#2 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 04 March 2006 - 12:58 AM

I checked the HTML on the page you provided...

<input type="radio" name="reqUpdate" value="request" />
<input type="radio" name="reqUpdate" value="update" />

It works just like a text field. Anything you call "value" will be returned just like a text field would. so

$_POST['reqUpdate'] will either equal "request" or "update" in your case. or is this your question?

#3 npdeleon

npdeleon
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 04 March 2006 - 02:24 AM

Thanks for the reply! That worked! I dunno why I didn't think of that, i appreciate your time!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users