Basic code problem

Reply

Join Date: Mar 2008
Posts: 2
Reputation: gouthamvel is an unknown quantity at this point 
Solved Threads: 0
gouthamvel gouthamvel is offline Offline
Newbie Poster

Basic code problem

 
0
  #1
Sep 8th, 2009
  1. <?
  2. function outError($text){
  3. print "<center><b><font color = red>$text</font></b><br><br></center>";
  4. }

  1. <option value="0" <?= ($installtype == "0") ? "selected" : ""; ?> >Install with CPanel Info (can create MySQL DB automatically)</option>


I have a script with such unusual tags and the script won't work. I cannot replace them since they are a thousands in number. And search and replace also didn't work.

thank you.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 794
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Master Poster

Re: Basic code problem

 
0
  #2
Sep 8th, 2009
Hi gouthamvel and welcome to DaniWeb

I think we may need a bit more information to help you on this one. Can you please post the code for the select tag that this option tag is a part of? What do you mean by the script won't work? Does the page load? Is it just not displaying the options in the select? Are there any error messages? Is it the function that doesn't work as you would like and if so does anything happen when you call it?
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 2
Reputation: gouthamvel is an unknown quantity at this point 
Solved Threads: 0
gouthamvel gouthamvel is offline Offline
Newbie Poster

Re: Basic code problem

 
0
  #3
Sep 8th, 2009
I have attached one of the file. I am confused with <?php and <?. I got a parse error when <? was used and when I replaced it with <?php the error got away. I use php 5.x, apache 2.2
Attached Files
File Type: php install.php (18.9 KB, 2 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 794
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Master Poster

Re: Basic code problem

 
0
  #4
Sep 9th, 2009
I think these lines
  1. <option value="0" <?php ($installtype == "0") ? "selected" : ""; ?> >Install with CPanel Info (can create MySQL DB automatically)</option>
should be
  1. <option value="0" selected=<?php ($installtype == "0") ? "selected" : ""; ?> >Install with CPanel Info (can create MySQL DB automatically)</option>
Also, you should always use <?php in favour of the shorthand tags. Some servers do not support the shorthand tags, so for maximum compatibility use the longer version (it's only 3 more characters and the benefit is certainly worth it).
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,478
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: Basic code problem

 
1
  #5
Sep 9th, 2009
Actually it should be as follows:
  1. <option value="0" <?php echo ($installtype == "0" || $installtype == 0) ? "selected" : ""; ?> >Install with CPanel Info (can create MySQL DB automatically)</option>
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC