hi all :), i always have a problem in giving a message to the one who register a confirmation or activation link to be enable to use his account.

here's my code

register.php

<form name="form1" method="post" action="adduser.php">

            <table width="121%" border="0" cellspacing="0" cellpadding="0">

              <tr>

                <td width="27%" class="style4"><div align="right" class="style1">Username:</div></td>

                <td width="4%" class="style4">&nbsp;</td>

                <td width="69%"><label><font face="Tahoma"><b><font color="#808080">
                  <input name="username" type="text" id="username" style="font-size:8pt; background-color:ddd6b9; color:000000;border-color:000000" />
                </font></b></font></label></td>
              </tr>

              <tr>

                <td class="style4"><div align="right" class="style1"><span class="style4">Password:</span></div></td>

                <td class="style4">&nbsp;</td>

                <td><label><font face="Tahoma"><b><font color="#808080">
                  <input name="password" type="text" id="password" style="font-size:8pt; background-color:ddd6b9; color:000000;border-color:000000" />
                </font></b></font></label></td>
              </tr>

              <tr>

                <td class="style4"><div align="right" class="style1">Verify Password:</div></td>

                <td class="style4">&nbsp;</td>

                <td><label><font face="Tahoma"><b><font color="#808080">
                  <input name="pass2" type="text" id="pass2" style="font-size:8pt; background-color:ddd6b9; color:000000;border-color:000000" />
                </font></b></font></label></td>
              </tr>

              

              <tr>

                <td class="style4"><div align="right" class="style1">Full Name: </div></td>

                <td class="style4">&nbsp;</td>

                <td><label><font face="Tahoma"><b><font color="#808080">
                  <input name="name" type="text" id="name" style="font-size:8pt; background-color:ddd6b9; color:000000;border-color:000000" />
                </font></b></font></label></td>
              </tr>
              <tr>

                <td class="style4"><div align="right" class="style1">Email Address:</div></td>

                <td class="style4">&nbsp;</td>

                <td><font face="Tahoma"><b><font color="#808080">

                  <INPUT NAME="email" TYPE="text" id="email" style="font-size:8pt; background-color:ddd6b9; color:000000;border-color:000000">

                </font></b></font></td>
              </tr>

              <tr>

                <td class="style4 style1"><div align="right">Country:</div></td>

                <td class="style4">&nbsp;</td>

                <td><font face="Tahoma"><b><font color="#808080">

                  <select name="country" size="1" id="country" style="font-size:8pt; background-color:ddd6b9; color:000000;border-color:000000">

                    <option SELECTED value="">Choose a Country 
                      <option value="USA">United states of America 
                      <option value="CAN">Canada 
                      <option value="DEU">Germany 
                      <option value="FRA">France 
                      <option value="GBR">United Kingdom 
                      <option value="IND">India 
                      <option value="">--------------------- 
                      <option value="AFG">Afghanistan 
                      <option value="ALB">Albania 
                      <option value="DZA">Algeria 
                      <option value="ASM">American Samoa 
                      <option value="AND">Andorra 
                      <option value="AGO">Angola 
                      <option value="AIA">Anguilla 
                      <option value="ATA">Antarctica 
                      <option value="ATG">Antigua and Barbuda 
                      <option value="ARG">Argentina 
                      <option value="ARM">Armenia 
                      <option value="ABW">Aruba 
                      <option value="AUS">Australia 
                      <option value="AUT">Austria 
                      <option value="AZE">Azerbaijan 
                      <option value="BHS">Bahamas 
                      <option value="BHR">Bahrain 
                      <option value="BGD">Bangladesh 
                      <option value="BRB">Barbados 
                      <option value="BLR">Belarus 
                      <option value="BEL">Belgium 
                      <option value="BLZ">Belize 
                      <option value="BEN">Benin 
                      <option value="BMU">Bermuda 
                      <option value="BTN">Bhutan 
                      <option value="BOL">Bolivia 
                      <option value="BIH">Bosnia and Herzegowina 
                      <option value="BWA">Botswana 
                      <option value="BVT">Bouvet Island 
                      <option value="BRA">Brazil 
                      <option value="IOT">British Indian Ocean Territory 
                      <option value="BRN">Brunei Darussalam 
                      <option value="BGR">Bulgaria 
                      <option value="BFA">Burkina Faso 
                      <option value="BDI">Burundi 
                      <option value="KHM">Cambodia 
                      <option value="CMR">Cameroon 
                      <option value="CPV">Cape Verde 
                      <option value="CYM">Cayman Islands 
                      <option value="CAF">Central African Republic 
                      <option value="TCD">Chad 
                      <option value="CHL">Chile 
                      <option value="CHN">China 
                      <option value="CXR">Christmas Island 
                      <option value="CCK">Cocoa (Keeling) Islands 
                      <option value="COL">Colombia 
                      <option value="COM">Comoros 
                      <option value="COG">Congo 
                      <option value="COK">Cook Islands 
                      <option value="CRI">Costa Rica 
                      <option value="CIV">Cote Divoire 
                      <option value="HRV">Croatia (local name: Hrvatska) 
                      <option value="CUB">Cuba 
                      <option value="CYP">Cyprus 
                      <option value="CZE">Czech Republic 
                      <option value="DNK">Denmark 
                      <option value="DJI">Djibouti 
                      <option value="DMA">Dominica 
                      <option value="DOM">Dominican Republic 
                      <option value="TMP">East Timor 
                      <option value="ECU">Ecuador 
                      <option value="EGY">Egypt 
                      <option value="SLV">El Salvador 
                      <option value="GNQ">Equatorial Guinea 
                      <option value="ERI">Eritrea 
                      <option value="EST">Estonia 
                      <option value="ETH">Ethiopia 
                      <option value="FLK">Falkland Islands (Malvinas) 
                      <option value="FRO">Faroe Islands 
                      <option value="FJI">Fiji 
                      <option value="FIN">Finland 
                      <option value="FXX">France, Metropolitan 
                      <option value="GUF">French Guiana 
                      <option value="PYF">French Polynesia 
                      <option value="ATF">French Southern Territories 
                      <option value="GAB">Gabon 
                      <option value="GMB">Gambia 
                      <option value="GEO">Georgia 
                      <option value="GHA">Ghana 
                      <option value="GIB">Gibraltar 
                      <option value="GRC">Greece 
                      <option value="GRL">Greenland 
                      <option value="GRD">Grenada 
                      <option value="GLP">&gt;Guadeloupe 
                      <option value="GUM">Guam 
                      <option value="GTM">Guatemala 
                      <option value="GIN">Guinea 
                      <option value="GNB">Guinea-Bissau 
                      <option value="GUY">Guyana 
                      <option value="HTI">Haiti 
                      <option value="HMD">Heard and Mc Donald Islands 
                      <option value="HND">Honduras 
                      <option value="HKG">Hong Kong 
                      <option value="HUN">Hungary 
                      <option value="ISL">Iceland 
                      <option value="IDN">Indonesia 
                      <option value="IRN">Iran (Islamic Republic of) 
                      <option value="IRQ">Iraq 
                      <option value="IRL">Ireland 
                      <option value="ISR">Israel 
                      <option value="ITA">Italy 
                      <option value="JAM">Jamaica 
                      <option value="JPN">Japan 
                      <option value="JOR">Jordan 
                      <option value="KAZ">Kazakhstan 
                      <option value="KEN">Kenya 
                      <option value="KIR">Kiribati 
                      <option value="PRK">Korea, North 
                      <option value="KOR">Korea, South 
                      <option value="KWT">Kuwait 
                      <option value="KGZ">Kyrgyzstan 
                      <option value="LAO">Lao Peoples Democratic Republic 
                      <option value="LVA">Latvia 
                      <option value="LBN">Lebanon 
                      <option value="LSO">Lesotho 
                      <option value="LBR">Liberia 
                      <option value="LBY">Libyan Arab Jamahiriya 
                      <option value="LIE">Liechtenstein 
                      <option value="LTU">Lithuania 
                      <option value="LUX">Luxembourg 
                      <option value="MAC">Macau 
                      <option value="MDG">Madagascar 
                      <option value="MWI">Malawi 
                      <option value="MYS">Malaysia 
                      <option value="MDV">Maldives 
                      <option value="MLI">Mali 
                      <option value="MLT">Malta 
                      <option value="MHL">Marshall Islands 
                      <option value="MTQ">Martinique 
                      <option value="MRT">Mauritania 
                      <option value="MVS">Mauritius 
                      <option value="MYT">Mayotte 
                      <option value="MEX">Mexico 
                      <option value="FSM">Micronesia, Federated states of 
                      <option value="MDA">Moldova, Republic of 
                      <option value="MCO">Monaco 
                      <option value="MNG">Mongolia 
                      <option value="MSR">Montserrat 
                      <option value="MAR">Morocco 
                      <option value="MOZ">Mozambique 
                      <option value="MMR">Myanmar 
                      <option value="NAM">Namibia 
                      <option value="NRU">Nauru 
                      <option value="NPL">Nepal 
                      <option value="NLD">Netherlands 
                      <option value="ANT">Netherlands Antilles 
                      <option value="NCL">New Caledonia 
                      <option value="NZL">New Zealand 
                      <option value="NIC">Nicaragua 
                      <option value="NER">Niger 
                      <option value="NGA">Nigeria 
                      <option value="NIU">Niue 
                      <option value="NFK">Norfolk Island 
                      <option value="MNP">Northern Mariana Islands 
                      <option value="MOR">Norway 
                      <option value="OMN">Oman 
                      <option value="PAK">Pakistan 
                      <option value="PLW">Palau 
                      <option value="PAN">Panama 
                      <option value="PNG">Papua New Guinea 
                      <option value="PRY">Paraguay 
                      <option value="PER">Peru 
                      <option value="PHL">Philippines 
                      <option value="PCN">Pitcairn 
                      <option value="POL">Poland 
                      <option value="PRT">Portugal 
                      <option value="PRI">Puerto Rico 
                      <option value="QAT">Qatar 
                      <option value="REU">Reunion 
                      <option value="ROM">Romania 
                      <option value="RUS">Russian Federation 
                      <option value="RWA">Rwanda 
                      <option value="KNA">Saint Kitts and Nevis 
                      <option value="LCA">Saint Lucia 
                      <option value="VCT">Saint Vincent and the Grenadines 
                      <option value="WSM">Samoa 
                      <option value="SMR">San Marino 
                      <option value="STP">Sao Tome and Principe 
                      <option value="SAU">Saudi Arabia 
                      <option value="SEN">Senegal 
                      <option value="SYC">Seychelles 
                      <option value="SLE">Sierra Leone 
                      <option value="SGP">Singapore 
                      <option value="SVK">Slovakia (Slovak Republic) 
                      <option value="SVN">Slovenia 
                      <option value="SLB">Solomon Islands 
                      <option value="SOM">Somalia 
                      <option value="ZAF">South Africa 
                      <option value="ESP">Spain 
                      <option value="LKA">Sri Lanka 
                      <option value="SHN">St. Helena 
                      <option value="SPM">St. Pierre and Miquelon 
                      <option value="SDN">Sudan 
                      <option value="SUR">Suriname 
                      <option value="SJM">Svalbard and Jan Mayen Islands 
                      <option value="SWZ">Swaziland 
                      <option value="SWE">Sweden 
                      <option value="CHE">Switzerland 
                      <option value="SYR">Syrian Arab Republic 
                      <option value="TWN">Taiwan 
                      <option value="TJK">Tajikistan 
                      <option value="TZA">Tanzania, United Republic of 
                      <option value="THA">Thailand 
                      <option value="TGO">Togo 
                      <option value="TKL">Tokelau 
                      <option value="TON">Tonga 
                      <option value="TTO">Trinidad and Tobago 
                      <option value="TUN">Tunisia 
                      <option value="TUR">Turkey 
                      <option value="TKM">Turkmenistan 
                      <option value="TCA">Turks and Caicos Islands 
                      <option value="TUV">Tuvalu 
                      <option value="UGA">Uganda 
                      <option value="UKR">Ukraine 
                      <option value="ARE">United Arab Emirates 
                      <option value="UMI">United states Minor Outlying Islands 
                      <option value="URY">Uruguay 
                      <option value="UZB">Uzbekistan 
                      <option value="VUT">Vanuatu 
                      <option value="VAT">Vatican City state (Holy See) 
                      <option value="VEN">Venezuela 
                      <option value="VNM">Viet Nam 
                      <option value="VGB">Virgin Islands (British) 
                      <option value="VIR">Virgin Islands (U.S.) 
                      <option value="WLF">Wallisw and Futuna Islands 
                      <option value="ESH">Western Sahara 
                      <option value="YEM">Yeman 
                      <option value="YUG">Yugoslavia 
                      <option value="ZAR">Zaire 
                      <option value="ZMB">Zambia 
                      <option value="ZWE">Zimbabwe 
                      <option value="UNK">Not Listed 
                    </select>
                </font></b></font></td>
              </tr>

              <tr>

                <td class="style4"><div align="right" class="style1">Telephone No.:</div></td>

                <td class="style4">&nbsp;</td>

                <td><font face="Tahoma"><b><font color="#808080">

                  <INPUT NAME="contactno" TYPE="text" id="contactno" style="font-size:8pt; background-color:ddd6b9; color:000000;border-color:000000">

                </font></b></font></td>
              </tr>

              <tr>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>
              </tr>

              <tr>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td><font face="Tahoma"><b><font color="#808080">

                  </font><font face="Tahoma"><b><font color="#808080">

                  <input name="submit" type="submit" id="submit">

                  <label>

                  <input type="reset" name="reset" id="reset" value="Reset"style="font-size:8pt; background-color:ddd6b9; color:000000;border-color:000000">
                  </label>

                  </font></b></font><font color="#808080">

                  <label></label>

                  </font></b></font></td>
              </tr>

              <tr>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>
              </tr>

              <tr>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>
              </tr>
            </table>

                    </form>

adduser.php

<?php
include('dbconnect.php');

// table name
$tbl_name=temp_members_db;

// Random confirmation code
$confirm_code=md5(uniqid(rand()));

// values sent from form
$username=$_POST['username'];
$name=$_POST['name'];
$password=$_POST['password'];
$email=$_POST['email'];
$country=$_POST['country'];
$contactno=$_POST['contactno'];

// Insert data into database
$sql="INSERT INTO temp_members_db (confirm_code, username, name, email, password, country, contactno) VALUES ('$confirm_code', '$username', '$name', '$email', '$password', '$country', '$contactno')";
$result=mysql_query($sql);

// if suceesfully inserted data into database, send confirmation link to email
if($result){

// send e-mail to ...
$to=$email;

// Your subject
$subject="Reservation";

// From
$header="from: Ryan Riel Manipis <paramore_conspiracy17@yahoo.com>";

// Your message
$message="Your Comfirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://localhost/confirmation.php?passkey=$confirm_code";

// send email
$sentmail = mail($to,$subject,$message,$header);

}

// if not found
else {
echo "Not found your email in our database";
}

// if your email succesfully sent
if($sentmail){
echo "Your Confirmation link Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send Confirmation link to your e-mail address";
}

?>
Member Avatar

diafol

Just quick scan: do you get a 'Sent' message or 'Couldn't send' message?

here

Cannot send Confirmation link to your e-mail address. Couldn't send

Member Avatar

diafol

Try this instead

// send email
if($sentmail = mail($to,$subject,$message,$header)){
   echo "Your Confirmation link Has Been Sent To Your Email Address."; 
}else{
   echo "Cannot send Confirmation link to your e-mail address";
}