<a href="uploads/templates'.$row[0].'/index.php?id=<?php echo $row[0];?>"
class="btn btn-warning">
View
</a>
above is the button and in this button i want to give a path in which folder named templates should be like templates1 ,templates2, templates3. So the numeric value is a variable and 0to be attached with templates so that the folder can open and the index file can be run..so can any one help me with this
<a href="uploads/templates/<?php echo $row[0]; ?>/index.php?id=<?php echo
$row[0];?>" class="btn btn-warning">
View</a>
OR
<?php
echo '<a href="uploads/templates/'.$row[0].'/index.php?id='.$row[0].'"
class="btn btn-warning">
View</a>';
?>
<a href="uploads/templates<?php echo $row[0];?>/index.php?id=<?php echo $row[0];?>" class="btn btn-warning">
View
</a>
If you are writing PHP code inside HTML, you need to wrap your code in <?php ?>.
Your code should be:
<a href="uploads/templates<?php echo $row[0]; ?>/index.php?id=<?php echo $row[0];?>" class="btn btn-warning">
View
</a>
Related
I'm new to Php but what I need this php code to do is to pass two variables through the URL like this
<td align="center"><a class="btn btn-danger" href="reserve.php?distroid=<?php echo $row["distroid"] echo $row['orderid']; ?>">Place Order</a></td>
When we try and do it with just distroid, it works completely fine. But I'm unsure how to pass both values.
Any help would be appreciated.
EDIT: SOLVED IT THANK YOU FOR THE HELP ALL
Try to add more key for the query string like this :
<td align="center">
<a class="btn btn-danger"
href="reserve.php?distroid=<?php echo $row["distroid"]; ?>&orderid=<?php echo $row['orderid']; ?>">
Place Order
</a>
</td>
Then you can get both distroid and orderid
Try this query string like this :
<td align="center">
<a class="btn btn-danger"
href="reserve.php?distroid=<?php echo $row["distroid"]."&orderid=".$row['orderid']; ?>">
Place Order
</a>
</td>
Then you can get both variable distroid and orderid
Hi you can try this anchor tag, it will work for you:
<a class="btn btn-danger" href="reserve.php?distroid=<?php echo $row['distroid'];
?>&orderid=<?php echo $row['orderid']; ?>">
Place Order
</a>
I'm trying to echo a link on a page. It should be a bootstrap button, but it's just coming out as plain text.
This is my code. What am I doing wrong?
echo '<a class="btn btn-info" href='.$url.'>Video Link</a>';
Try this. I have checked it in my localhost and it is working perfectly.
$url = 'https://www.facebook.com/';
echo '<a class="btn btn-info" href='.$url.'>Video Link</a>';
Please let me know if you have any further questions or any problem occurs.
You should wrap the string you are contencating in double quotes, like this
echo '<a class="btn btn-info" href="'.$url.'">Video Link</a>';
href need to be wrapped up with href=""
try -----> href="'.$url.'"
Change this:
echo '<a class="btn btn-info" href='.$url.'>Video Link</a>';
To this:
echo '<a class="btn btn-info" href="'.$url.'">Video Link</a>';
You should not use single quotes inside single quotes so you have to change your code to something like this
echo '<a class="btn btn-info" href="'.$url.'">Video Link</a>';
I need to pass these two variables in my HTML button.
$value['_id']
$sellerInfo[0]['City']
The HTML is:
<button id='myBtn' onclick='showproduct()'>Pending</button>
I have tried with this code:
<button id='myBtn' onclick='showproduct("<?php echo $value['_id'];?> , <?php echo $sellerInfo[0]['City']; ?> ")'>Pending</button>
I'm getting an error the second parameter is undefined.
How can I pass the two variables in showproduct()?
The quotes are messed.
Change your code to this:
<button id='myBtn' onclick='showproduct("<?php echo $value['_id'];?>" , "<?php echo $sellerInfo[0]['City']; ?>")'>Pending</button>
Try this
<button id='myBtn' onclick='showproduct("<?php echo $value['_id'];?>" , "<?php echo $sellerInfo[0]['City']; ?>")'>Pending</button>
You can try these tricks in your onClick function from this example
<i class="fa fa-times pl-5 in_time_late_approve" onclick='in_time_late_approve("<?php echo $key ?>", "<?php echo $employee_attendance_item->attendance_in_time ?>")' style="color:green; cursor:pointer" aria-hidden="true"></i>
I want to use html syntax in php and i want to use . instead of <?php ?> my code ig given below ,
$delete='<a class="confirm" onclick="return delete_event(<?php echo $value->id; ?>, '<?php echo base_url() . 'webtv/delete_channels' ?>', '<?php echo current_full_url(); ?>');" href="" ><i class="glyphicon glyphicon-trash text-red del" title="Delete"></i></a>';
Please help me.
<?php
$value = "value_1"; //$value->id;
$baseurl = "base_url"."/webtv/delete_channels"; //base_url()."/webtv/delete_channels";
$fullurl = "current_url"; //current_full_url();
$delete="<a href='#' class='confirm' onclick=\"return delete_event('".$value."','".$baseurl."','".$fullurl."')\" >Click me</a>";
echo $delete;
?>
<script>
function delete_event(var1,var2,var3){
alert(var1+" -- "+var2+" -- "+var3);
}
</script>
You can use sprintf function to solve this issue.
Solution is:
$delete = sprintf('<a class="confirm" onclick="return delete_event(%d, \'%s\',\'%s\');" href="" ><i class="glyphicon glyphicon-trash text-red del" title="Delete"></i>jkhklh</a>', $value->id, base_url() . 'webtv/delete_channels', current_full_url());
I cleaned up your php syntax. I don't quite understand what you're trying to do, but the declaration below should give you an a tag containing what you want (a confirm delete button):
$delete='<a class="confirm" onclick="return delete_event($value->id, '.base_url().'webtv/delete_channels, '.current_full_url().');" href="" ><i class="glyphicon glyphicon-trash text-red del" title="Delete"></i></a>';
If you echo this on your webpage, assuming all of your other links are correct, it should work.
<?php
$id=16;
echo '<td><a class="btn btn-primary" href="edit_news.php?id=$id"><i class="fa fa-pencil fa-fw"></i> Edit</a></td>';
?>
I have a search program that performs search via ajaX,whwre i need to embed html tag with php. Search works fine but when i click on edit button the id cant pass on another page. It shows thathttp://localhost/web/edit_news.php?id=$id. But i cant get the id=16. And error shows Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\web\edit_news.php on line 9. what is the error in my code?
Can any one help me to solve this?
you have change "edit_news.php?id=$id" to "edit_news.php?id='.$id.'". Because data in double quotes treated it like string. or you can use single quotes '. like href='edit_news.php?id=$id'.
<?php
$id=16;
echo '<td><a class="btn btn-primary" href="edit_news.php?id='.$id.'"><i class="fa fa-pencil fa-fw"></i> Edit</a></td>';
?>
just change it quote like ' to " and " to '
<?php
$id=16;
echo "<td><a class='btn btn-primary' href='edit_news.php?id=$id'><i class='fa fa-pencil fa-fw'></i> Edit</a></td>";
?>
OR
<?php
$id=16;
echo '<td><a class="btn btn-primary" href="edit_news.php?id='.$id.'"><i class="fa fa-pencil fa-fw"></i> Edit</a></td>';
?>
Change the single quote with double and double with single Like this :
<?php
$id=16;
echo "<td><a class='btn btn-primary' href='edit_news.php?id=$id'><i class='fa fa-pencil fa-fw'></i> Edit</a></td>";
?>