Jump to content

PHP Contact Form


rlineker

Recommended Posts

Can you be a little more specific? Or maybe post some of your existing code. This forum isn't really for providing people with scripts but we can definitely try and point you in the right direction.

If you're not sure where to start, try looking at PHP's [url=http://us2.php.net/mail]mail()[/url] function.
Link to comment
https://forums.phpfreaks.com/topic/30536-php-contact-form/#findComment-140570
Share on other sites

I have made a contact form. I want to be able to send people to a link for example  url.com/contact.php?act="posting" and url.com/contact.php?act="design". On the the contact page there is a drop down menu with the subject which are posting and design. I want it that when you have the act="posting"  posting is selected in the drop down box.

Ryan
Link to comment
https://forums.phpfreaks.com/topic/30536-php-contact-form/#findComment-140572
Share on other sites

there are so many ways to do that . One simple solution is that you can do some sort of check in your contact page...somthing like below

$option1 = '';
$option2 = '';
if($_GET['act'] == 'design'){
    $option1 = 'selected';
}
elseif($_GET['act'] == 'posting'){
    $option2 = 'selected';
}

then in your drop down list you can do this
echo '<select name="act">
            <option value="design"    $option1>design</option>
            <option value="posting"  $option2>posting</option>
        </select>';
Link to comment
https://forums.phpfreaks.com/topic/30536-php-contact-form/#findComment-140578
Share on other sites

Or.....

[code]<?php

  $akshun = $_GET['act'];
  $select = '';

  $doptions = array('design', 'posting');

  echo"<select name=\"dropdown\">";

  foreach($doptions as $option) {

  if($option == $akshun){$select = 'selected';}

  echo"<option value=\"$option\" $select>$option";

  }

  echo"</select>";

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/30536-php-contact-form/#findComment-140581
Share on other sites

[code]
<?php
$slected = $_GET['act'];  #get your var from the URL
$options = array('posting','contact','question'); #list of menu items
echo'<select name="dropdown">';
foreach($options as $option){
    echo'<option name="'.$option.'"'; if($option == $slected){echo' selected';} echo'>'.$option."</option>\n";
}
echo'</select>';
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/30536-php-contact-form/#findComment-140589
Share on other sites

*LOL* - this seems to be a competition  ;D

My favourite way:
[code]
<?php

$option = "";
$options = array("design","posting");
foreach ($options as $value)
{
  $_GET['act'] == $value ? $sel = " selected=\"selected\"" : $sel = "";
  $option .= "<option value=\"$value\"$sel>".ucfirst($value)."</option>";
}
echo <<<_SELECT

<select name="act">
$option
</select>

_SELECT;

?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30536-php-contact-form/#findComment-140592
Share on other sites

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.