Page 1 of 1

newbie

Posted: Sat Mar 21, 2009 9:08 am
by menorcarob
hi all

i am not very good with php, i understand some of how it works and i am trying to learn more, but it taking a long time, age thing i guess. i have bought a script after trying for months to learn to use NOF 10 to create a site, the script is good but the support is pretty grim and very slow.
the problem i have is that the form that people register on and others such as the search form, and the listing submission form all have the dropdown option of country what i need to do is make the country always "spain" and not show the option on the form, the author of the script suggested this...........

"Well, hmmm ... how about if you convert them into hidden fields and put
the default value there. Then you can hide these fields, but actually
it will still be there when the form is submitted.

Please try that."

simples eh, not for me, i have tried but i am getting nowhere, could you please look at the script and tell me where i should edit it to remove the country from view with the default of spain option on the form, many thanks in advance

robin :banghead: :(

here is the script........
<tr>
<td><font class="{$warning_member_country}"><b>Country</b></font> <font class="normal_12_red">*</font></td>
<td><b>:</b></td>
<td>
<select name="member_country" class="textbox" style="width:350px">
{section name=var loop=$member_country}
<option value="{$member_country_id[var]}" {if $member_country_id[var] == $cmember_country} selected {/if}>{$member_country_name[var]}</option>
{/section}
</select>
{php} $_SESSION['cmember_country_warn'] = ''; {/php}
</td>
</tr>

Re: newbie

Posted: Sat Mar 21, 2009 10:22 am
by php_east
this is an educated wild guess.

Code: Select all

{php} $cmember_country = 'spain'; {/php}
 
<select name="member_country" class="textbox" style="width:350px;display:none;">
{section name=var loop=$member_country}
<option value="{$member_country_id[var]}" {if $member_country_id[var] == $cmember_country} selected {/if}>{$member_country_name[var]}</option>
{/section}
</select>
{php} $_SESSION['cmember_country_warn'] = ''; {/php}
 

changes made

additions

Code: Select all

{php} $cmember_country = 'spain'; {/php} 
modifications

Code: Select all

<select name="member_country" class="textbox" style="width:350px;display:none;"> 

Re: newbie

Posted: Sat Mar 21, 2009 12:32 pm
by menorcarob
thank you very much that was a great help, what i ended doing was removing all of the text that i posted and inserted

<input type="hidden" name="member_country" value="Spain">

and it seems to work, :D


thanks for reply

robin

Re: newbie

Posted: Sat Mar 21, 2009 1:21 pm
by menorcarob
disaster

when i checked properly it does not give spain it gives "Afghanistan" which is the first value in the list, below is how the entry in the script looks now.


<tr>
<td><input type="hidden" name="member_country" value="Spain">
</td>
</tr>

<tr>

what can i do next
thanks
robin

Re: newbie

Posted: Sat Mar 21, 2009 10:14 pm
by php_east
change the one i gave to Spain, i followed your original post of spain, but after yor second post your db seems to hold Spain.

i don't think you can do it the way you tried, because the template extracts from the db and select is defaulted to one, so you need to invoke the select, which is why i chose to preserve the original template codes.