Search the Community
Showing results for tags 'href'.
-
This is a question about dynamic links. At the moment I have a dynamic page from a table, I'll call it tableA. The links all work fine, so when clicked, information is displayed from the table. The issue will be when I come to create a new table entry. This new pages (or entry), will itself contain a link to other information. Assuming I have the required information in tableA, how do I activate a dynamic link from within a page that itself dynamically produced? I use PDO for the link to the database, and the page that shows the text uses a form, with buttons to allow the user to select a menu item. The php: <?php // Connect to the databaase $PDO = new PDO("mysql:host=****;dbname=****", "****", "****"); // set the PDO error mode to exception $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Set up defaults $current_title = ""; $current_page_data = ""; // Check if the user posted the page if($_SERVER['REQUEST_METHOD'] == 'POST') { // Check if user pressed a menu button if(isset($_POST["menu"])) { // User has selected a menu, meaning a page was selected, now load the page $current_title = filter_input(INPUT_POST, "menu"); // Now get current data from the database, if the page was never created, add it to the database $stmt = $PDO->prepare("SELECT * FROM pages WHERE pageheader=?"); $stmt->execute([$current_title]); $row = $stmt->fetch(); if($row) { // Page is in the databaswe already, load the text for it if(isset($row["pagetext"]) AND trim($row["pagetext"])!="") { $current_page_data = $row["pagetext"]; } } else { // Page was never created, add it with blank text $current_page_data = "This page is under contruction!<br><br>Please check back again later!"; } } } ?> The form (partial): <form name="****form" method="post" action="#"> <table id="timeline"> <tr> <td id="contentMenu"> <span class="item"> <div class="dropdown"> <button class="dropdownButton">Pre 3150 BC</button> <div class="dropdownContent"> <button name="menu" type="submit" value="Predynastic Egypt">Predynastic Egypt</button> <button name="menu" name="menu" value="Lower Egypt">Lower Egypt</button> <button name="menu" type="submit" value="Upper Egypt">Upper Egypt</button> <button name="menu" type="submit" value="Upper and Lower Egypt">Upper & Lower Egypt</button> </div> </span> .... </td> </tr> </table> </form> <!-- page content --> <hr> <h1 class="center"><?php echo $current_title; ?></h1> <hr> <?php echo $current_page_data; ?>
-
Hi I have installed a widget on my wordpress called "php text widget". What I iwant to do is to call the wp function so that they user clicks link they are automatically logged out and redirected to login page here is my code below when I test this code I get the following error: The requested URL /wp_logout_url( was not found on this server. <?php $redirect = "http://www.mysite.com/wp-login.php"; if ( is_user_logged_in() ) { print ("<a href=wp_logout_url( $redirect );>LOGOUT</a>"); } ?>
-
Hello, I have created a webpage that essentially generates an sql query and then puts the results into a table that is displayed. On one of the columns in this displayed table, I want to allow the user to click on each of the values which will in turn execute a php function. I have the hyperlink working but this is to a separate page. What I actually need to do is firstly - just ran a php function that will create a new table beneath the currently displayed one. Secondly, once this is achieved, I need to pass some value to the function so that the generated table is dependent on the value that was clicked. I've tried a few things and researched but I am struggling. I am a beginner. Any help would be greatly appreciated. Here is an extract of the code used for inputting data into the original table - showValuesSR is the function name <?php while (!$rsMetrics->EOF) { ?> <tr> <?php for ($x=0; $x<$numberOfFields; $x++) { if ($fieldNames[$x] == "Values_SR"){ ?> <td><a href= ?showValuesSR><?php echo $rsMetrics->fields[$fieldNames[$x]]->Value?></a></td> <?php } else{ ?> <td><?php echo $rsMetrics->fields[$fieldNames[$x]]->Value?></td> <?php } } ?> </tr> <?php $rsMetrics->MoveNext(); } ?> </table> <?php function showValuesSR(){ ?> <table border="0" cellpadding="5" width="100%"> <tr><td background="../images/table_toolbar_bkg.gif" align="center"><font color="Blue" face="verdana" size="2"><strong>function working</strong></td></tr> </table> <?php } ?>
-
Hi, I am stuck trying to get the link/href statement to work. I have tried so many variations but i get a very persistent error. Kindly help while($rows=mysqli_fetch_array($result)) { $count = $count+1; $field[$count] = $rows['Member_ID']; echo "<tr> <td>".$count."</td> <td>   ".$rows['fname'].' '.$rows['lname']."</td> <td> < a href = "$_SERVER['PHP_SELF']?id = $count "> Update </a> </td> </tr>"; } It results in this error "Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in D:\xampp\htdocs\xampp\MagicLogin\includes\fra_register1.php on line 84". I have tried the following variations: < a href = "$_SERVER['PHP_SELF']? id = <? echo $count; ?> "> Update </a> < a href = "$_SERVER['PHP_SELF']?id = <? echo $count; ?> "> Update </a> < a href = "$_SERVER['PHP_SELF']? id = <?php echo '.$count.'; "> Update </a> < a href = "$_SERVER['PHP_SELF']? id = <? echo '$count'; "> Update </a> and maybe a few more I did not keep track of but the error persists and I can't figure it out. Please note that there is no actual variable like "id" that i am using in the statement ($_SERVER['PHP_SELF']? id= ) . So far as I know that only used to pass a value back to the program. This could be very stupid but could someone help me out. Thanks.
-
is there a way we can count the number of link enter in fckeditor while form submission and if number of links exceeds 3, it shows a popup window. thanks and regards, jass.
- 2 replies
-
- links count fckeditor
- links
-
(and 3 more)
Tagged with:
-
Can anyone tell me why this won't work? <a href="<?php require_once('includes/scotch_gard.php'); ?>">Scotchgard Carpet Protector</a> I want it to just display the link text and run the 'require_once' statement when I click it. Thanks, Steve