Put a fixed text on an input text field

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Gagi
Forum Newbie
Posts: 2
Joined: Sun Oct 27, 2013 7:41 pm

Put a fixed text on an input text field

Post by Gagi »

Hi guys , i need someone to explain me how to put fixed text in one label for input text. There is code of field for input

Code: Select all

<div>
											<label><?php echo __("FTP server"); ?></label>
<?php											if ($ftpserver["inputType"] == "text") { ?>
												<input type="text" name="ftpserver" value="<?php echo $ftpserver["list"][1]; ?>" class="form-poshytip" title="<?php echo __("Example"); ?>: server.minecraft.rs" />
<?php											} elseif ($ftpserver["inputType"] == "select") { ?>
												<select name="ftpserver">
<?php												for ($i=1; $i<=sizeof($ftpserver["list"]); $i=$i+1) { ?>
													<option value="<?php echo $ftpserver["list"][$i]; ?>" <?php echo $ftpserver["list"][$i]["selected"]; ?>><?php echo $ftpserver["list"][$i]; ?></option>
<?php												} // end for ?>
												</select>
<?php											} elseif ($ftpserver["inputType"] == "hidden") { ?>
												<input type="hidden" name="ftpserver" value="<?php echo $ftpserver["list"][1]; ?>" />
												<b><?php echo $ftpserver["list"][1]; ?></b>
<?php											} ?>
										</div>

I have this http://s23.postimg.o...ulv0r/image.png but i need to always have this 'fixed' text in that label http://s22.postimg.org/eniz4fr3l/image.png
And i cant figure how to do that in this code situation ...
Sorry for my bad english and thanks in advance.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Put a fixed text on an input text field

Post by requinix »

Placeholder text?

Code: Select all

<input type="text" ... placeholder="server.minecraft.rs" />
Gagi
Forum Newbie
Posts: 2
Joined: Sun Oct 27, 2013 7:41 pm

Re: Put a fixed text on an input text field

Post by Gagi »

No,no i dont need that.
I need *fixed text in that field, so users do not need to write always 'server.minecraf.rs' there, beacuse that is always the same. Or in other case to they cant even to edit that field with that text, just to see what is writed in there as automatic login information(server.minecraft.rs).

In case with placeholder they need to write 'server.minecraf.rs' because they cant login without that (and 2 more informations), that is why i cant use that. I need to always have 'server.minecraft.rs' in that field as automaticly writed information, so users do not need to write that.

Again, sorry for bad english, i hope to u can understand me.
Last edited by Gagi on Mon Oct 28, 2013 7:15 pm, edited 1 time in total.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Put a fixed text on an input text field

Post by requinix »

Put the value in the textbox, mark it readonly so users see they can't edit it,

Code: Select all

<input type="text" ... value="server.minecraft.rs" readonly />
then hardcode that value into your application instead of looking to $_GET/POST.
Post Reply