Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Confuseing Codeing Help.
Old 10-30-2005, 04:22 PM Confuseing Codeing Help.
NuWeb.co.uk's Avatar
NuWeb.co.uk is OFFLINE

Posts: 361
Trades: 0
PHP Code:
<select name="newcountry" id="newcountry">
<option <? $val="Afganistan"; if ($country == $val) echo "selected"; echo "value="'.$val.'"; ?>Afghanistan</option>
<option <? 
$val="Albania"; if ($country == $val) echo "selected"; echo "value="'.$val.'"?>Albania</option>
<option <? $val="Algeria"; if ($country == $val) echo "selected"; echo "value="'.$val.'"; ?>Algeria</option>
</select>
This is my codeing. And its THIS confuseing, because the country list is MASSIVE, as you will know their are many countries . So i had to do Find & Replace.

This is the error im getting:
Quote:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/main/public_html/templates/editprofile.html on line 25
I think its to do with this setion of codeing, as ive never done this before:
Code:
echo "value="'.$val.'";
Also is it ok, setting the variable $val for every option? .. not sure if that will work jsut testing.
__________________

Please login or register to view this content. Registration is FREE


NuWeb 10101101

Last edited by NuWeb.co.uk; 10-30-2005 at 04:25 PM..
NuWeb.co.uk is offline
Reply With Quote
View Public Profile Visit NuWeb.co.uk's homepage!
 
 
Register now for full access!
Old 10-30-2005, 04:53 PM
stoot98's Avatar
Ultra Talker

Posts: 427
Name: Stuart
Location: Glasgow, Scotland
Trades: 0
I dont think you have enough "s in that line.

PHP Code:
echo "value="'.$val.'"; 
It maybe should be...

PHP Code:
echo "value="'.$val.'""
Just a thought...

Stoot
stoot98 is offline
Reply With Quote
View Public Profile
 
Old 10-30-2005, 05:06 PM
NuWeb.co.uk's Avatar
NuWeb.co.uk is OFFLINE

Posts: 361
Trades: 0
Saddly not, i get the error with that codeing:
Code:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/main/public_html/templates/editprofile.html on line 25
------------------

Also, just changed some codeing:
Code:
<select name="newcountry" id="newcountry">
<option <? $val="Afganistan"; echo "value=\"".$val."\""; if ($country == $val) echo "selected"; ?>Afghanistan</option>
<option <? $val="Albania"; echo "value=\"".$val."\""; if ($country == $val) echo "selected"; ?>Albania</option>
</select>
This works!!!
ALTHOUGH
It is unable to display the name of the country, this is the html code it produces.
Code:
<select id="newcountry" name="newcountry">
<option value="Afganistan" selected option Afghanistan<></option>
<option value="Albania" option Albania<></option>
</select>
Any Idea.. whats gone on their?

--------------------------------

Fixed!
All that was missing in the end up was a > after ?>
__________________

Please login or register to view this content. Registration is FREE


NuWeb 10101101

Last edited by NuWeb.co.uk; 10-30-2005 at 07:08 PM..
NuWeb.co.uk is offline
Reply With Quote
View Public Profile Visit NuWeb.co.uk's homepage!
 
Reply     « Reply to Confuseing Codeing Help.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27111 seconds with 12 queries