I wonder whether someone can help me please.
I've put together the following which creates a table within my HTML form.
echo("<tr>");
echo("<td>");echo($mvcfile->FileName);echo("</td>");
echo("<td>");echo($mvcfile->FileSize);echo("</td>");
echo("<td>");echo("<a href='javascript:void(0)' onclick='Attachment_Remove(this)'>remove</a>");echo("</td>");
echo("</tr>");
I'm now trying to add a Javascript link with the word 'Remove' so users can delete a file from the list.
I've been researching various sites and tutorials and I've put together the following:
echo("<td>");echo("<a href='javascript:void(0)' onclick='Attachment_Remove(this)'>remove</a>");echo("</td>"); which will then run the appplicable Javascript.
The problem I have is that the 'Remove' link isn't being created and I'm not sure why, because from what I've read I thought I'd put it together correctly, but clearly not.
I just wondered whether someone could perhaps please have a look at this and let me know where I've gone wrong.
Try tidying up your code:
echo "<tr>
<td>".$mvcfile->FileName."</td>
<td>".$mvcfile->FileSize."</td>
<td>remove</td>
</tr>";
See if that works. If it doesn't, try right-click => View Source and see if the link is there.
Related
In a helper plugin for WooCommerce for WordPress, I'm trying to create a custom message to be sent to a buyer.
I don't know why in all the emails that are sent out, %0d%0a is getting added behind the URL in the href attribute. I have tried several different combinations and nothing is working.
This is what I'm trying to do:
echo "<a href='$cl'> Please click here to redeem the coupon</a>";
But because %0d%0a is being added at the back of it the URL doesn't work properly for coupon codes.
This is what the URL looks like afterwards:
https://www.example.com/product-1/?couponCode=TDXGUA9G&utm_source=test&utm_medium=testt&utm_campaign=test&aff_code=TSJU89XYZ%0d%0a
The only thing that doesn't add %0d%0a is this:
echo $cl;
But I want to be able to use the <a> tag so that the buyer doesn't have to click on a long URL link.
Try this
echo "<a href='" . $cl . "'> Please click here to redeem the coupon</a>";
If you still have the issue, check how $cl was created.
I really appreciate all the responses. But I just want to post the code that finally worked for me after 7 hours of work. I understand that it looks silly but this is the best I could do for now. Here's what worked for me:
?>
Click here to take <?php echo ' '.$_product_name.'</span>';
I just encountered the same issue, but I'm using ASP.NET. All I did was delete the single quote and type it again. Now it works.
<asp:HyperLink ... NavigateUrl='<%# Eval("Url") %>' Text='<%# Eval("Name") %>' />
There were possibly some extra invisible characters which needed to be deleted.
I'm trying to create a link that takes the user to two different pages depending is the user logged or not. Problem is I'm still new to programming and this is quite big bite for beginner like me but its something I have to do. I created something like this so far but either way I suck at searching or there just isnt specific information for what I need
<?php if($userLogged){
echo '<a href="index.php" class="stylelink">';
}
else
{
echo '<a href="index1.php" class="stylelink">';
}
echo "Etusivu</a>";
?>
I'm also using Dreamweaver's login function that creates the MM_Username session and such, and Im not sure how to make the condition. userLogged is still an empty variable. Id appreciate any advice.
Thanks
-John
well, instead of using echo statements in the php tag you can write html and use php for outputting the value of the page like this
Etusivu
The $_SESSION['MM_Username'] works if you have included session_start(); at the beginning of the page and you can use the condition as above instead of $userLogged.
Hi i have a html link to a modal box which works perfectly, now what I am trying to do is pass a variable to the form in the modal box, how ever the link shows but nothing happens once it is clicked.
Here is my normal code:
Add
Here is my PHP code
echo "<a href=\"#accSettings1?ip_address={$ip_address}\" class='btn btn-small btn-primary hidden-tablet hidden-phone' data-toggle='modal' data-original-title=''>Add</a>";
Use your normal code and add PHP only when you need a PHP variable:
Add
if it's your application that doesn't work - then debug it first.
Use handwritten example to exercise with. Make it work. And then add a dynamical part using PHP to fill the variable. After that you have to verify if dynamical code produced the same result as a static one. To do that instead of hover you have to inspect page source and compare it with original code. Find the differences and correct them.
To me, such an url like #accSettings1?ip_address=value looks quite unusual. ?ip_address=value#accSettings1 looks more familiar to me. Though I am not a JS pro, nor I know your app internals and URLs intention
I am creating a PHP search page that searches a MySQL database and returns results into separate jQuery modals.
Goal: When a user searches a term, the results found for ClassName are displayed from the database via separate links (these links being scripted to open jQuery modals) and once a link is clicked the modal opens displaying the rest of the information related to that ClassName in said database.
What Is Working: The different ClassName(s) are displayed properly as separate links.
What Is Not Working: No matter what ClassName link you click on, once the modal opens, it only displays the information relating to the very first ClassName result in the database.
Any help correcting this error is greatly appreciated.
The only rows in the database I am using for results are: ClassName, ClassInformation, and imagePath.
PHP Select Statement:
<?php
$raw_results = mysql_query(
"SELECT * FROM classes
WHERE (`ClassName` LIKE '%".$query."%') OR
(`ClassInformation` LIKE '%".$query."%')"
) or die(mysql_error());
?>
Link:
echo "<a href=".$results['ClassName']
. " data-reveal-id='myModal'><h2>"
. $results['ClassName']
. "</h2></a>";
Modal:
echo "<div id='myModal' class='reveal-modal'
style='background-image: url(ResultBackground.png);
border: 1px solid black;'><h2>".$results['ClassName']."</h2>
<div id='image'>".$results['imagePath']."</div></br >
<h3>".$results['ClassInformation']."</h3>
<a class='close-reveal-modal'>×</a></div>";
I apologize for the code not formatting correctly I don't really understand how to use the code blocks on this site yet. But thank you for any and all help offered.
A similar question was asked by someone 2 months ago here related question but the way his code was written threw me off completely as I'm new to PHP and only know the messy way I've taught myself from online tutorials. I attempted to format the code similar to the way suggested by the person who answered the linked question but I just keep breaking my code.
$i=0;
while($row=mysql_fetch_array($raw_results)){
echo "<a href=".$results['ClassName']. " data-reveal-id='myModal_".$i."'><h2>".$results['ClassName']. "</h2></a>";
echo "<div id='myModal_".$i."' class='reveal-modal'>......restcode";
$i++;
}
You have to use unique ids fro each link .here you have used same data-reveal-id="myModal" for every link,and every modal div has same id "myModal". So when you click on any link,it checks for first element with id 'myModal' and displays it .
Use different data-reveal-ids for each link and give the same id to the corresponding modal divs
I know, this is just so common. However, I am not able to get it working.
Got a php file which is included in the index.php and that contains a function printing this one out
echo "<input type=text id=test name=schuelername value=Name><br>
<button style='float: left;' onclick='update();'>Suchen</button>";
Now I want to pass this value of the textbox. With (this is the update function)
alert(window.document.getElementById("test").value);
run by an external JS file (that works, Tested it, the only problem is the value of the textbox) isn't showing up.
Argh. Why do I define the damn ID if JS can't access it (or so...)
SOLVED: Well, I ran a document.write before it and I couldn't imagine, that like this, the rest of the javascript can't run because I just deleted everything. Thanks alot, stupid me, late!
That should work. Try alert(window.document.getElementById("test").defaultValue);
Demo: http://jsfiddle.net/AlienWebguy/RzrZZ/
Make sure your PHP is echoing that HTML before your Javascript tries to find it and alert the value. If the actions are reversed, getElementById("test") will be undefined because the node would not have been added to the DOM yet.