<?
function outError($text){
		print "<center><b><font  color = red>$text</font></b><br><br></center>";
}
<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.

Recommended Answers

All 4 Replies

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?

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

I think these lines

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

should be

<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).

Actually it should be as follows:

<option value="0"   <?php echo ($installtype == "0" || $installtype == 0) ? "selected" : ""; ?> >Install with CPanel Info (can create  MySQL  DB  automatically)</option>
commented: Well spotted! +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.