Strona 1 z 1

[F8] MailForm - pobranie adresu z RadioButtona

: wt lut 12, 2008 8:56 pm
autor: Makafi
Witam Forumowiczów!

Mam może infantylny ale palący mnie problem. W animacji umieściłem formularz do wysyłania maili przez php, działa. Chciałbym jednak, żeby wybór adresata następował poprzez Radiobuttony.

W wersji z 1 mailem jest:
Wstawiłem 3 radiobuttony o innych instancename, wszystkie o GroupName "maile", w parametrach każdego z nich w polu Data umieściłem adresy "[email protected]", "[email protected]", "[email protected]".

Kod zmieniłem na:

Kod: Zaznacz cały

rec=maile.getValue();
serv="php";
No i pobiera zawsze pierwszego maila. Rozumiem, że muszę jakoś sprawdzić stan wszystkich 3 radiobuttonów i pobrać maila z tego o wartości "True", natomiast nie wiem jak to zrobić. Będę wdzięczny za pomoc.

Pozdrawiam,
Makafi

Re: [F8] MailForm - pobranie adresu z RadioButtona

: wt lut 12, 2008 9:54 pm
autor: Marek_bf
To: i to:

Kod: Zaznacz cały

rec=maile.getValue(); 
serv="php";
Mówi tyle co jvifoq34y7q8348713yn4vsduia9s487

P.S. [email protected] to nazwa zmiennej czy string?

Re: [F8] MailForm - pobranie adresu z RadioButtona

: wt lut 12, 2008 10:28 pm
autor: Makafi
Przepraszam, rzeczywiście niejasno opisałem.

Button send:

Kod: Zaznacz cały

on (release) {
	for (i=1; i<_parent.fields_descriptions.length; i++) {
		if (_parent[_parent.fields_descriptions[i][1]]!=_parent.fields_descriptions[i][2]) {
			this[_parent.fields_descriptions[i][1]]=_parent[_parent.fields_descriptions[i][1]]+"&777&"+_parent.fields_descriptions[i][2];
		}
		_parent.reset_txt(_parent["t"+i], _parent.fields_descriptions[i][1], _parent.fields_descriptions[i][2]);
	}
	this.recipient=_parent.rec;
	i=undefined;
	getURL("contact."+_parent.serv, "_blank", "POST");
	}
Plik contact.php

[php]<?php
<?
Error_Reporting(E_ALL & ~E_NOTICE);

while ($request = current($_REQUEST)) {
if (key($_REQUEST)!='recipient') {
$pre_array=split ("&777&", $request);
$post_vars[key($_REQUEST)][0]=$pre_array[0];
$post_vars[key($_REQUEST)][1]=$pre_array[1];
}
next($_REQUEST);
}

reset($post_vars);
$subject="Od: ".$post_vars['your_name'][0] ;
$headers= "Od: ".$post_vars['your_email'][0] ."\n";
$headers.='Content-type: text/html; charset=UTF-8';
$message='';
while ($mess = current($post_vars)) {
if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) {

$message.="<strong>".$mess[1]."</strong>   ".$mess[0]."<br>";
}
next($post_vars);
}

mail($_REQUEST['recipient'], $subject, "
<html>
<head>
<title>List</title>
</head>
<body>
<br>
".$message."
</body>
</html>" , $headers);
echo ("Twoja wiadomosc zostala wyslana!");

?>
<script>
resizeTo(300, 300);
</script>
?>[/php]

Kod pól formularza:

Kod: Zaznacz cały

[email protected];
serv="php";

var fields_descriptions= Array ("", 
									Array("t1", "your_name", "Imię i Nazwisko:"), 
									Array("t2", "your_email", "Email:"),
									Array("t3", "telephone", "Telefon:"),
									Array("t4", "message", "Wiadomość:"),
									Array("t5", "miasto", "Miasto:"),
									Array("t6", "field_3", "Address:"),
									Array("t7", "field_4", "fax:")
								);

function reset_txt(name,name2,value) {
		path=eval(_target);
		path[name2]=value;
	
	this[name].onSetFocus=function() {
		path=eval(_target);
		if(path[name2]==value) { path[name2]="";} 
	}
	
	this[name].onKillFocus=function() {
		path=eval(_target);
		if(path[name2]=="") { path[name2]=value;} 
	}
}

for (i=1; i<=fields_descriptions.length; i++) {
	reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
}
Tak więc wracając: rec to nazwa zmiennej, mó[email protected] to string (adres, na który ma zostać wysłany mail). Chcę, żeby zmienna rec była pobierana w zależności od tego, który z radiobuttonów ma wartość "true".