jQuery Select Failed To Change Input Value [closed] - php

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
I have this jquery inside PHP code :
echo '<select id="state" name="state" onchange="document.getElementById(\'state_text_content\').value=this.options[this.selectedIndex].text>
'.$list_state.'
</select>
<input type="hidden" name="state_text" id="state_text_content" value="" />';
why onchange function doesn't update #state_text_content value? thank you.

echo '<select id="state" name="state" onchange="document.getElementById(\'state_text_content\').value=this.options[this.selectedIndex].text">
'.$list_state.'
</select>
<input type="hidden" name="state_text" id="state_text_content" value="" />';
Without seeing everything, I think it's because you have a typo. There is a missing quote at the end of the onchange=""

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.

isset($_POST['submit']) not being triggered on button click [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 4 years ago.
Improve this question
The below code should echo when a user clicks on "more". I can't see the issue with the below code, so any assistance will be much appreciated.
if (isset($_POST['more'])){
echo <<<saveNewFactor
<input type="text" size="29">
saveNewFactor;
}
echo <<<saveNewFactor
</br>
<input type="submit" neme="more" value="more" class="forming7">
saveNewFactor;
In your HTML:
<input type="submit" neme="more" value="more" class="forming7">
You have spelt name as neme, change it to:
<input type="submit" name="more" value="more" class="forming7">

Echoing html code in php [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
I am trying to echo the following code in html but it deosn't seem to work.
echo '<input type="submit" value="Click!" style="width:100px;" onclick="$('#loading').show();"/>'
Please help
You have overlapping of ' quote inside the JavaScript. You need to escape the single quote like this:
echo '<input type="submit" value="Click!" style="width:100px;" onclick="$(\'#loading\').show();"/>'
// Notice the backslashes? ^ ^

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; ?>" />

Get a reference that went on this page [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
I need to get a reference that went on this page and then send it on the server.
I tried to add this field in my form
<input type="hidden" id="refferer_url" name="refferer_url" value="<?php $_SERVER['HTTP_REFERER'] ?>">
but I get nothing, when I try to go to my page from other pages using link, value of this input is empty.
What's wrong?
<input type="hidden" id="refferer_url" name="refferer_url" value="<?php $_SERVER['HTTP_REFERER'] ?>">
Echo it :
//here
<input type="hidden" id="refferer_url" name="refferer_url" value="<?php echo $_SERVER['HTTP_REFERER'] ?>">

Categories