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-
Related
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 am using a PHP generated link/button to pass on a variable to the referred page and using $_GET[''] to capture the variable.
Following is my anchor tag script:
echo "<a href='miniStat.php?pod=<?php echo $acct_currency[0] ?>' class='btn btn-primary'>View Recent Transactions</a>";
And this is how I am using $_GET procedure:
echo $_GET['pod'];
And here is the output from the referred browser window:
https://www.example.com/accts/miniStat.php?pod=%3C?php%20echo%20aed%20?%3E
And the three letters string 'aed' is exactly what I want to capture. Could someone please have a look at these lines to see what mistake am I making?
Thanks in anticipation.
Looks wrong
echo "<a href='miniStat.php?pod=<?php echo $acct_currency[0] ?>' class='btn btn-primary'>View Recent Transactions</a>";
I think the right version should be
echo "<a href='miniStat.php?pod=".$acct_currency[0]."' class='btn btn-primary'>View Recent Transactions</a>";
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 am testing PHP and the variable from the form is not staying, and does not appear even on the same page. Here is the code:
<?php
echo "<form action='input.php' method='post'>Test: <input type='text' name='last' </form><input type=submit>";
echo "<h1>The last input was: </h1>", $_POST["last"];
?>
This is not a PHP problem. It is an HTML problem.
Your submit button is outside of the form.
It's effectively "submitting" a blank, empty, made-up form of its own.
That made-up form does not contain any of your data.
Move the submit button to inside of the form.
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 can't figure out the syntax for quotes within quotes within quotes.? (edit: was not a matter of this, had an echo where it should be concatenated. See my answer below for corrected code)
This code brings a syntax error
$stringData="<?echo'<form method=\"post\" action=\"<? echo$_SERVER['PHP_SELF'];?>\"><button type=\"submit\">';?>";
I've tried many combinations of quotes and backslashes.
What is the proper syntax?
Bad grammar. This should work ;)
If you want to echo it:
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'"><button type="submit">';
If you want to keep it on a variable:
$string = '<form method="post" action="'.$_SERVER['PHP_SELF'].'"><button type="submit">';
I simply had an echo where it shouldn't be. Sorry for wasting your time.
$stringData="<?echo'<form method=\"post\" action=\" .'\$_SERVER['PHP_SELF']'.\"><button type=\"submit\">';?>";
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? ^ ^
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 have the following part of code inside my HTML body tag:
<?php if(1==2) { ?>
<a class="demage" href="xxxx.html">demage</a>
<a class="history" href="xxxx.html">history</a>
<?php } else { ?>
<a class="Sign In" href="login_page.html">Sign In</a>
<a class="Sign Up" href="register_page.html">Sign Up</a>
<?php } ?>
but it displays the 4 links in a row, not the last two as it is supposed to. What is wrong with the code?
Answered in comments, collective effort.
By default PHP will only evaluate/parse files containing PHP with the extension
.php
I don't see any error in the code the code is running as expected. (See the image attached.)
May be there's some problem with your php.