PHP - Php Javascript Confirm Msg Help!
Hello Frnds,
I have code which i am using for update a file ..... Code: [Select] $poid = $_POST['txtpoid']; $suppid = $_POST['suppid']; $custid = $_POST['custid']; $podate = $_POST['timestamp']; $poqty = $_POST['txtpoqty']; $chkqty = $_POST['chkqty']; if($chkqty<>$poqty) { ////HERE I WANT TO SHOW CONFIRM JAVASCRIPT WITH YES/NO OPTION (YOU ARE GOING TO CHANGE QUANTITY. ARE YOU SURE), IF YES THE QUERY UPDATE IF NOTHEN EXIT FROM HERE SO WHATS THE CODE please HELP///////////// } $query = ("update po SET suppid='$suppid',custid='$custid,podate='$podate',poqty='$poqty' where poid='$poid'"); if(!mysql_query($query, $link)) die ("Mysql error ....<p>".mysql_error()); Similar Tutorialshey guys, im pretty awful in programming, so bare with me.
im using javascript to pop-up a message box.
if user confirms, the page will insert data in mysql and redirects to the index page.
if user cancels the pop-up message, it will just stay on the main page.
but i can't seemed to pass the variables as it calls a set function...
what did i do wrong? any help from anyone is highly appreciated.
html page
<form method="post" action="seatplan_occupied.php"> <input name = "btn_seatOccupied" type = "submit" class="btnFORM" value="CONFIRM" onClick="seatOccupied()"> </form>php/javascript page (seatplan_occupied.php) <script> function seatOccupied() { document.getElementById("btn_seatOccupied").innerHTML; if (confirm("Are you sure you want to confirm your purchase?") == true) { alert("Yeay! You bought ticket/s"); <?php include("databaseconnect.php"); mysql_query("UPDATE tblseatchart SET seatSTATUS='Occupied' WHERE seatSTATUS='Selected'"); include("index.php"); ?> } else { alert("Owh No! You Cancelled to confirm... Whats wrong?"); } } </script> Can anyone help me with this delete confirm box. I have tried but somehow its not working. Can anyone help me with this? Thankz. html codes : echo "<td><a href=delete.php?id=" . $rows['id'] ." onclick=\"return confirm(Are you sure?);\">Delete</a></td>"; delete.php : <?php include "config.php"; ?> <?php $id=$_GET['id']; ?> <script type="text/javascript"> <!-- function confirmation() { var answer = confirm('Are you sure you want to delete?') if (answer){ $sql="DELETE FROM document WHERE id='$id'"; } else{ alert("Cancelled the delete!") } } </script> Hi!! I want to delete record which i clicked the delete button in the table. I want a confirm box for delete Here is code display.php Code: [Select] <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("register",$cn); $qry2=mysql_query("SELECT * FROM reg_table"); ?> <html> <head> <script type="text/javascript"> function show_confirm() { var r=confirm("Do you want to Delete?"); if (r==true) { } else { alert("You pressed Cancel!"); } } </script> </head> <body> <form action="delete.php" method="get"> <table width="200" border="1"> <tr> <th scope="col">Name</th> <th scope="col">Address</th> <th scope="col">Gender</th> <th scope="col">Qualify</th> </tr> <?php while($res=mysql_fetch_array($qry2)) { ?> <tr> <td><?php echo $res['name']; ?></td> <td><?php echo $res['adrs']; ?></td> <td><?php echo $res['gender']; ?></td> <td><?php echo $res['qualify']; ?></td> <td> <a href="edit.php?uid=<?php echo $res['id']; ?>">edit</a></td> <td> <input type="hidden" name="nid" value="<?php echo $res['id']; ?>" /> </td> <td> <input type="submit" value="Delete" name="del" onClick="return show_confirm();"> </td> </tr> <?php } ?> </table> </form> </body> </html> delete.php Code: [Select] <html> <body> <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("register",$cn); $del_id=$_GET['nid']; $qry=mysql_query("delete from reg_table where id='".$del_id."' "); if($qry) { echo "deleted"; } else { echo "not deleted"; } ?> </body> </html> Hello. How can I insert a prompt to confirm the deletion of a record? Currently I have a page that lists all of the table entries with a url to pass along the variable to identify the record to delete on a hidden, secondary page. Page 1 Code: [Select] echo "<a href=\"/administrator/db/event_delete2.php?id=$row[id]\">Delete</a>"; Page 2 Code: [Select] mysql_query("DELETE FROM event_schedule WHERE id='$id' LIMIT 1"); The code may be sloppy, but it works. Now I am trying to add the speedbump of the "are you sure you want to delete this record?" Thank you. Hi, i have delete link for records and it goes to other page to delete all related records in tables. is there away to get confirmation before the delete process starts? <?Php include('session.php'); include('dbcon.php'); if(isset($_GET['Del'])) { $userid = $_GET['Del']; $query = "delete from staff where OracleID='".$userid."'"; $result = mysqli_query($con,$query); if($result) { echo "staff deleted"; } else { echo 'check the errors!'; } $query2 = "delete from attendance_records where OracleID='".$userid."'"; $result2 = mysqli_query($con,$query2); if($result2) { echo "records deleted"; } else { echo 'check the errors!'; } header("location:viewstaff.php"); } else { header("location:viewstaff.php"); } ?> how to add confirm message with php before deletion is processed? Hello, I'm working on a register script, and basically I would like the user to repeat their password. And I would like PHP to compare the to passwords, and if they both match then it continues, whereas if they don't match it calls an error. Here is what I have so far: Form: Consists of 2 text fields - subpass, and subconfirmpass PHP: $field = "subpass"; if(!$subpass == $subconfirmpass){ $form->setError($field, "* Passwords do not match"); } $field is referring to the text fields in where the user inputs their password $form is keeping track of errors in user submitted forms and the form field values that were entered correctly. I would appreciate your help, Thanks i have some code which sends a confrim link via the posted email. In hotmail it works fine, once the link is clicked they are confirmed but gmail adds %09 to the link making it break. example WHERE hash = their email hashed posted email = test@test.com confirm link(hotmail) confirm.php?email=HASH&o=test@test.com(works) confirm link(gmail)confirm.php?email=%09HASH&o=test@test.com(Doesnt work) anyone know why gmail does this? This should be a simple task I am just not fully grasping laravel yet. I have my controllers view and models setup. I want to use my users.destroy route to delete my row in the db. But I want to do it a certain way. I want to have an alert show In my alert area on my page asking to confirm the deletion of a certain user. Im assuming I need to pass the user id in a session to an alert to confirm my delete on a delete button click. Click 1 button to open an alert on the top of my page if I click confirm it calls user.destroy.
<div class="container"> <div class="row justify-content-center"> <div class="col-md-12"> <div class="card"> <div class="card-header"> <h4>View All Users</h4> @if(session()->get('success')) <div class="alert alert-success"> {{ session()->get('success') }} </div> @endif @if(session()->get('danger')) <div class="alert alert-danger"> {{ session()->get('danger') }} </div> @endif </div> <div class="card-body"> <div class="text-center my-2"> <a href="{{ route('register') }}" class="btn btn-primary">New User</a> </div> <div> <table class="table table-striped table-bordered"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Email</th> <th>Username</th> <th colspan="2">Actions</th> </tr> </thead> <tbody> @foreach($users as $user) <tr> <th>{{$user->id}}</th> <td>{{$user->name}}</td> <td>{{$user->email}}</td> <td>{{$user->username}}</td> <td class="text-center"> <a href="{{ route('users.show', $user->id) }}" class="btn btn-primary mr-3">Show</a> <a href="{{ route('users.edit', $user->id) }}" class="btn btn-info text-white ml-3">Edit</a> <a href="#" class="btn btn-danger">Delete</a> </td> </tr> @endforeach </tbody> </table> public function destroy($id) { User::find($id)->delete(); return redirect()->route('users.index')->with('success','User Deleted'); } Route::resource('users', 'UserController');
Hi.. I have while loop inside while loop and I need to add confirm button on the last loop data. here is my code: <?php error_reporting(0); date_default_timezone_set("Asia/Singapore"); //set the time zone $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $Date_Shelve =date('Y-m-d H:i:s'); ?> <html> <head> <title>Job Order</title> <link rel="stylesheet" type="text/css" href="kanban.css" /> <style type="text/css"> #SR_date{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .8em; margin-left: 10px; margin-right: 770px; width: auto; height: auto; float: left; top : 10px; } #disp_btn{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .8em; margin-left: 10px; top: 10px; } #disp{ position: relative; font-family: Arial, Helvetica, sans-serif; font-size: .8em; margin-left: 10px; top: 10px; } table { margin: 12px; margin-left: 3px; font-family: Arial, Helvetica, sans-serif; font-size: .7em; border: 1px solid #DDD; } th { font-family: Arial, Helvetica, sans-serif; font-size: .9em; background: #694; color: #FFF; padding: 2px 6px; border-collapse: separate; border: 1px solid #000; } td { font-family: Arial, Helvetica, sans-serif; font-size: .7em; border: 1px solid #DDD; text-align: left; } table.mytable { margin: 12px; margin-left: 3px; font-family: Arial, Helvetica, sans-serif; font-size: .7em; border: 1px solid #678b3f; } table.mytable th { font-family: Arial, Helvetica, sans-serif; font-size: .7em; background: #694; color: #FFF; padding: 2px 6px; border-collapse: separate; border: 1px solid #000; } table.mytable td { font-family: Arial, Helvetica, sans-serif; font-size: .7em; /* border: .1em solid #DDD;*/ border:none; text-align: left; } </style> </head> <body> <div style="position: fixed;width: 1012px;"> <table> <th style="width:72px;position: fixed;"> JO No.</th> <th style="width:72px;position: fixed;"> ETD </th> <th style="width:195px;position: fixed;"> PO No. </th> <th style="width:108px;position: fixed;"> SKU Code </th> <th style="width:220px;position: fixed;"> Description </th> <th style="width:72px;"> Qty Req </th> <th style="width:55px;"> Lines </th> <th style="width:80px;"> Status</th> </table> </div> <div style='overflow:auto; height:200px;'> <table class="mytable"> <?php $sql = "SELECT jo_number, ETD, PO_No, SKUCode, Description, POQty, Priority, Status, line FROM job_order ORDER BY jo_number, ETD"; $res_jo = mysql_query($sql,$con); while($row_job = mysql_fetch_assoc($res_jo)){ // echo "<tbody>"; echo "<tr> <td><input type='text' name='JO_No_' id='JO_No_' value='$row_job[jo_number]' style='border:none;width:auto;' size='10' readonly='readonly'></td> <td><input type='text' name='ETD_' id='ETD_' value='$row_job[ETD]' style='border:none;width:auto;' size='10' readonly='readonly'></td> <td><input type='text' name='PO_No_' id='PO_No_' value='$row_job[PO_No]' style='border:none;' size='32' readonly='readonly'></td> <td><input type='text' name='SKUCode_' id='SKUCode_' value='$row_job[SKUCode]' style='border:none;' size='15' readonly='readonly'></td> <td><input type='text' name='Description_' id='Description_' value='$row_job[Description]' style='border:none;' size='35' readonly='readonly'></td> <td><input type='text' name='POReq_' id='POReq_' value='$row_job[POQty]' style='border:none;width:auto;' size='10' readonly='readonly'></td> <td><input type='text' name='line' id='line' value='$row_job[line]' style='border:none;width:auto;' size='7' readonly='readonly'></td> <td><input type='text' name='priority_' value='$row_job[Priority]' id='priority_' style='border:none;width:auto;' size='11' readonly='readonly'></td> </tr>" ; $sql = "SELECT pcode, lotcode, qty FROM jo_dump WHERE jo_number = '$row_job[jo_number]' ORDER BY date_entry ASC"; $res_dump = mysql_query($sql, $con); while($row_dump = mysql_fetch_assoc($res_dump)){ echo "<tr>"; echo "<td> </td>"; echo "<td> </td>"; echo "<td><input type='text' name='lotcode' value='$row_dump[lotcode]' style='border:none;width:auto;' size='10' readonly='readonly'></td>"; echo "<td><input type='text' name='pcode' value='$row_dump[pcode]' style='border:none;width:auto;' size='15' readonly='readonly'></td>"; echo "<td> </td>"; echo "<td><input type='text' name='qty' value='$row_dump[qty]' style='border:none;width:auto;' size='10' readonly='readonly'></td>"; echo "</tr>"; } } echo "</table>"; echo "</div>"; ?> </body> </html> and I attach the image of output of this code. Thank you Hi All, Prob very simple but here goes. I've a form on a page, which needs a recaptcha field, due to design constraints however, it won't fit. I therefore need it so you fill in the form, click submit, a new window appears with the recaptcha field and a confirmation button. Once you click confirm, the form is processed and the email sent. What's the best way to do this please? The form script has the PHP to handle the emailing side. I wonder whether someone may be able to help me please. I'm currently running the code below (originating from nearby.org.uk) to convert OS Grid References to Latitude and Longtiude co-ordinates. Code: [Select] function converttolatlng() { var gr = document.getElementById('osgridref').value; var osgb = new GT_OSGB(); if (osgb.parseGridRef(gr)) { var wgs84 = osgb.getWGS84(); document.getElementById('osgb36lat').value = wgs84.latitude; document.getElementById('osgb36lon').value = wgs84.longitude; } else { document.getElementById('osgb36lat').value = "n/a"; document.getElementById('osgb36lon').value = "n/a"; } } This code is run through a 'click' event from a button on a HTML form and then the record is saved to a mySQL database. However, once a month, I have a list of approx 20,000 OS Grid References which need converting and saving to the same mySQL database. To do this manually on a button click wouldn't be very practical, so I've been working on doing this automatically. I may very well be doing this the wrong way, but I've been using the PHP script below to extract the two pieces of information I need from the xml file, the first is the 'Name, and the second is the 'NGR', and it is this field that needs converting. Code: [Select] <? $objDOM = new DOMDocument(); $objDOM->load("scheduledmonuments.xml"); $Details = $objDOM->getElementsByTagName("Details"); foreach( $Details as $value ) { $Name = $value->getElementsByTagName("Name"); $name = $Name->item(0)->nodeValue; $NGR = $value->getElementsByTagName("NGR"); $ngr = $NGR->item(0)->nodeValue; echo "$name :: $ngr <br>"; } ?> This is where I've become a little stuck because I'm not sure how to get the data converted and to a point where it can be saved to the relevant fields in my database. I just wondered whether someone would perhaps take a look at this please and let me know what I need to do. Many thanks well i got more questions since i started at javascript and now im currently practicing php my question is whats the equivalent of this lines of codes to php language? document.getElementById("txt1").value <input type="button" name="one" id="one" value="1" onclick="javascript:getvalue(1);"\> == well what i mean is can i pass value to php functions every time i click it? just like calculators OT: can some1 help me translating my js calcu codes to php ones? document.getElementById("txt1").value this is my main problem i cant display the buttons i click the script here is the simplest progress bar ever.. what I want is for the value of the mutiplier (so how fast it loads) to be a php varible pulled from the users file <html> <head> <script type="text/javascript"> function progress() { if (document.images["bar"].width < 400) { document.images["bar"].width += 5; document.images["bar"].height = 5; } else { clearInterval(ID); } } var ID; window.onload = function() { ID = setInterval("progress();", 500); } </script> </head> <body> <img src="black.gif" name="bar" /> </body> </html> POSSIBLE? I'm trying to have a javascript confirm box pop up and confirm the intention to delete a record in a database. I think I'm having trouble calling the function within my PHP code, but not sure what exactly is wrong. The status bar shows something like "javascript:checkDelete(100, Title)" when I hover over the link and that seems right but nothing occurs when I click on it. Here is my code: Javascript Code: [Select] <script language="Javascript"> function checkDelete(b,Title){ var del=confirm("Are you sure you want to delete " + Title + " from the Database?"); if (del){ document.location="delete.php?mID=" + b + "&Title=" + Title; } } </script> PHP echo "<td><a href='Javascript:checkDelete(" . $row['mID'] . "," . $row['Title'] . ")'>"; echo "<img border=0 src='images/delete.gif'>" . "</a></td></tr>"; Anyone see my error? New to PHP/Java. Need some help!!! I need the textarea of a site to save what is entered into a text file. I also need javascript to use a pre-validate pop up box, if no data is entered. I can't get both of them to work at the same time. Below is my code. Code: [Select] <html> <head> <link rel="stylesheet" type="text/css" href="style.css"/> <script type="text/javascript"> <!-- <!CDATA[ function validateForm() { var x=document.forms["myForm"]["email"].value; var atpos=x.indexOf("@"); var dotpos=x.lastIndexOf("."); if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) { alert("Not a valid e-mail address"); return false; } } // ]]> --> </script> </head> <form name="form1" method="post" action="index2.php?saving=1"> <textarea name="data" cols="100" rows="10"> Username: Password: --------------------------------------------- </textarea> <br> </form> <form name="myForm" method ="post" action="index2.php?saving=1" onsubmit="return validateForm();"> <tr> <td align="right" width="10%"> Email: </td> <td><input type="text" name="email" id="email" size ="40" /> </td> </tr> <input type="submit" value="Submit"> </form> <p> <a href="index.html">Home</a> </html> PHP CODE: Code: [Select] <?php $saving = $_REQUEST['saving']; if ($saving == 1){ $data = $_POST['data']; $file = "data.txt"; $fp = fopen($file, "a") or die("Couldn't open $file for writing!"); fwrite($fp, $data) or die("Couldn't write values to file!"); fclose($fp); echo "Saved to $file successfully!"; } ?> Hello, I'm currently working on a gaming website, however there is an issue. I have a custom YouTube player, however I need to get the link dependant on a value from the database. The ID is in the URL, which is then collecting the youtube video URL from the database. However, I'm trying to then echo that back out into the Javascript video. On my normal page, that plays the Video is: Header: Styles.css & youTubeEmbed-jquery-1.0.css need to be added. Code: [Select] <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Having Fun With YouTube's API - Making a Custom Video Player | Tutorialzine Demo</title> <link rel="stylesheet" type="text/css" href="styles.css" /> <link rel="stylesheet" type="text/css" href="video_player/youTubeEmbed/youTubeEmbed-jquery-1.0.css" /> </head> Footer: All of that needs to be added. Code: [Select] <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="jquery.swfobject.1-1-1.min.js"></script> <script src="youTubeEmbed/youTubeEmbed-jquery-1.0.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#player').youTubeEmbed("VID LINK FROM DB SHOULD BE HERE"); $('form').submit(function(){ $('#player').youTubeEmbed({ video : 'VID LINK FROM DB SHOULD BE HERE', width : 640, // Height is calculated automatically progressBar : false // Hide the progress bar }); }); }); </script> </body> </html> Code: [Select] <?php include("config.php"); $host = $config['Site']['Host']; $username = $config['Site']['Username']; $password = $config['Site']['Password']; $database = $config['Site']['Database']; $name = $config['Site']['Name']; $favicon = $config['Site']['Favicon']; mysql_connect($host, $username, $password) or die(mysql_error()); mysql_select_db($database) or die(mysql_error()); function getVid() { $vID = $_GET['vID']; $sQuery = "SELECT * FROM vids WHERE id='$vID'"; $sResult = mysql_query($sQuery); while($row = mysql_fetch_array($sResult)) { $vID = $row['url']; } } ?> Above is the Global.php, and that's where the problem lies, whenever I try to insert the peices required, nothing happens and the video doesn't show. Could anybody please help?! Hi guys... i want to do registration of text box which are created dynamically.. please help me how can i do registration? I found a little javascipt online, and I wanted to play around with it. I'm trying to add a little php to it, I think I'm close to getting it, but when I click on the properties of the pictures that I want displayed, it has a bunch of extra garbage in it. So is the javascript reading something extra in the php script ? Here is the code. Code: [Select] <script language="JavaScript"> var j,d="",l="",m="",p="",q="",z="",KW_ARI= new Array() KW_ARI[KW_ARI.length]='<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>'; KW_ARI[KW_ARI.length]='<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>'; KW_ARI[KW_ARI.length]='<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>'; KW_ARI[KW_ARI.length]='<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>'; KW_ARI[KW_ARI.length]='<?php echo '<img src="trackimages/' . $row['new_pic'] . '" />'; ?>'; j=parseInt(Math.random()*KW_ARI.length); j=(isNaN(j))?0:j; document.write("<img name='seqSlideShow' src='"+KW_ARI[j]+"'>"); function seqSlideShow(t,l) { x=document.seqSlideShow; j=l; j++; if (j==KW_ARI.length) j=0; x.src=KW_ARI[j]; setTimeout("seqSlideShow("+t+","+j+")",t); } seqSlideShow(10000,0) </script> hi. i have a page B which has an image on it. When the page loads i want it to auto click on that image. I wrote the code below but it does not autoclick. can you please help? <script language="javascript"> function autoClick() { document.getElementById('thisLink').click(); } </script> <php> $visitpage = "http://mywebsitei.com/wp-content/uploads/12345.jpg"; <div style="text-align: center;" ######="setTimeout('autoClick();',3000);"> <a href=<?php echo $visitpage ?> rel="lightbox" > <img src=<?php echo $visitpage; ?> alt=""/></a> </div> </php> I would like to put an ad delay onto a webpage. No content shows up (complete white backgorund) until 30 seconds after viewing the ad. The ad would disappear and the content of the page would load up.
|