Jump to content

Archived

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

npdeleon

Need help w/ Radio Buttons and Php

Recommended Posts

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):

[code]<?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 />";
    }
?>[/code]

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Thanks for the reply! That worked! I dunno why I didn't think of that, i appreciate your time!

Share this post


Link to post
Share on other sites

×

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.