Dear all,
I'm trying to add a new field in a script that i'm using, but i'm struggling to find where it is!!
I'm trying to edit a form that I use when someone is posting a job - and i need to add a "Post code" field.
I've created the row in the database, alongside all the other fields.
But now i don't know how to insert that text field etc onto the actual page.
I can't find it!
Any ideas?
Thank you
I'm trying to add a new field in a script that i'm using, but i'm struggling to find where it is!!
I'm trying to edit a form that I use when someone is posting a job - and i need to add a "Post code" field.
I've created the row in the database, alongside all the other fields.
But now i don't know how to insert that text field etc onto the actual page.
I can't find it!
Any ideas?
Thank you
PHP:
<?php
if($FREE_WEBSITE)
{
$AddStep = 2;
$package=0;
}
?>
<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_buttons1 : "bold,italic,underline,separator,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
theme_advanced_buttons2 : "fontselect,fontsizeselect,forecolor",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "none",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
});
</script>
<table summary="" border="0" width=95%>
<tr>
<td width=40>
<img src="images/icons/email.gif" width="40" height="34" alt="" border="0">
</td>
<td class=basictext>
<span class="header_title">
<?php echo $POST_NEW_ADD;?>
</span>
</td>
</tr>
</table>
<?php
if(!isset($AddStep))
{
$AddStep = 1;
}
if(isset($ProceedSelectPackage))
{
if(!isset($package)||$package=="")
{
echo "
<script>
alert('$PLEASE_SELECT_PACKAGE!');
</script>
";
}
else
{
$AddStep = 2;
}
}
?>
<br>
<?php
if($AddStep == 1)
{
?>
<table summary="" border="0" width=95%>
<tr>
<td class=basictext>
<b>
<?php echo $STEP_1_ADD; ?>
</b>
<br><br><br>
<form action=index.php method=post>
<input type=hidden name="ProceedSelectPackage" value="1">
<input type=hidden name=category value="<?php echo $category; ?>">
<input type=hidden name=action value="<?php echo $action; ?>">
<?php
$hasPackages = false;
$packages = DataTable("ext_packages_employer","WHERE ads>0 AND employer='$AuthUserName'");
$hasValidPackages = false;
while($oPackage = mysql_fetch_array($packages))
{
if($oPackage["active"] == "0")
{
echo "[<font color=red>".$PENDING_VALIDATION."</font>]";
}
else
{
$hasValidPackages = true;
echo
"<br>
<input type=radio name=package value=\"".$oPackage["id"]."\">
";
}
echo
"
$M_JOB_ADS: <b>".$oPackage["ads"]."</b>
$M_VALID: <b>".$oPackage["valid"]." $M_DAYS</b>
[$PRICE_WHOLE_PACKAGE: <b>".$oPackage["price"]." ".$M_CREDITS."]</b>
<br><br>
";
$hasPackages = true;
}
?>
<br><br>
<?php
if($hasPackages && $hasValidPackages)
{
?>
<input type=submit value=" <?php echo $M_SELECT;?> " class=adminButton>
<?php
}
else
{
?>
<b><font color=red><?php echo $ANY_VALID_PACKAGES;?></font></b>
<br><br><font size="6">Please click <a href="index.php?category=postings&page=pacakges">here</a> to get a <strong>FREE</strong> job package</font><br>
<?php
}
?>
</form>
</td>
</tr>
</table>
<?php
}
?>
<?php
if($AddStep == 2)
{
$arrPackageEmployer = DataArray("ext_packages_employer","id=$package");
if(!$FREE_WEBSITE&&$arrPackageEmployer["ads"]<1)
{
die("<script>document.location.href='index.php?category=postings&action=add';</script>");
}
?>
<table summary="" border="0" width=95%>
<tr>
<td class=basictext>
<b>
<?php
if(!isset($SpecialProcessAddForm))
{
if(!$FREE_WEBSITE)
{
echo $STEP_2_ADD;
}
?>
<br><br>
<?php
}
?>
</b>
</td>
</tr>
</table>
<script>
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
function NewJob(x)
{
if(x.title.value=="")
{
alert("<?php echo $JOB_TITLE_EMPTY;?>");
x.title.focus();
return false;
}
if(tinyMCE.getContent().trim()=="")
{
alert("<?php echo $JOB_DESCRIPTION_EMPTY;?>");
return false;
}
return true;
}
</script>
<?php
$jsValidation="NewJob";
$arrOtherValues = array(array("date",date("F j, Y, g:i a")) , array("employer",$AuthUserName));
if(isset($SpecialProcessAddForm))
{
if(trim($title) == "")
{
echo "
<table width=575><tr><td>
<font color=red>
<b>$JOB_TITLE_EMPTY</b>
</font></td></tr></table><br>";
$doNotAdd = true;
}
if(trim($message) == "")
{
echo "
<table width=575><tr><td>
<font color=red>
<b>$JOB_DESCRIPTION_EMPTY</b>
</font></td></tr></table><br>";
$doNotAdd = true;
}
}
$strSpecialHiddenFieldsToAdd = "
<input type=hidden name=AddStep value=2>
<input type=hidden name=package value=$package>
";
if(is_array(unserialize(stripslashes(aParameter(280)))))
{
$arrPropertyFields = unserialize(stripslashes(aParameter(280)));
}
else
{
$arrPropertyFields = array();
}
if(isset($SpecialProcessAddForm))
{
$arrPValues = array();
$iFCounter = 0;
foreach($arrPropertyFields as $arrPropertyField)
{
$v_name = "pfield".$iFCounter;
$arrPValues[$arrPropertyField[0]]=$$v_name;
$iFCounter++;
}
}
else
{
$iFCounter = 0;
foreach($arrPropertyFields as $arrPropertyField)
{
$strSpecialHiddenFieldsToAdd.="<tr>";
$strSpecialHiddenFieldsToAdd.= "<td ><i>".str_show($arrPropertyField[0], true).":</i></td>";
$strSpecialHiddenFieldsToAdd.= "<td >";
if(trim($arrPropertyField[2]) != "")
{
$strSpecialHiddenFieldsToAdd.= "<select name=\"pfield".$iFCounter."\" style=\"width:150px\">";
$arrFieldValues = explode("\n", trim($arrPropertyField[2]));
if(sizeof($arrFieldValues) > 0)
{
foreach($arrFieldValues as $strFieldValue)
{
$strFieldValue = trim($strFieldValue);
if(strstr($strFieldValue,"{"))
{
$strVName = substr($strFieldValue,1,strlen($strFieldValue)-2);
$strSpecialHiddenFieldsToAdd.= "<option ".(trim($$strVName)==$arrPropFields[$arrPropertyField[0]]?"selected":"").">".trim($$strVName)."</option>";
}
else
{
$strSpecialHiddenFieldsToAdd.= "<option ".(isset($arrPropFields[$arrPropertyField[0]])&&trim($strFieldValue)==$arrPropFields[$arrPropertyField[0]]?"selected":"").">".trim($strFieldValue)."</option>";
}
}
}
$strSpecialHiddenFieldsToAdd.= "</select>";
}
else
{
$strSpecialHiddenFieldsToAdd.= "<input value=\"".(isset($arrPropFields[$arrPropertyField[0]])?$arrPropFields[$arrPropertyField[0]]:"")."\" type=text name=\"pfield".$iFCounter."\" style=\"width:150px\">";
}
$strSpecialHiddenFieldsToAdd.= "</td>";
$strSpecialHiddenFieldsToAdd.= "</tr>";
$iFCounter++;
}
}
if($FREE_WEBSITE)
{
$arrNames2 = array("date","employer","expires");
$arrValues2 = array(time(),$AuthUserName, (time() + $FREE_WEBSITE_ADS_EXPIRE_DAYS*86400) );
}
else
{
$arrNames2 = array("date","employer","expires");
$arrValues2 = array(time(),$AuthUserName, (time() + $arrPackageEmployer["valid"]*86400) );
}
if(isset($arrPValues))
{
array_push($arrNames2,"more_fields");
array_push($arrValues2,serialize($arrPValues));
}
$iLId = -1;
$strJobType="";
foreach($arrJobTypes as $arrJobType)
{
if($arrJobType[0]==0) continue;
$strJobType.="_".$arrJobType[1]."^".$arrJobType[0];
}
if($ASK_FOR_ZIP)
{
$insertID = AddNewForm(
array("$M_CATEGORY:","$M_REGION:","$M_ZIP:",$M_JOB_TYPE.":",$str_PageNamePage,"$TEXT_MESSAGE:",$M_SALARY.": ".$CURRENCY_SYMBOL,$M_DATE_AVAILABLE.":","$M_CONTACT:","$ACTIVE:","$M_NOTIFICATION:"),
array("job_category","region","zip","job_type","title","message","salary","date_available","contact_person","active","notification"),
array("combobox_special","combobox_special","textbox_8","combobox".$strJobType,"textbox_67","textarea_50_20","textbox_8","textbox_8","combobox_special","combobox_YES_NO","combobox_YES_NO"),
" $ADD_POSTING ",
"ext_postings",
"<b>$NEW_POSTING_ADDED</b>"
);
}
else
{
$insertID = AddNewForm(
array("$M_CATEGORY:","$M_REGION:",$M_JOB_TYPE.":",$str_PageNamePage,"$TEXT_MESSAGE:",$M_SALARY.":",$M_DATE_AVAILABLE.":","$M_CONTACT:","$ACTIVE:","$M_NOTIFICATION:"),
array("job_category","region","job_type","title","message","salary","date_available","contact_person","active","notification"),
array("combobox_special","combobox_special","combobox".$strJobType,"textbox_67","textarea_50_20","textbox_8","textbox_8","combobox_special","combobox_YES_NO","combobox_YES_NO"),
" $ADD_POSTING ",
"ext_postings",
"<b>$NEW_POSTING_ADDED</b>"
);
}
if($iLId > 1)
{
if(!isset($doNotAdd))
{
if($SEND_EMAIL_NOTIFICATIONS)
{
$headers = "From: \"".$SYSTEM_EMAIL_FROM."\"<".$SYSTEM_EMAIL_ADDRESS.">\n";
$tableRules = DataTable("ext_rules","WHERE region='".$region."' AND job_category='".$job_category."' ");
while($arrRule = mysql_fetch_array($tableRules))
{
if($arrRule["rule"] == "")
{
if(trim($arrRule["user"]) != "")
{
mail($arrRule["user"],"$NEW_JOB_AD_CRITERIA","http://www.".$DOMAIN_NAME."/index.php?mod=search&job=".$iLId , $headers);
}
}
else
{
if(strstr($message,$arrRule["rule"]) || strstr($title,$arrRule["rule"]) )
{
if(trim($arrRule["user"]) != "")
{
mail($arrRule["user"],"$NEW_JOB_AD_CRITERIA","http://www.".$DOMAIN_NAME."/index.php?mod=search&job=".$iLId , $headers);
}
}
}
}
}
SQLUpdate_SingleValue
(
"ext_packages_employer",
"id",
$package,
"ads",
(intval($arrPackageEmployer["ads"])-1)
);
}
}
?>
<?php
}
?>