Add <sup> in PHP not working [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
I am editing a wordpress page and I am required to put square meter simbol m2 into a textbox. However I've been at it for an hour or more and I cannot get it to work. Php errors range from syntax error to T_ENCLOSED_STRING.
The Min Area (m2) is the text I want to edit.
The code:
<input type="text" class="field" name="area-min" id="area-min"
placeholder="<?php _e('Min Area (in m2)','realspace'); ?>"
value="<?php echo $_GET['area-min']; ?>" />

You can't put HTML in a placeholder. What you want is the special character ² which is ²
e.g.
_e('Min Area (in M²)','realspace')

You can't put HTML tag in inputs. But, you can use superscript characters:
<input type="text" class="field" name="area-min" id="area-min"
placeholder="Min Area (in m²)"
value="<?php echo $_GET['area-min']; ?>" />
Here, I'm using the ² character.
See also: Superscript in input field of text type

Related

PHP Syntax error unexpected ending while using if-else in input tag [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I'm getting syntax error when i use if-else inside form <input tag using php to change Value
<input type="text" name="ecsname" class="form-control"
<?php if(empty($_GET['id'])){?>
value="" <?php}else{?>
value="<?php echo $res->cshort;?>"
<?php}?>
>
You can clean up your existing code so it's much nicer to read and also separates out the logic from the output.
<?php $ecsname_value = empty($_GET['id'])?"":$res->cshort;?>
<input type="text" name="ecsname" class="form-control" value="<?=$ecsname_value;?>">
<?php $ecsname_value = empty($_GET['id'])?"":$res->cshort;?> is a shorter version of your if/else using the ternary operator.
This assumes that $res->cshort is defined somewhere.

Can PHP constants be called in HTML form tag? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
While working on a project, we've created global constants in a PHP file. When accessing these global constants in HTML to specify the name for POST variables, is the following correct:
<input type="text" name="<?PHPecho POST_CONSTANT;?>" class="form-control" placeholder="Post Constant" />
Is it more appropriate to use htmlspecialchars(CONSTANT);?
I'm not 100% certain, but I think the php needs to be lowercase in the open tag and you need a space (or other whitespace character) before the echo.
<input name="<?php echo POST_CONSTANT; ?>" />
If you anticipate the constants ever having special characters then, yes, you should probably escape them. If it is just values you define as simple alphanumeric strings, then probably not necessary.

Can not view images with spaces in its name [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
i cant view images with spaces in its name ex: Google Twitter.JPG is not loading and its name is changed to Google%20Twitter.JPG after the PHP echo method .
<image width=150px height = 100px src="upload/profiles/<?php echo trim($image); ?> >
You have an error in your markup.
Change <image width=150px...
to
<img width=150px...
This is a requirement in W3 Standards
From http://www.w3schools.com/tags/ref_urlencode.asp :
URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign or with %20.
You should rename your images, and replace the spaces with either dashes - or underscores _
As pointed out in comments, you are missing a quote, and have some errors in your line. image should be img and your height and width attributes should be in quotes with no spaces.
<img width="150px" height="100px" src="upload/profiles/<?php echo trim($image);?>" />

php tags not working. what is diference between php tags <php and <? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
First code is fine but textfield give back all php tag
<td><?php print($code_verification);?>
<input type="text" name="packaging_code" id="packaging_code" value="<?=$code_verification?>" />
Change:
value="<?=$code_verification?>"
to:
value="<?php echo $code_verification; ?>"
The first line would work if your server had short_open_tags enabled.
your first code will work if you enable short tags.otherwise you can try below code
<input type="text" name="packaging_code" id="packaging_code" value="<?php echo $code_verification; ?>" />

How to Make Checkboxes Into Array In Dreamweaver [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I am designing a seat reservation system. I want the check boxes to represent the seats.
I want to know how to make each check boxes into array and how to group all the check boxes in a single canvas so that it will store multiple values in one single variable in the database column.
I am using Dreamweaver and PHP.
You should do some like below:
<input type="checkbok" value="1" name="seat[]" />
<input type="checkbok" value="2" name="seat[]" />
<input type="checkbok" value="3" name="seat[]" />
<input type="checkbok" value="4" name="seat[]" />
....

Categories