Author
Message
gunit86 New Member Joined: Apr 23, 2008 Posts: 13
Posted:
Thu May 08, 2008 12:23 pm
I would like to add option value for the country and state field where the user have to choose the value from the option value when he's posting the ads. I've tried but it didn't work out. Do you I have to insert the value into the database? Here's the code for the reference:
Code:
echo "<TR><TD><b>"._NUKECBY." </b>: ".$memberinfo[username]."</td>";
echo "</tr>\n";
echo "<TR><TD><b>"._NUKEC_CITY." :</b> ".$xcity."</td></tr>";
echo "<TR><TD><b>"._NUKEC_STATE." :</b> ".$xstate."</td></tr>";
echo "<TR><TD><b>"._NUKEC_COUNTRY." :</b> ".$xcountry."</td></tr>";
echo "<TR><TD><b>"._NUKECPOSTEDON." : </b>".FormatDateAds($xdateposted,$Date_Format_code)."</td></tr>";
echo "<TR><TD><b>"._NUKECEXPDON." :</b> ".FormatDateAds($xvaliduntil,$Date_Format_code)."</td></tr>";
if (($xprice != "") and ($xprice != 0)) {
echo "<TR><TD><b>"._NUKECADSPRICE." :</b> ".formatPrice($xcurr,$xprice,$Price_Format_code)."</td></tr>";
}
the above code is function.php
Code:
echo "<tr><td width=\"25%\" valign=\"top\"><b>"._NUKEC_STATE."</b></td><td width=\"5\">:</td><td><input type=\"text\" name=\"state\" size=\"25\"></td></tr>\n";
echo "<tr><td width=\"25%\" valign=\"top\"><b>"._NUKEC_COUNTRY."</b></td><td width=\"5\">:</td><td><input type=\"text\" name=\"country\" size=\"25\"></td></tr>\n";
echo "<tr><td width=\"25%\" valign=\"top\"><b>"._NUKEADSPOSTFOR." </b></td><td width=\"5\">:</td><td>\n"
."<select name=\"postfor\">\n";
buildduration($sel="");
echo "</select></td></tr>\n";
if ($UploadImg) {
echo "<tr><td width=\"25%\" valign=\"top\"><b>"._NUKECADSUPLOAD."</b></td><td width=\"5\">:</td>\n"
."<td><input type=\"file\" name=\"fileupload\" size=\"40\"></td></tr>\n";
} else {
echo "<input type=\"hidden\" name=\"fileupload\" value=\"\">";
}
if ($multilingual) {
echo "<TR><TD><b>"._NUKECLANGUAGE."</b></td><TD><b>:</b></td><TD>";
echo "<select name=\"adslanguage\">\n";
$handle=opendir('language');
while ($file = readdir($handle)) {
if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
$langFound = $matches[1];
$languageslist .= "$langFound ";
}
}
closedir($handle);
$languageslist = explode(" ", $languageslist);
sort($languageslist);
for ($i=0; $i < sizeof($languageslist); $i++) {
if($languageslist[$i]!="") {
echo "<option value=\"$languageslist[$i]\" ";
if($languageslist[$i]==$currentlang) echo "selected";
echo ">".ucfirst($languageslist[$i])."</option>\n";
}
}
echo "</select></td></tr>";
} else {
echo "<input type=\"hidden\" name=\"adslanguage\" value=\"\">\n";
}
echo "<TR><TD colspan=\"3\"><input type=\"submit\" value=\""._NUKECSUBMIT."\"></td></tr>";
echo "<input type=\"hidden\" name=\"op\" value=\"SubmitAds\">";
echo "</form>";
echo "</table>";
}
} else {
echo "<center><font class=\"title\">"._NUKECPOSTNEWADS."</font></center><BR>\n";
printnotallowforanonymouse();
}
CloseTable();
include("footer.php");
}
function SubmitAds($submitteruid,$title, $cdesc, $catgforprocess, $AdsCurr, $price, $website, $email, $city, $state, $country, $postfor, $fileupload, $adslanguage, $fileupload, $fileupload_name, $fileupload_type, $fileupload_size) {
global $nukecprefix,$dbi,$folder_name, $module_name, $multilingual, $currentlang;
global $AdsTitleLength, $AdsContentLength, $MemberRequired, $PostInMainCatg, $cookie, $user, $UploadImg,$Waiting;
global $anonymous;
global $UploadPath,$cookie,$user,$DescLength,$UploadImg, $MaxImgSize, $MaxImgHeight, $MaxImgWidth,$MaxAllowedAds;
if ($submitteruid != 1) {
$jmladsposted = AdsPostedByUser($submitteruid,0,0,0);
if ($jmladsposted >= $MaxAllowedAds) {
$NotAllowedByJml = 1;
} else {
$NotAllowedByJml = 0;
}
if ($NotAllowedByJml == 1) {
header("Location:modules.php?name=".$module_name."&file=postads&id_catg=$catgforprocess");
die();
}
}
if (is_user($user) || ($MemberRequired == 0)) {
if ((!$title) || ($title == "") || (strlen($title) > $AdsTitleLength)) $errorTitle = 1;
if ((!$cdesc) || ($cdesc == "") || (strlen($cdesc) > $AdsContentLength)) $errorCdesc = 1;
if ((!$email) || ($email == "") || (strlen($email) == "")) $errorEmail1 = 1;
if ($submitteruid == 1) {
if ($email == "") {
$erroremailanony = 1;
}
}
if ($email != ""){
if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$",$email)) $errorEmail = 1;
}
if ($UploadImg && ($fileupload != "") && ($fileupload != "none")) {
$imageadstype = basename($fileupload_type);
$UploadImageType = getImgType();
The above code is post.php
I need option value for the country field where users can choose from the option value. Tks
Your help are appreciated
Raven Site Admin/Owner Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
Posted:
Thu May 08, 2008 1:16 pm
If you intend on saving the information then you will have to add the values to your database table.
sting Involved Joined: Sep 23, 2003 Posts: 460 Location: Somewhere out there...
Posted:
Thu May 08, 2008 1:28 pm
You could use an html select for the country and either post your options for countries via html (not recommended) or have the options pulled from a database table using a select statement and looping through the records.
As Raven said, if you inted on saving the info, you will need to add the values to your table and to your SQL Insert statement.
-sting
View next topic
View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum