Jump to content

hello! don't know PHP but need help :D


teanza

Recommended Posts

:P

 

hey guys-

 

i just finished a site, and need the submit button to send the information to different email addresses per the drop-down selection.  does anyone know where i can find this script?  i tried sites like hotscripts.com, but i am unsure i am even searching for the right thing!

 

thanks SO MUCH,

 

~tina~

Link to comment
https://forums.phpfreaks.com/topic/144870-hello-dont-know-php-but-need-help-d/
Share on other sites

This question is very general

It will be better if you explain a little more

Anyway, this can be done in HTML

Just use a normal submit form

 

<form name="Form" method="POST" action="/handle/" id="main_form">
</form>

 

and then put a drop down list inside

 

<select name="combobox" size="1">
<option>Words</option>
<option>Words</option>
<option>Words</option>
<option>Words</option>
<option>Words</option>
<option>Words</option>
</select>

 

Then you use the email function

 

<?php


if(mail($Send_to, $Subject, $Message, "From: $Sender")){
print"<br><br><FONT style=\"font-size:26px\" color=\"#009300\" face=\"Arial\"><B>Sent to: $SendTo  ... Sender: $Sender</B></FONT>";
}else{
print"<br><br><FONT style=\"font-size:26px\" color=\"#FF0000\" face=\"Arial\"><B>Did not send to: $SendTo  ... Sender: $Sender</B></FONT>";
}

?>

hey thanks guys.  what i need is per a dropbox selection (which is named "complexes"), the submission will go to an email based on the user's selection. here is the code i have that does not work.  it doesn't send the email or redirect the page, let alone send to multiple email addresses.

 

<?php

 

 

 

$EmailFrom = Trim(stripslashes($_POST['email']));

$EmailTo = "[email protected]";

$Subject = "Message from contact form at xxx.com";

$FirstName = Trim(stripslashes($_POST['firstname']));

$LastName = Trim(stripslashes($_POST['lastname']));

$Email = Trim(stripslashes($_POST['email']));

 

$Phone = Trim(stripslashes($_POST['telephone']));

$Complexes = Trim(stripslashes($_POST['complexes']));

$Comment = Trim(stripslashes($_POST['additionalwords']));

 

 

$Body = "Hello. Someone has sent you a message from your website xxx.com";

$Body .= "\n";

$Body .= "firstname: ";

$Body .= $FirstName;

$Body .= "\n";

$Body .= "lastname: ";

$Body .= $LastName;

$Body .= "\n";

$Body .= "email: ";

$Body .= $Email;

$Body .= "\n";

$Body .= "telephone: ";

$Body .= $Phone;

$Body .= "\n";

$Body .= "complexes: ";

$Body .= $Complexes;

$Body .= "\n";

$Body .= "additionalwords: ";

$Body .= $Comment;

$Body .= "\n";

 

 

$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

 

 

if ($success){

  print "<meta http-equiv=\"refresh\" content=\"0;URL=http://xxx/thankyou.html\">";

}

else{

  print "<meta http-equiv=\"refresh\" content=\"0;URL=http://xxx/error.html\">";

}

?>

 

any help is awesome!

 

~tina~

 

hey guys some nice person made this for me and i modified it.  still doesn't work :( !

 

<?php

 

 

if(isset($_POST['email']))

 

 

switch ($_POST['to']) {

    case 0:

        $to = "[email protected]";

        $subject = "Website Inquiry: xxx";

        break;

    case 1:

        $to = "xxx@xxx";

        $subject = "Website Inquiry: xxx";

        break;

    case 2:

        $to = "[email protected]";

        $subject = "Website Inquiry: xxx";

        break;

case 3:

        $to = "[email protected]";

        $subject = "Website Inquiry: xxx";

        break;

}

$body = "*** " . $subject . " *** \n \n";

$body .= "Name: ";

$body .= $_REQUEST["firstname"] . " " . $_REQUEST["lastname"];

$body .= "\n \n";

$body .= "Phone Number: ";

$body .= $_REQUEST["telephone"];

$body .= "\n \n";

$body .= "Email Address: ";

$body .= $_REQUEST["email"];

$body .= "\n \n";

$body .= "Comments: \n \n";

$body .= $_REQUEST["additionalwords"];

$body .= "\n \n";

$body .= "Complexes: \n \n";

$body .= $_REQUEST["complexes"];

 

 

$msgError = "error.html";

 

$msgSuccess = "thankyou.html";

 

 

 

$header = "From: ". $_REQUEST["firstname"] . " " . $_REQUEST["lastname"] . " <" . $_REQUEST["email"] . ">\r\n";

 

if (mail($to, $subject, $body, $header)) {

 

  echo $msgSuccess;

} else {

   

  echo $msgError;

}

}

{

   

?>

 

thanx if anyone helps :D

 

~tina~

Archived

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

×
×
  • Create New...

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.