How to open Wordpress Media Upload in two places in plugin - javascript

I'm writing a plugin and have need of the media uploader in two different functions; add program, and edit program. Both these functions present a form for the site admin to fill in. One form for adding a new program, and the other for editing an existing one (facilitated by an id variable passed in the URL).
The code I got from this page: http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/ is working perfectly in the add program admin page. However, the same code is not working on the edit program page. I've checked the source of both pages, and the appropriate scripts and styles are enqueued, the javascript is present in the body, just before the form code, and the upload field and button codes are correct. Everything tis as it should be on both pages, but it only works on one of them.
Being quite a novice at javascript and jQuery, it's quite possible I'm missing something simple. Any assistance would be appreciated.
Hi cale b, the only error shown is "tb_show is not defined" which, of course, isn't good. It LOOKS like it's defined in the code, though.
Here is the code for enqueuing the scripts and styles:
function bhcprograms_manager_admin_scripts() {
wp_enqueue_script('jquery');
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
}
function bhcprograms_manager_admin_styles() {
wp_enqueue_style('thickbox');
}
add_action('admin_print_scripts', 'bhcprograms_manager_admin_scripts');
add_action('admin_print_styles', 'bhcprograms_manager_admin_styles');
The javascript and form code for the one that works:
echo "<script language=\"JavaScript\">\n";
echo "jQuery(document).ready(function() {\n";
echo "jQuery('#bhc_image_button').click(function() {\n";
echo "formfield = jQuery('#bhc_image').attr('name');\n";
echo "tb_show('', 'media-upload.php?type=image&TB_iframe=true');\n";
echo "return false;\n";
echo "});\n";
echo "window.send_to_editor = function(html) {\n";
echo "imgurl = jQuery('img',html).attr('src');\n";
echo "jQuery('#bhc_image').val(imgurl);\n";
echo "tb_remove();\n";
echo "}\n";
echo "});\n";
echo "</script>\n";
echo "<form method=\"post\" action=\"\" name=\"new_program\">\n";
echo "<h4>&ast; indicates required field</h4>\n";
echo "<h4>Program Title &ast;</h4>\n";
echo "<input type=\"text\" size=\"40\" name=\"bhc_title\" value=\"" . str_replace('"', '"', $bhc_title) . "\" maxlength=\"255\" />\n";
echo "<h4>Program Subtitle</h4><strong>If no subtitle, leave it blank</strong><br />\n";
echo "<input type=\"text\" size=\"40\" name=\"bhc_subtitle\" value=\"" . str_replace('"', '"', $bhc_subtitle) . "\" maxlength=\"255\" />\n";
echo "<h4>Description &ast;</h4>\n";
echo "<textarea name=\"bhc_description\" rows=\"4\" cols=\"50\" type=\"textarea\">" . $bhc_description . "</textarea>\n";
echo "<h4>Image Upload</h4><strong>Upload an image to go with this program description. If no image wanted, leave it blank</strong><br />\n";
echo "<input id=\"bhc_image\" type=\"text\" size=\"40\" name=\"bhc_image\" value=\"" . $bhc_image . "\" />\n";
echo "<input id=\"bhc_image_button\" type=\"button\" value=\"Upload Image\" />\n";
echo "<h4>What to Bring</h4><strong>If N/A, leave it blank</strong><br />\n";
echo "<textarea name=\"bhc_bring\" rows=\"4\" cols=\"50\" type=\"textarea\">" . $bhc_bring . "</textarea>\n";
echo "<h4>What is Provided</h4><strong>If N/A, leave it blank</strong><br />\n";
echo "<textarea name=\"bhc_provided\" rows=\"4\" cols=\"50\" type=\"textarea\">" . $bhc_provided . "</textarea>\n";
echo "<br /><br />\n";
echo "<h4>Start program as active?</h4>\n";
echo "<input type=\"radio\" name=\"bhc_active\" value=\"1\"" . ($bhc_active==1?' checked':'') . "> Yes<br /><input type=\"radio\" name=\"bhc_active\" value=\"0\"" . ($bhc_active==1?'':' checked') . "> No<br />\n";
echo "<br /><br />\n";
echo "<input type=\"submit\" name=\"submit\" class=\"button-primary\" value=\"Add Program\" />\n";
echo "</form>\n";
and the javascript and form codes for the one that doesn't work:
echo "<script language=\"JavaScript\">\n";
echo "jQuery(document).ready(function() {\n";
echo "jQuery('#bhc_image_button').click(function() {\n";
echo "formfield = jQuery('#bhc_image').attr('name');\n";
echo "tb_show('', 'media-upload.php?type=image&TB_iframe=true');\n";
echo "return false;\n";
echo "});\n";
echo "window.send_to_editor = function(html) {\n";
echo "imgurl = jQuery('img',html).attr('src');\n";
echo "jQuery('#bhc_image').val(imgurl);\n";
echo "tb_remove();\n";
echo "}\n";
echo "});\n";
echo "</script>\n";
/* Show the form with the details */
echo "<form method=\"post\" action=\"\" name=\"edit_program\">\n";
echo "<strong>&ast; indicates required field</strong>\n";
/* Find out if there are events scheduled for this program ... */
$bhc_program_event = $mydb->get_results("SELECT bhc_event_id FROM $table_events WHERE bhc_program_id = $bhc_id");
/* Loop through and display programs*/
echo "<h4>Program Title &ast;</h4>\n";
if ($bhc_program_event) {
echo "<strong>" . $bhc_title . "</strong>\n";
echo "<input type=\"hidden\" name=\"bhc_title\" value=\"" . str_replace('"', '"', $bhc_title) . "\" />\n";
} else {
echo "<input type=\"text\" size=\"40\" name=\"bhc_title\" value=\"" . str_replace('"', '"', $bhc_title) . "\" maxlength=\"255\" />\n";
}
echo "<h4>Program Subtitle</h4>\n";
if ($bhc_program_event) {
echo "<strong>" . $bhc_subtitle . "</strong>\n";
echo "<input type=\"hidden\" name=\"bhc_subtitle\" value=\"" . str_replace('"', '"', $bhc_subtitle) . "\" />\n";
} else {
echo "<strong>If no subtitle, leave it blank</strong><br />\n";
echo "<input type=\"text\" size=\"40\" name=\"bhc_subtitle\" value=\"" . str_replace('"', '"', $bhc_subtitle) . "\" maxlength=\"255\" />\n";
}
echo "<h4>Description &ast;</h4>\n";
echo "<textarea name=\"bhc_description\" rows=\"4\" cols=\"50\" type=\"textarea\">" . $bhc_description . "</textarea>\n";
echo "<h4>Image Upload</h4><strong>Upload an image to go with this program description. If no image wanted, leave it blank</strong><br />\n";
echo "<input id=\"bhc_image\" type=\"text\" size=\"40\" name=\"bhc_image\" value=\"" . $bhc_image . "\" />\n";
echo "<input id=\"bhc_image_button\" type=\"button\" value=\"Upload Image\" />\n";
echo "<h4>What to Bring</h4><strong>If N/A, leave it blank</strong><br />\n";
echo "<textarea name=\"bhc_bring\" rows=\"4\" cols=\"50\" type=\"textarea\">" . $bhc_bring . "</textarea>\n";
echo "<h4>What is Provided</h4><strong>If N/A, leave it blank</strong><br />\n";
echo "<textarea name=\"bhc_provided\" rows=\"4\" cols=\"50\" type=\"textarea\">" . $bhc_provided . "</textarea>\n";
/* Exclude active option if registrations exist */
$nowtime = date("U");
$bhc_reg_check = $mydb->get_row("SELECT bhc_event_id FROM $table_events WHERE bhc_program_id = $bhc_id AND bhc_current_peeps > 0 LIMIT 1");
if ($bhc_reg_check) {
echo "<input type=\"hidden\" name=\"bhc_active\" value=\"1\">\n";
} else {
echo "<h4>Set program as active?</h4>\n";
echo "<input type=\"radio\" name=\"bhc_active\" value=\"1\"" . ($bhc_active==1?' checked':'') . "> Yes<br /><input type=\"radio\" name=\"bhc_active\" value=\"0\"" . ($bhc_active==1?'':' checked') . "> No<br />\n";
}
echo "<br /><br />\n";
echo "<input type=\"hidden\" name=\"bhc_id\" value=\"" . $bhc_id . "\" />\n";
echo "<input type=\"submit\" name=\"submit\" class=\"button-primary\" value=\"Edit Program\" />\n";
echo "</form>\n";
exit;

Related

how to disable checkbox after due date has passed

I've this code in php, and it retrieve all the value I've in my database, and I want the user not be able to choose or tamper with the one that has expired date,
please can you help me ?
my code below only show u the word 'Expired' and 'Not Expired' on the web, since I'm only Echoing it.
I want to just disable the check box, and not let the user be able to change anything like the statues or remove the job.
please can you help me ?
$result = mysqli_query($dbCIE,$sqlCommand) or die(mysql_error());
echo "<form action='JobsLists.php' method='post'>";
while($row = mysqli_fetch_array($result))
{
$exp_date = $row['DueDate'];
$today_date = date('Y/m/d');
$exp=strtotime($exp_date);
$td=strtotime($today_date );
if($td>$exp){
echo"Expiered";
}else{
echo"NOT Expiered";
}
echo "<tr>";
echo "<td> <input type='checkbox' id='myCheck' name='JobId[]' value='". $row['JobId'] ."' /> </td>";
echo "<td align=center>" . $row['SSU'] . "</td>";
echo "<td align=center>" . $row['JobName'] . "</td>";
echo "<td align=center> " . $row['Description'] . "</td>";
echo "<td align=center>" . $row['DueDate'] . "</td>";
echo "<td>"."<select name='JobStatus[".$row['JobId']."]'>";
if($row['JobStatus'] == "InProgress"){
echo "<option value='InProgress' selected>In Progress</option>";
echo "<option value='Completed'>Completed</option>";
} else {
echo "<option value='InProgress'>In Progress</option>";
echo "<option value='Completed' selected> Completed </option>";
}
echo "</select>" . "</td>"; // need to be worked on..
echo "</tr>";
}
"</table>";
?>
Why not just not print it out?
if (!$td->exp)
echo "<td> <input type='checkbox' id='myCheck' name='JobId[]' value='". $row['JobId'] ."' /> </td>";
It's better to just not show a button or input than to disable it sometimes. Inputs can be disabled with the DISABLED keyword
<input type="checkbox" name="foo" DISABLED>

Clicking specific class to trigger drop down event

How can I fix this? I have used php to display data from my database but I didn't foresee this bug.
When I click the gear icon both dropdown menu will appear. How can I fix this? What I want is when I click the gear of a specific project only one dropdown will appear. I hope you can help me its been bugging me for days. Thank you!!
Here is my code:
PHP CODE:
if ($level == "Level 1"){
$sql = "SELECT * FROM project";
$result = mysqli_query($conn,$sql);
$count = mysqli_num_rows($result);
if ($count > 0) {
while ($row = mysqli_fetch_array($result)) {
echo "<input type='hidden' id='".$row['project_id']."'>";
echo "<div class='col-3'>";
echo "<div class='card'>";
echo "<div class='row'>";
echo "<div class='col-2'>";
echo "<h6 class='card-title'>".$row['project_name']."</h6>";
echo "</div>";
echo "<div class='col-2'>";
echo "<div class='card-setting'><i class='fa fa-gear'></i></div>";
echo "<div id='card-setting-dropdown' class='card-dropdown-content'>";
echo "<button class='card-dropdown-menu' id='delete_project'>Delete Project</button>";
echo "<button class='card-dropdown-menu' id='add_task'>Add Task</button>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div class='row'>";
echo "<div class='col-2'>";
echo "<label class='project-details'>".$row['department']."</label>";
echo "</div>";
echo "<div class='col-2'>";
echo "<label class='project-details' style='float:right;'>Priority: ".$row['priority']."</label>";
echo "</div>";
echo "</div>";
echo "<div class='pr-task-data'>";
echo "<div class='pr-task-summary-l'>";
echo "<label class='pr-task-title'>Tasks</label>";
echo "<p class='pr-task-details'>12</p>";
echo "</div>";
echo "<div class='pr-task-summary-l'>";
echo "<label class='pr-task-title'>Completed</label>";
echo "<p class='pr-task-details'>5</p>";
echo "</div>";
echo "<div class='pr-task-summary-l'>";
echo "<label class='pr-task-title'>In-Progress</label>";
echo "<p class='pr-task-details'>2</p>";
echo "</div>";
echo "<div class='pr-task-summary-r'>";
echo "<label class='pr-task-title'>Not Completed</label>";
echo "<p class='pr-task-details'>5</p>";
echo "</div>";
echo "</div>";
echo "<div class='progress'>";
echo "<div class='progress-bar'>";
echo "<label class='progress-bar-percent'>50%</label>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
}
}
}
Script:
//Card-Settings Dropdown
$(".card-setting").click(function() {
$(".card-dropdown-content").toggleClass("card-dropdown-content-show");
$(this).toggleClass("card-setting-active");
});
When the script activates you toggle the class car-dropdown-content-show for all cards. You should only focus on the one inside the card and find the one with the card-dropdown-content class:
$(".card-setting").click(function() {
var $this = $(this);
$this.parent().find(".card-dropdown-content").toggleClass("card-dropdown-content-show");
$this.toggleClass("card-setting-active");
});
We first need to go up to the parent because the find looks through all the descendants, the div with the card-dropdown-content class is a sibling.
You need to find related element to clicked gear.
Try this:
$('.card-setting').on('click', function () {
var $this = $(this) ;
$this.next().toggleClass("card-dropdown-content-show");
$this.toggleClass("card-setting-active");
});

Clicking specific class to trigger open modal event

How can I fix this? I have used PHP to display data from my database but I didn't foresee this bug. When I click the edit the modal will appear However, when I click the edit button of the other data the modal will not appear. How can I fix this? What I want is when I click the edit button modal will appear. I hope you can help me its been bugging me for days.
Edit Button.
Please See Modal.
Here is my code:
PHP:
echo "<div class='col-3'>";
echo "<div class='card'>";
echo "<div class='row'>";
echo "<div class='col-2'>";
echo "<h6 class='card-title'>".$row['project_name']."</h6>";
echo "</div>";
echo "<div class='col-2'>";
echo "<div class='card-setting'><i class='fa fa-gear'></i></div>";
echo "<div id='card-setting-dropdown' class='card-dropdown-content'>";
echo "<button class='card-dropdown-menu' id='btn-edit'>Edit Project</button>";
echo "<button class='card-dropdown-menu'>Delete Project</button>";
echo "<button class='card-dropdown-menu'>Add Task</button>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div class='row'>";
echo "<div class='col-2'>";
echo "<label class='project-details'>".$row['department']."</label>";
echo "</div>";
echo "<div class='col-2'>";
echo "<label class='project-details' style='float:right;'>Priority: <span style='color:".$color."'>".$row['priority']."</span></label>";
echo "</div>";
echo "</div>";
echo "<div class='pr-task-data'>";
echo "<div class='pr-task-summary-l'>";
echo "<label class='pr-task-title'>Tasks</label>";
echo "<p class='pr-task-details'>".$count_2."</p>";
echo "</div>";
echo "<div class='pr-task-summary-l'>";
echo "<label class='pr-task-title'>Completed</label>";
echo "<p class='pr-task-details'>".$count_3."</p>";
echo "</div>";
echo "<div class='pr-task-summary-l'>";
echo "<label class='pr-task-title'>In-Progress</label>";
echo "<p class='pr-task-details'>".$count_4."</p>";
echo "</div>";
echo "<div class='pr-task-summary-r'>";
echo "<label class='pr-task-title'>Not Completed</label>";
echo "<p class='pr-task-details'>".$count_5."</p>";
echo "</div>";
echo "</div>";
echo "<div class='progress'>";
echo "<div class='progress-bar' style='width:".$percent."%;'>";
echo "<label class='progress-bar-percent'>".$percent."%</label>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div id='modal_2' class='modal fade'>";
echo "<div class='modal-dialog'>";
echo "<div class='modal-content'>";
echo "<div class='modal-header'>";
echo "<h6 class='modal-title'>Add Project</h6>";
echo "<button type='button' class='close_2'>x</button>";
echo "</div>";
echo "<div class='modal-body'>";
echo "<form autocomplete='off' method='POST'>";
echo "<input type='hidden' id='".$row['project_id']."'>";
echo "<div class='form-group'>";
echo "<label class='form-control-label'>Program</label>";
echo "<input type='text' placeholder='Program' name='program' id='program_2' class='form-control'>";
echo "</div>";
echo "<div class='form-group'>";
echo "<label class='form-control-label'>Project Name</label>";
echo "<input type='text' placeholder='Project Name' name='pname' id='pname' class='form-control'>";
echo "</div>";
echo "<div class='form-group'>";
echo "<label class='form-control-label'>Project Description</label>";
echo "<input type='text' placeholder='Description' name='description' id='description' class='form-control'>";
echo "</div>";
echo "<div class='form-group'>";
echo "<label class='form-control-label'>Department</label>";
echo "<select class='form-control' id='department' name='department'>";
echo "<option value=''>Department</option>";
echo "<option value='Executive Department'>Executive Department</option>";
echo "<option value='CCA Department'>CCA Department</option>";
echo "</select>";
echo "</div>";
echo "<div class='form-group'>";
echo "<label class='form-control-label'>Priority</label>";
echo "<select class='form-control' id='priority' name='priority'>";
echo "<option value=''>Priority</option>";
echo "<option value='Low'>Low</option>";
echo "<option value='Medium'>Medium</option>";
echo "<option valie='High'>High</option>";
echo "<option valie='High'>High</option>";
echo "</select>";
echo "</div>";
echo "</div>";
echo "<div class='modal-footer'>";
echo "<button type='submit' class='btn btn-update' name='update'>Update</button>";
echo "<button type='button' class='btn btn-secondary'>Close</button>";
echo "</div>";
echo "</form>";
echo "</div>";
echo "</div>";
echo "</div>";
SCRIPT:
//Edit Project Modal
var modal_edit = document.getElementById('modal_2');
var btn_edit = document.getElementById("btn-edit");
var span_edit = document.getElementsByClassName("close_2")[0];
btn_edit.onclick = function() {
$(modal_edit).toggleClass("modal-show");
}
span_edit.onclick = function() {
$(modal_edit).removeClass("modal-show");
}
$(".btn-secondary").click(function() {
$(modal_edit).removeClass("modal-show");
});
Try something like this.
Add a common class to your edit button Like class="btnEdit other_classes"
Try this code
var modal_edit = document.getElementById('modal_2');
var span_edit = document.getElementsByClassName("close_2")[0];
// I assumed that your button is added dynamically
$(document).on('click',".btnEdit",function(){
$(modal_edit).toggleClass("modal-show");
});
span_edit.onclick = function() {
$(modal_edit).removeClass("modal-show");
}
$(".btn-secondary").click(function() {
$(modal_edit).removeClass("modal-show");
});
Your Click is not working for other elements because you are using id to assign events with them but and id must be unique. I made sample fiddle with two elements with the same ID's and try to look at their difference..
$("#first").click(function(){
alert("I was clicked");
});
div{
display:inline-block;
width:100px;
height:100px;
border:1px solid red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="first">DIV</div>
<div id="first">DIV</div>
The first one only works.. So use class instead..

Particular entries in a loop to be checked and displayed

A section of my code is as follows,
foreach( $alpha as $key => $obj)
{
echo "<tr>";
echo "<td> ". $obj[$d] ."</td>";
echo "<td> ". $obj[$a] ."</td>";
echo "<td> ". $obj[$o] ."</td>";
echo "<td> ". $obj[$f] ."</td>";
echo "<td> ". $obj[$e] ."</td>";
echo "</tr>";
}
Here the array alpha is an associative array. The $d, $a, $o, $f, $e are the row values from an sql query. I want to check the value in the $obj[$f] and if a value exists then alert the user using javascripts' alert() command, that a value exists and if it doesnt then i want the looping to continue as usual.
try this
foreach( $alpha as $key => $obj){
if(!empty($obj[$f])){
//has value, echo alert
echo "<script>alert('object f contains value')</script>";
} else {
//no value there so echo rest of table
echo "<tr>";
echo "<td> ". $obj[$d] ."</td>";
echo "<td> ". $obj[$a] ."</td>";
echo "<td> ". $obj[$o] ."</td>";
echo "<td> ". $obj[$f] ."</td>";
echo "<td> ". $obj[$e] ."</td>";
echo "</tr>";
}
}
Can try this:
foreach( $alpha as $key => $obj)
{
if(isset($obj[$f]) && !empty($obj[$f]))
{
echo "<script>alert('your comment')</script>";
exit;
}
else
{
echo "<tr>";
echo "<td> ". $obj[$d] ."</td>";
echo "<td> ". $obj[$a] ."</td>";
echo "<td> ". $obj[$o] ."</td>";
echo "<td> ". $obj[$f] ."</td>";
echo "<td> ". $obj[$e] ."</td>";
echo "</tr>";
}
}

keep getting php white screen of death when i try to add a confirmation box

I am trying to make a confirmation box when a user deletes an entry which is done from the echo "<img title='Delete Row' alt=\"Delete\" class='del' src='images/delete.png'/></form></div>\n";statement. tried using an "onlick" operator and some javascript that would do an href redirect to the delete statement. tried about 6 different sets of code i found on this site but i dont think i am implementing it correctly. keep getting an undefined constant error when i check the php log
<?php
//Get database credentials
require 'config.php';
// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');
require 'header.php';
$query = "SELECT * FROM ring29 ORDER BY `ring29`.`ospfarea`,`dot1q`,`subnethost` ASC;";
$result = mysql_query($query) or die(mysql_error());
//Count the number of rows returned
$count = mysql_num_rows($result);
//Table header
echo "<div><table id=\"tableheader\" bgcolor=\"#4382b5\">\n";
echo "<tr>\n";
echo "<td> Sql UID...........</td>\n";
echo "<td> Market:</td>\n";
echo "<td> Market Code:</td>\n";
echo "<td> OSPF Area:</td>\n";
echo "<td> Primary Tag:</td>\n";
echo "<td> 802.1Q:</td>\n";
echo "<td> Subnet/Host:</td>\n";
echo "<td> IPv6 Subnet/Host:</td>\n";
echo "<td> Slot/Port:</td>\n";
echo "<td> CMTS GW Node:</td>\n";
echo "<td> Slot/Port:</td>\n";
echo "<td> IPv6 Subnet/host:</td>\n";
echo "<td> Subnet/Host:</td>\n";
echo "<td> 802.1Q:</td>\n";
echo "<tr>";
echo "</table></div>";
if ($count !== 0) {
while($row = mysql_fetch_array($result)) {
echo "<div class=\"addform\"><form method='get' action=\"update.php\">\n";
echo " <input type=\"text\" value=\"".$row[sqluid]."\" name=\"sqluid\">\n";
echo " <input type=\"text\" name=\"market\" value=\"".$row[market]."\"/>\n";
echo " <input type=\"text\" name=\"mktcode\" value=\"".$row[mktcode]."\"/>\n";
echo " <input type=\"text\" name=\"ospfarea\" value=\"".$row[ospfarea]."\"/>\n";
echo " <input type=\"text\" name=\"primarytag\" value=\"".$row[primarytag]."\"/>\n";
echo " <input type=\"text\" name=\"dot1q\" value=\"".$row[dot1q]."\"/>\n";
echo " <input type=\"text\" name=\"subnethost\" value=\"".$row[subnethost]."\"/>\n";
echo " <input type=\"text\" name=\"ipv6subnethost\" value=\"".$row[ipv6subnethost]."\"/>\n";
echo " <input type=\"text\" name=\"slotport\" value=\"".$row[slotport]."\"/>\n";
echo " <input type=\"text\" name=\"cmtsgwnode\" value=\"".$row[cmtsgwnode]."\"/>\n";
echo " <input type=\"text\" name=\"slotport1\" value=\"".$row[slotport1]."\"/>\n";
echo " <input type=\"text\" name=\"ipv6subnethost1\" value=\"".$row[ipv6subnethost1]."\"/>\n";
echo " <input type=\"text\" name=\"subnethost1\" value=\"".$row[subnethost1]."\"/>\n";
echo " <input type=\"text\" name=\"dot1q1\" value=\"".$row[dot1q1]."\"/>\n";
echo " <input type=\"image\" src=\"images/update.png\" alt=\"Update Row\" class=\"update\" title=\"Update Row\">\n";
echo "<img title='Delete Row' alt=\"Delete\" class='del' src='images/delete.png'/></form></div>\n";
}
echo "</table><br />\n";
} else {
echo "<b><center>NO DATA</center></b>\n";
}
echo "<div>Add Row:</div>\n";
echo "<div class=\"addform\"><form method='get' action=\"add.php\">\n".
" <input type=\"text\" name=\"sqluid\" value=\"Enter unique number\"/>\n".
" <input type=\"text\" name=\"market\"/>\n".
" <input type=\"text\" name=\"mktcode\"/>\n".
" <input type=\"text\" name=\"ospfarea\"/>\n".
" <input type=\"text\" name=\"primarytag\"/>\n".
" <input type=\"text\" name=\"dot1q\"/>\n".
" <input type=\"text\" name=\"subnethost\"/>\n".
" <input type=\"text\" name=\"ipv6subnethost\"/>\n".
" <input type=\"text\" name=\"slotport\"/>\n".
" <input type=\"text\" name=\"cmtsgwnode\"/>\n".
" <input type=\"text\" name=\"slotport1\"/>\n".
" <input type=\"text\" name=\"ipv6subnethost1\"/>\n".
" <input type=\"text\" name=\"subnethost1\"/>\n".
" <input type=\"text\" name=\"dot1q1\"/>\n".
" <input type=\"image\" src=\"images/add.png\" alt=\"Add Row\" class=\"update\" title=\"Add Row\">\n".
"</form></div>";
?>
<div>
<br />
<b>Legend:</b>
<br />
<img alt="Add" src="images/add.png"> Add a row after entering the correct information.<br />
<img alt="Update" src="images/update.png"> Update a row after editing it.<br />
<img alt "Delete" src="images/delete.png"> Delete a row.<br />
<br />
<form method="get" action="http://<ip address removed>">
<button type="submit">Back</button>
</form>
</div>
</body>
</html>
$row[sqluid] ought to be $row['sqluid'] and there are several more like it as you build your input elements.

Categories

Resources