Echoing html code in php [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 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? ^ ^

Related

How to use esc_attr here? [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 don't know if it's ok how to use esc_attr in
echo $this->get_field_id( 'title' );
I got this. is it ok or is there an error?
echo esc_attr($this->get_field_id('title'););
If by esc_attr you mean the integrated wordpress function, you should put a string between the parenthesis. And it's used to escape html attributes.
In your case, you should get rid of the first semicolon:
echo esc_attr($this->get_field_id('title'));

How to Concatenate a PHP variable and a string [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
might be a very dumb question but i'm trying to make a html string with a php var and then html.. what the heck am I doing wrong?!? :(
$author_name = get_the_author(); ?>
<h4><?php $author_name;?> On-Demand Webinars</h4>
Thank you!
Just missed the echo.
<h4><?php echo $author_name;?> On-Demand Webinars</h4>
You missed "echo" statement
e.g
<?php echo $author_name;?> On-Demand Webinars
OR
<?=$author_name;?>

Action in form using 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 7 years ago.
Improve this question
I have a problem. Because i'm new in PHP, i don't know whether this is right or wrong syntax. Form it's not working.
<form name="edit_client" method="post" action="index3.php?page=del&id=<?php echo $row['id']; ?>&action=edit">
No problem with that.
<form name="edit_client" method="post" action="index3.php?page=del&id=<?php echo $row['id']; ?>&action=edit">
Just missed a = after id

PHP echo button with on-click wont function well [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 7 years ago.
Improve this question
I have tried to echo the button, however the link just does not work, so I thinks something is wrong with the href link, please help.
echo "<input class='button_normal' type='button' value='entertainment' onclick='window.location..href=<Electronic and Entertainment Products.php>'>";
#james_91 The code below should do the trick:
<?php
echo "<input class=\"button_normal\" type=\"button\" value=\"entertainment\" onclick=\"window.location.href='Electronic and Entertainment Products.php'\">";
?>
I would advise against using spaces in your file names so use underscores instead maybe.
JS within a button within PHP works best with escaped quotation marks, you also had two dots in between location and href as commented by Fred -ii-

Php help find where is syntax error [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
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes===".$card['id']."") as $kat){
echo (kat['id_categories']);
}
table cols and values are all matched, something is wrong in this part of code
I tried adding $ before kat and using only one "=", sill doesnt work
NEW LINK
http://pastebin.com/RPK7vEaJ
this
where id_kartes===".$card['id']."
would be
where id_kartes=".$card['id']."
and missing $
echo $kat['id_categories'];
so full code :-
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes='".$card['id']."'") as $kat){
echo $kat['id_categories'];
}
best practice if you store your query result in a variable and loop over this variable.
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes=".$card['id']."") as $kat)

Categories