View Single Post
  #1 (permalink)  
Old Oct 26th, 2007, 15:27
eon201 eon201 is offline
Up'n'Coming Member
Join Date: Oct 2007
Location: london
Age: 25
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
sending form info to email

Hi im pretty new to php and I need to send the information from a form to a email, the code looks like this:
Code: Select all
<form class="register" action="callmeback-action.php" method="post" name="callmeback_form" onsubmit="return validate_form ( );"><input type="hidden" name="previous" value="<?PHP echo $_SERVER["HTTP_REFERER"]; ?>" />
<div id="regtype">
<div><label for="radnow">Call me NOW:</label><input type="radio" name="when" id="radnow" value="now" class="radio" checked="checked" onclick="regenable();" /></div>
<div><label for="rad30min">Call me in 30 Minutes:</label><input type="radio" name="when" id="rad30min" value="30min" class="radio" onclick="regenable();" /></div>
<div><label for="radtime">Call me at a specific time:</label><input type="radio" name="when" id="radtime" value="time" class="radio" onclick="regenable();" /></div>
</div>

<div>
<div><label for="name" id="namelabel">Name:</label><input name="name" id="name" type="text" class="text" /></div>
<div><label for="telephone" id="telephonelabel">Telephone No:</label><input name="telephone" id="telephone" type="text" class="text" /></div>
<div><label for="time" id="timelabel">Time:</label>
<?php
function get_avail_times() {
    $svrhour = date('H');
    $svrmin = date('i');
    $arrayitem = 0;
    $arr = array();
    for($i = $svrhour; $i <= 18; $i++) {
        if($i == date('H')) { // if it's the first iteration
            if(date('i') >= 0 && date('i') < 30) {
                $svrmin = 30;
                $arr[$arrayitem] = $i . ":" . $svrmin;
                $arrayitem++;
            }
            else if(date('i') >= 30 && date('i') < 0) {
                break; // continue on to the next hour, so break from loop
            }
        }
        else {
            $svrmin = 00;
            $arr[$arrayitem] = $i . ":" . $svrmin . "0";
            $arrayitem++;
            if($i < 18) {
                $svrmin = 30;
                $arr[$arrayitem] = $i . ":" . $svrmin;
                $arrayitem++;
            }
        }
    }
    return $arr;
}

$arr = get_avail_times();
echo("<select name=\"time\" id=\"time\" class=\"text\">");
foreach($arr as $tempvalue) {
echo("<option value=\" " . $tempvalue . "\"> " . $tempvalue . "</option>");
}
echo("</select>");
?>
</div>

<input type="submit" class="submit" value="Call me Back"/>
</div>
</form>
Can someone please point me in the right direction on how to do this.

Thanks in advance. Dan.
Reply With Quote