PHP - This Works...kinda
I have a script to check for duplicate username's on signup. Even when there is no entry found and the script preforms the update statement, the error will come back indicating the requested name already exists.
#Check to see if requested name already exists $name = $_POST['name']; $siteid = $_POST['siteid']; $checkname = mysql_query("SELECT * FROM projects WHERE url = '$name'"); $founduser = mysql_num_rows($checkname); if ($founduser != 0) { echo"$name already exists in the database. Please select another name";} if ($founduser == 0) { mysql_query("UPDATE projects SET url = '$name' WHERE siteid = $siteid"); die; echo"URL updated successfully";} If I remove the UPDATE statement and simply return an echo statement for each IF statement, everything works fine: if ($founduser != 0) { echo"$name already exists in the database. Please select another name";} if ($founduser == 0) { echo"$name is available";} So what's happening is, when $founduser == 0, the update script preforms just fine and the database is populated correctly, but then the entire script will then re-run itself and find the name that was just entered, resulting in $founduser != 0. How do I stop the script when it preforms the UPDATE statement? I tried putting die; in after the UPDATE statement, but the entire script still re-runs itself. I am pulling my hair out here... Similar TutorialsThe alias form isn't being read for some reason, with having $alias = $_POST['alias']; i don't quiet understand why this isn't it isn't being picked up as a variable below, any clues? cheers Code: [Select] <?php include("header.php"); if(isset($_POST['formAlias']) && $_POST['formAlias'] == 'Yes') { $alias = $_POST['alias']; $alias = preg_replace("/[^a-zA-Z0-9_]/", "", $alias); $namelength = strlen($alias); if($namelength < 3){ $error1="Your alias must be at least 3 characters!</span></div>"; echo $error1; }else{ } $query = sprintf("SELECT COUNT(id) FROM players WHERE UPPER(alias) = UPPER('$alias')", mysql_real_escape_string($alias)); $result = mysql_query($query); list($count) = mysql_fetch_row($result); if($count >= 1) { $error1="$alias is already taken."; echo $error1; }else{ } $sql = "updatehereble"; mysql_query($sql) or die(mysql_error()); }else{ } ?> </p> <p> <input name="alias" type="text" id="alias"> </p> <form action="alias.php" method="post"> Do you wish to use an alias? <input type="checkbox" name="formAlias" value="Yes" /> <input type="submit" name="formSubmit" value="Submit" /> </form> hope i'm in the right place. Hello,my name is carlton. i have a html form i created in dreamweaver cs. i have the accompanying .php script to forward user details to the server. i fill in the form, hit the submit button and nothing appears in the table i created. the testing server has been successfully configured the database "babiesnmovies" is recognized by dreamweaver. PLS tell me what i'm missing. below is a copy of the form and the script. Thank you so much. //this is the HTML registration web form i created in dreamweaver// Code: [Select] <legend>Parents Contact Information</legend> </h3> <form id="form1" name="form1" method="PUT" action="babiesnmovies.php"> <p> <label for="babiesnmovies.com/register">Your First Name</label> <input type="text" name="yourfirstname" id="babiesnmovies.com/register" /> <label for="babiesnmovies.com/registered">Your Last Name</label> <input type="text" name="yourlastname" id="babiesnmovies.com/registered" /> </p> <label for="babiesnmovies.com/yourname">Your Phone Number</label> <input type="text" name="yourphonenumber" id="babiesnmovies.com/yourname" /> <label for="babiesnmovies.com/email">Your E-mail</label> <input type="text" name="youremail" id="babiesnmovies.com/email" /> </p> </form> <p> </p> <h3> <legend>Baby's Vitals</legend> </h3> <form id="form2" name="form2" method="PUT" action="babiesnmovies.php"> <p> <label for="babiesnmovies.com/baby'slast">Baby's First Name</label> <input type="text" name="babysfirstname" id="babiesnmovies.com/baby'sfirst" /> <label for="babiesnmovies.com/babies">Baby's Middle Name</label> <input type="text" name="babysmiddlename" id="babiesnmovies.com/babies" /> </p> <p> <label for="babyslastname">Baby's Last Name</label> <input type="text" name="babyslastname" id="babyslastname" /> </p> <p> <label for="babiesnmovies.com/babybday">Baby's Birthdate</label> <input type="text" name="babysbirthdate" id="babiesnmovies.com/babybday" /> <label for="babiesnmovies.com/babyage">Baby's Age</label> <input type="text" name="babysage" id="babiesnmovies.com/babyage" /> </p> <p> <label for="babiesnmovies.com/baby">Baby's Height</label> <input type="text" name="babysheight" id="babiesnmovies.com/baby" /> <label for="babiesnmovies.com/babyweight">Baby's Weight</label> <input type="text" name="babysweight" id="babiesnmovies.com/babyweight" /> </p> <p> <label for="babiesnmovies.com/babyeyes">Baby's Eye Color</label> <input type="text" name="babyseyecolor" id="babiesnmovies.com/babyeyes" /> <label for="babiesnmovies.com/babyhair">Baby's Hair Color</label> <input type="text" name="babyshaircolor" id="babiesnmovies.com/babyhair" /> </p> <p> <label for="babiesnmovies.com/babyrace">Baby's Ethnicity</label> <input type="text" name="babysethnicity" id="babiesnmovies.com/babyrace" /> </p> <p><input name="formsubmit" type="submit" value="Submit" /> </form> //this is the babiesnmovies.php script// <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_babiesnmovies = "XXX"; $database_babiesnmovies = "XXX"; $username_babiesnmovies = "XXX"; $password_babiesnmovies = "XXX"; $babiesnmovies = mysql_pconnect($hostname_babiesnmovies, $username_babiesnmovies, $password_babiesnmovies) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db("db337879506", $con); $sql="INSERT INTO register (id, YourFirstName, YourLastName, YourPhoneNumber, YourEmailAddress, BabysFirstName, BabysMiddleName, BabysLastName, BabysBirthdate, BabysAge, BabysHeight, BabysWeight, BabysEyeColor, BabysHairColor, BabysEthnicity) values ( 'NULL','$yourfirstname', '$yourlastname', '$yourphonenumber', 'youremailaddress', '$babysfirstname', '$babysmiddlename', '$babyslastname', '$babysbirthdate', '$babysage', '$babysheight', '$babysweight', '$babyseyecolor', '$babyshaircolor', '$babysethnicity')"; $yourfirstname = $_POST ['YourFirstName']; $yourlastname = $_POST ['YourLastName']; $yourphonenumber = $_POST ['YourPhoneNumber']; $youremailaddress = $_POST ['YourE-mailAddress']; $babysfirstname = $_POST ['BabysFirstName']; $babysmiddlename = $_POST ['BabysMiddleName']; $babyslastname = $_POST ['BabysLastName']; $babysbirthdate = $_POST ['BabysBirthdate']; $babysage = $_POST ['BabysAge']; $babysheight = $_POST ['BabysHeight']; $babysweight = $_POST ['BabysWeight']; $babyseyecolor = $_POST ['BabysEyeColor']; $babyshaircolor = $_POST ['BabysHairColor']; $babysethicity = $_POST ['Babys Ethnicity']; ?> Thank you. Right i want to have friends displayed on peoples profiles but i can only ave there name and not the avater displayed here is the code ive got which doesnt work <? $picture = mysql_query("SELECT * FROM users WHERE username = '$dip->person'"); $pc = mysql_fetch_object($picture); $query_friends=mysql_query("SELECT * FROM friends WHERE username='$viewuser' AND type='Friend'"); $rows=mysql_num_rows($query_friends); if ($rows == "0"){ echo "<center>No friends</center>"; } $friend = 0; while($dip=mysql_fetch_object($query_friends)){ echo " <img src='$pc->image' width='50' height='50' border='1'><br><a href='profile.php?viewuser=$dip->person'>$dip->person</a>,"; $friend++; echo ($friend % 3 == 0)? "<br>" : ""; } ?> The friends are from the friends database and the avater is from the users database how can i link them so the name and the avater show ive tried this but only the names are displayed and the avaters dont show With a TON of help from you guys already it's working but I do have one thing that I just need to figure out to clean it all up...
echo $games['htn']," ",$games['hs']," VS ",$games['vtn']," ",$games['vs']," on ",$games['d']," at ",$games['t'];This is returning what I need perfectly except if an object is empty it's also showing that.. for example... Pittsburgh Steelers 0 VS Baltimore Ravens 0 on Sat at 8:15 --- is what I want to show... shows up great then the next line will show an empty set because the games are not known until other games are played so I also get this: 0 VS 0 on Jan 18 at 3:05 and Seattle Seahawks 0 VS 0 on Jan 10 at 8:15 What can I do to make this not show up? $xml = simplexml_load_string($data); // print_r($xml); foreach($xml->gms->g as $games) { echo "<div class='button blue'>"; echo $games['htn']," ",$games['hs']," VS ",$games['vtn']," ",$games['vs']," on ",$games['d']," at ",$games['t']; echo "</div>"; }This is what I have and it's working with a lot of help from you guys... I just need to clean it up so I can show only games that have two teams listed.. Thanks again everyone!! Edited by cowboysdude, 02 January 2015 - 11:03 PM. Hi all - I have a simple PHP app, which I've run thru my Dreamweaver validation and a few PHP syntax validators and it comes out clean. Works perfectly in Firefox but shows a blank page in I.E. and I'm not sure why. The functionality is simple - the page shows a disclaimer, and when the user hits 'OK" it should hide the disclaimer and then display other content. Here's the URL: https://www.dca.ca.gov/webapps/bppe/annual_report.php Any ideas as to what is wrong? Thanks! Here's the code: <?php if(isset($_POST['OK'])){ ?> <h3 class="center"><a href="#a">A</a> <a href="#b">B</a> <a href="#c">C</a> <a href="#d">D</a> <a href="#e">E</a> <a href="#f">F</a> <a href="#g">G</a> <a href="#h">H</a> <a href="#i">I</a> <a href="#j">J</a> <a href="#k">K</a> <a href="#l">L</a> <a href="#m">M</a> <a href="#n">N</a> <a href="#O">O</a> <a href="#p">P</a> <a href="#q">Q</a> <a href="#r">R</a> <a href="#s">S</a> <a href="#t">T</a> <a href="#u">U</a> <a href="#v">V</a> <a href="#w">W</a> <a href="#x">X</a> <a href="#y">Y</a> <a href="#z">Z</a></h3> <h3><a name="a">A</a>:</h3> <h3><a name="b">B</a>:</h3> <h3><a name="c">C</a>:</h3> <h3><a name="d">D</a>:</h3> <h3><a name="e">E</a>:</h3> <h3><a name="f">F</a>:</h3> <h3><a name="g">G</a>:</h3> <h3><a name="h">H</a>:</h3> <h3><a name="i">I</a>:</h3> <h3><a name="j">J</a>:</h3> <h3><a name="k">K</a>:</h3> <h3><a name="l">L</a>:</h3> <h3><a name="m">M</a>:</h3> <h3><a name="n">N</a>:</h3> <h3><a name="o">O</a>:</h3> <h3><a name="p">P</a>:</h3> <h3><a name="q">Q</a>:</h3> <h3><a name="r">R</a>:</h3> <h3><a name="s">S</a>:</h3> <h3><a name="t">T</a>:</h3> <h3><a name="u">U</a>:</h3> <h3><a name="v">V</a>:</h3> <h3><a name="w">W</a>:</h3> <h3><a name="x">X</a>:</h3> <h3><a name="y">Y</a>:</h3> <h3><a name="z">Z</a>:</h3> <?php }else{ ?> <form method="post" action="annual_report.php"> <fieldset> <strong><p><strong>An Annual Report must be filed with the Bureau for Private Postsecondary Education (Bureau) by each approved institution pursuant to California Education Code (CEC) section 94934. The Institution reports the required aggregate information for all locations (main and all branches). In addition to the Annual Report, each Institution is required to submit a Performance Fact Sheet and the school catalog.</strong></p> <p><strong>The Bureau <span style="text-decoration:underline">publishes the</span> information provided in the links below <span style="text-decoration:underline">as it was submitted</span> by the institution, and does not endorse, recommend, or favor any institution whose information is published or provided</strong>.</p> <p><strong>Disclaimer of Liability</strong> <br /> The California Department of Consumer Affairs, Bureau for Private Postsecondary Education shall not be held liable for any inaccurate, altered, delayed, omitted, or misleading information, or any improper or incorrect use of the information published or provided herein, and assumes no responsibility for anyone's use of the information on any theory of liability. </p> <p><strong>Disclaimer: Links</strong> <br /> The Department of Consumer Affairs, Bureau for Private Postsecondary Education is not responsible for the contents of any off-site pages that reference, or that are referenced by, this website. The user specifically acknowledges that the Department of Consumer Affairs, Bureau for Private Postsecondary Education is not liable for any defamatory, offensive, misleading or illegal conduct of other users, links, or third parties and that the risk of injury from the foregoing rests entirely with the user. <br /> Links from this site to other sites, do not constitute an endorsement by the Department of Consumer Affairs, and are for convenience only. It is the responsibility of the user to evaluate the content and usefulness of information obtained from other sites. <br /> When you use a link to connect to another site, you are no longer on the Department of Consumer Affairs', and/or its constituent Boards’ or Bureaus’ web sites and are subject to the privacy policies and other practices of the new site. The Department of Consumer Affairs and/or its Board or Bureaus has no control over and is not responsible for the information, practices or content of these or any other sites and your participation in promotions or services of any kind with any third party found on or though this site, or your correspondence or business dealings of any kind with any third party found on or through this site are solely between you and that third party.<br /> The Department of Consumer Affairs and/or its Boards or Bureaus does not, by way of its links to other sites, endorse, adopt, recommend, promote or support products, positions, statements made or taken by parties controlling the other sites.</p> <p><strong>Choice of Law </strong><br /> Construction of the disclaimers above and resolution of disputes thereof are governed by the laws of the State of California.</p></strong> <div class="content_onecolumn"> <input type="submit" name="OK" value="OK" class="inputSubmit" /> </div> </fieldset> </form> <?php } ?> Alright this script is being stupid! Heres the Script... $gid = array($P1 = $_POST[P0] ,$P2 = $_POST[P1] ,$P3 = $_POST[P2] ,$P4 = $_POST[P3] ,$P5 = $_POST[P4] ,$P6 = $_POST[P5] ,$P7 = $_POST[P6] ,$P8 = $_POST[P7] ,$P9 = $_POST[P8] ,$P10 = $_POST[P9] ,$P11 = $_POST[P10] ,$P12 = $_POST[P11] ); $pick= array($G1 = $_POST[game1] ,$G2 = $_POST[game2] ,$G3 = $_POST[game3] ,$G4 = $_POST[game4] ,$G5 = $_POST[game5] ,$G6 = $_POST[game6] ,$G7 = $_POST[game7] ,$G8 = $_POST[game8] ,$G9 = $_POST[game9] ,$G10 = $_POST[game10] ,$G11 = $_POST[game11] ,$G12 = $_POST[game12] ); function iORu($gameF, $pickF){ $Current_user_id = $_SESSION[user_id]; $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("sports", $con); $query = "SELECT User_ID FROM CollegeFootballPicks WHERE User_ID='$Current_user_id' && Game_ID='$gameF'"; $result = mysql_query($query); if(mysql_num_rows($result) == 0){ $query = "INSERT INTO CollegeFootballPicks (User_ID, Game_ID, Pick) VALUES ('$Current_user_id','$gameF','$pickF')"; $result = mysql_query($query); echo'Inserted'; }else{ $query = "UPDATE CollegeFootballPicks SET User_ID = '$Current_user_id', Game_ID = '$gameF', Pick = '$pickF'"; $result = mysql_query($query); echo'Updated'; } mysql_close(); echo "<i>"; echo ' '.$Current_user_id. ' '; echo $gameF. ' '; echo $pickF. ' '; echo "</i>"; echo '<br />'; } //End of Function for($i=0; $i< 12; $i++) { iORu($gid[$i],$pick[$i]); } For testing purposes i have inserted all the echos along the way to visually see how far its getting. When i run the script it recognizes all the information when and where it's supposed to (With the echos) but its not inserting/ updating to mysql except for game 1 (i.e. the first time the function runs) Does anyone see any errors? It doesn't make sense on why all the info echos exactly right, and game one inserts and updates right. But games 2-12 don't insert or update! Before anyone says something. Yes this is the same shit i've been working on for about two weeks and have gotten help with before. I have two jobs and web design aint one of them. So if your gonna help, help! But if your gonna say something that aint in any way "help" keep it to yourself! Hai i am very much new to PHP...can any one suggest me.....which framework to follow.....
Thanks & Regards
Shankaar
Weird question, but is there a way using PHP to "check" to see if a certain URL brings up an actual real page, or if it brings up a 404 error or something? Any functions do anything like that? maybe some wiz kid out their can help me figure out whats going on here. What suppose to happen is a random site suppose to load into a iframe When the frameset code below is inside the <body> tags only the menubar shows up and not the iframe with a random site. Now when i take the code and put it oustide the <body> tag the menubar goes away and only the iframe with a random site is shown . The goal of course is to get the menubar to be visible and to have a iframe with a random site loaded into it. For some reason i can only get one of the two the happen. I do hope i explained this well enough Code: [Select] <frameset rows="80,*" BORDERCOLOR="#222222" BORDER="3"> <frame src="explore.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" /> <frame src="<?php while ($row = mysql_fetch_array($result)){ print $row["url"];}?> " name="random" marginwidth="O" marginheight="0" noresize scrolling="auto" /> </frameset>-------------------------------------------------------------------------------------------------- Code: [Select] <?php /** * @author Brent Moeller * @copyright 2011 */ include ('functions.php'); db_connect(); $result = mysql_query("SELECT * FROM slinks where approval='1' ORDER BY RAND() LIMIT 1") or die(mysql_error()); ?> <html> <head> <title>DizzyUrl Discovery Engine</title> <link rel="stylesheet" type="text/css" href="mouseovertabs.css" /> <script src="mouseovertabs.js" type="text/javascript"> /*********************************************** * Mouseover Tabs Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more ***********************************************/ </script> </head> <body> <frameset rows="80,*" BORDERCOLOR="#222222" BORDER="3"> <frame src="explore.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" /> <frame src="<?php while ($row = mysql_fetch_array($result)){ print $row["url"];}?> " name="random" marginwidth="O" marginheight="0" noresize scrolling="auto" /> </frameset> <div id="mytabsmenu" class="tabsmenuclass"> <ul> <li><a href="http://www.javascriptkit.com" rel="gotsubmenu[selected]">JavaScript Kit</a></li> <li><a href="http://www.cssdrive.com" rel="gotsubmenu">CSS Drive</a></li> <li><a href="http://www.codingforums.com">No Sub Menu</a></li> </ul> </div> <div id="mysubmenuarea" class="tabsmenucontentclass"> <!--1st link within submenu container should point to the external submenu contents file--> <a href="submenucontents.htm" style="visibility:hidden">Sub Menu contents</a> </div> <script type="text/javascript"> //mouseovertabsmenu.init("tabs_container_id", "submenu_container_id", "bool_hidecontentsmouseout") mouseovertabsmenu.init("mytabsmenu", "mysubmenuarea", true) </script> <noframes> <p>This Browser does not support Frames.</p> </noframes> </body> </html> Howdy! I have been working in this custom script to manage some people on a group.. It will be really complete, with profiles, related stats and also an simple email client. But recently I have been having an issue with the function move_uploaded_file() to upload a picture to the user's profile. Apparently it works for some files (which means the syntax and paths are correct), but for some others move_uploaded_file() returns FALSE and I just can't work it out. Here is the part of the script that treats the uploading: Code: [Select] $target_path = "/opt/lampp/htdocs/emp/deeper/profiles/avt/"; //>>PATH<< to avt folder if (!isAllowedAvatar($_FILES['picture']['name'])) { //Check for allowed filetypes print "<div class='notif error bloc'><strong>Error :</strong> Wrong filetype. Image must be PNG file...</a></div>"; die; } if (file_exists($target_path.$basename.".png")) { //Rename old image to prevent loss of it in case of Failure rename($target_path.$basename.".png",$target_path.$basename."_temp.png"); } $old_path = $target_path; $target_path = $target_path . $basename . ".png"; //Build new image path if(move_uploaded_file($_FILES['picture']['tmp_name'], $target_path)) { //Moves uploaded image print "File ". basename($_FILES['picture']['name'])." correctly uploaded"; unlink($old_path.$basename."_temp.png"); //Deletes temp file } else { print "There was an error uploading the file, please try again!"; rename($old_path.$basename."_temp.png",$old_path.$basename.".png"); //Reverts the temp file to the original } I think the comments are enough for understanding it. Also, it looks like move_uploaded_file() is returning FALSE if the file is from Linux and had ownership stuff.. Any tip is welcome! Thanks for reading! Hi all,
Having an issue with some of my php code. The goal is to have two drop-down menus, one that pulls from "ahevents_scenarios". The second pulls the "sides" involved, however it does not go into dropdown. The other issue is that even though there are only 3 sides specified, all 5 show up on the webpage. This is in Joomla.
Here is my code...I think I've looked over this way too much and just can't find my errors anymore.
<?php if (! $my->id) { // shouldn't even get here since menu is viewable only through logged in status print "<b>Sorry, you must be registered and logged into this site to continue</b>\n"; } else { // include standard functions and db info require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/admin_functions.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/db_admin_functions.php"); // which scenario we doing? -- replace with table lookup in future opendb('ahevents_scenarios'); if(!isset($_POST['action'])) { // display form $sqlstr2 = "select id, name from scenarios order by name"; $result2 = mysql_query($sqlstr2) or die("Error: ".mysql_error()."<br>Query: $sqlstr2"); // display form ?> <form name="edit_reg" method="post" action="<? echo $_SERVER[ 'REQUEST_URI' ]; ?>" <table> <tr> <td>Select Scenario: </td> <td> <select name="id"> <? while ( $row = mysql_fetch_array($result2)) { printf("<option value=\"%s\">%s</option>\n",$row['id'], $row['name']); } ?> </td></tr> <tr> <td>Which Side?</td> <td><select name="side"> <option value="side_1">side_1</option> <option value="side_2" >side_2</option> <option value="side_3" >side_3</option> <option value="all" selected>All</option> </select> </td></tr> </table> <p> <input type="submit" name="action" value="Get Registrants"> <input type="reset" value="Reset"> <input type="button" name="" value="Back" onClick="history.back()"> </form>The goal is to download the registrants into a .csv file, which it does, however due to not being able to select a "side", the .csv is blank with only headers, no content. Thanks for your time Rob Greetings, all - Curious to know if someone wouldn't mind taking a look at this code and letting me know if there are any apparent errors that may cause this problem: I attempted sending the message to one of my two 1and1 email accounts and after some delay, it sent it to 1and1 account B but not 1and1 account A. My gmail account, however, gets them every time. I'd like to just say it's some issue with 1and1 but since it successfully got through to the one 1and1 account I'm not comfortable stopping at that. I should also mention that for some reason, as I'm trying it today, the successful 1and1 account will no longer receive the messages... I've tried it with directly copying the php mail code from 1and1's FAQ, though, and it seemed to work for the 1and1 account that was previously succcessful (acct B) but not acct A. Very stuck... Thanks $from = $_REQUEST['email']; $subject = $_REQUEST['subject']; $message = $_REQUEST['question']; mail("username@domain.com", "Subject: $subject", $message, "From: $from"); echo "Mail sent"; 1and1 FAQ with mail code: http://faq.1and1.com/scripting_languages_supported/php_mail_explained/2.html I have the following 2 scripts. One adds to the database and the other deletes a record from the database. Code: [Select] <form action="deletebidder.php" method="post"> <table> <tr> <td><font face ="calibri" size="4"> Add Bidder:</td> </tr> <tr> <td><input type="text" name="biddersId" /></td> </tr> <tr> <td><input type="hidden" name="addedbidder" /></td> </tr> <tr> <td><input type="Submit" value="Add"></td> </tr> </table> Second from: Code: [Select] <form name="deletebidder" action="process_bidders2.php" method="post"> <table> <tr> <td><font face= "calibri" size= "3"> Delete Bidder</font></td> </tr> <tr> <td><input type= "text" name="deletebidder" /></td> </tr> <tr> <td><input type= "hidden" name="deletebidder1" /></td> </tr> <tr> <td><input type= "submit" value= "submit" /></td> </tr> </table> </form> Both forms are on the same page. Now I have tried separate processing pages with the same results (If i get one to work the other doesn't, it's either one or the other, but they won't work together. If i have the add bidder working, the delete bidder doesn't work and visa versa?? Also, ONE IMPORTANT note is, if i try to process each form on separate pages, no matter what action "name" i give the form, it will only go to the action page that is working. Example is, I tried to process one form on deletebidder.php and the other on process_bidders2.php but it didn't matter. Both forms were processed by the deletebidder.php page. How is this even possible if I gave them both seperate action "paths"?? Code: [Select] <?php ob_start(); error_reporting(E_ALL); ini_set("display_errors", 1); $biddersId= $_POST['biddersId']; if (isset($addedbidder)) \\hidden form field { mysql_connect("$host", "$db_user", "$db_password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM bidders WHERE biddersId='$biddersId'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); if($count==0){ // Add $biddersId to DB and redirect to anypage mysql_Query("INSERT INTO bidders (biddersId) VALUES ('$biddersId')"); header("Location: attendance.php"); exit(); } } if (isset($deletebidder1)) \\hidden form field { $biddersId= $deletebidder; mysql_connect("$host", "$db_user", "$db_password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select DB"); mysql_query("DELETE FROM bidders WHERE biddersId='$biddersId'"); header("Location: attendance.php"); exit(); } ob_flush(); echo "<font color= \"red\" face=\"calibri\" size=\"4\">That bidder is already logged, Please press your browsers back button and try again.</font>"; ?> Hi all,
My company has a php site on wordpress that i’m trying to add google AD tracking to. Now, on the live site, when i’m logged into word-press and run the page, I can see the triggers firing fine on Tag assistant, if i un-comment the alerts, they also fire. When i log out of word-press and hit the page, nothing happens at all. No alerts, no google triggers, nothing in the php is running? Any ideas whats going on ?
<script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-1234567897'); <?php $url = $_SERVER['REQUEST_URI']; if ($url =="/thankyou/") { print " gtag('event', 'conversion', {'send_to': 'AW-1234567897/1234567897', 'value': 1.0, 'currency': 'GBP' }); "; print " gtag('event', 'conversion', {'send_to': 'AW-1234567897/1234567897'}); "; //Print "alert('OK');"; //Print "alert('" . $url . "');"; } ?> </script> tia Dave Greetings to all!
Newbie here, I just signed up this morning. I have an issue with a code I have been using for several years with multiple files/directories. Until recently all of the files have worked flawlessly. Now I have one file in a directory that does not display the text I which I am attempting to call up and it was working until recently.
Every file with the same code as the errant one work flawlessly except for the errant one, and I have 11 files to be displayed on my website at https://TheLoveOfGod.org They are all listed under the Devotionals menu button except for one which is displayed on the home page. I have absolutely no training in web design, I am self taught. I began by hand typing html coding over 30 years ago and am now using Word Press with Elementor . I do not understand why this is happening. Can any of you offer assistance to resolve this. I thank you in advance for your assistance.
Edited September 25, 2020 by namednad more explanation Hi, I don't know if this is the right place, but I used a code for a dropdown menu witch works fine on the website (geloven.eu/ABK2021) who uses PHP 7.2.24, but the dropdown does NOT work on another site bijbelkamp.eu/ABK2021 who uses PHP 7.3.28. The index page just includes the menu.php (here menu.txt) and the css file bootstrap21.css (here bootstrap21.txt). Can this be some coding issue or does this have nothing to do with the code? bootstrap21.txt menu.txt I was trying to refrain from posting, but its driving me mad and I am not sure what to do.
Here is the issue.
I have some rewrite rules and are making them better. But for now just need to know why this rule is giving me a page not found everytime.
Firstly, this rule works fine:
Options +FollowSymLinks For years I have used a simple captcha application displaying a simple combination of letters and numbers.
All has worked fine except that my hosting company upgraded some of their servers from PHP 5.2.17 to PHP 5.4.29. The numbers now down't display and I can submit the form without filling any captcha into the text box.
On the otherhand, I have a couple of sites on different servers, (same hosting company) using PHP 5.2.17 and the captcha application works perfectly.
The code to make the captcha works uses $HTTP_SESSION_VARS and I understand it is deptrecated with newer versions of PHP so I changed to $_SESSION.
If I fill out the form and leave the captcha blank it will default to the error message and require a return to the form page to fill in the captcha. Once filled in and the form submitted, it goes to the default message.
It appears that the session variable is not passing to the page and recognized.
I have some code that works fine on my dev server but does not work on my production server. Dev server has PHP version 5.2.5 and production server has PHP version 5.1.6. This is the part of the code that isn't working on the prod. server: $xmlDoc=new DOMDocument(); $xmlDoc->loadXML($tmpDoc); $x=$xmlDoc->getElementsByTagName('link'); //get the q parameter from URL $q=$_GET["q"]; //lookup all links from the xml file if length of q>0 if (strlen($q)>0) { $hint=""; for($i=0; $i<($x->length); $i++) { $y=$x->item($i)->getElementsByTagName('title'); $z=$x->item($i)->getElementsByTagName('url'); if ($y->item(0)->nodeType==1) { //find a link matching the search text if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q)) { if ($hint=="") { $hint="<tr><td><a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</td></tr>"; } else { $hint=$hint . "<tr><td><a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a></td></tr>"; } } } } } $tmpDoc is a variable that holds database information in xml form. It basically looks like this: $tmpDoc = $tmpDoc . "<link><title>" . $row['CustomerName'] . "****" . $row['Rep'] . "****" . $row['InstallDate'] . "****" . $row['PaidDate'] . "</title><url>accountPage.php?AccNum=" . $row['AccountNum'] . "</url></link>"; ...that is inside a while loop that loops through the rows returned by a query. Basically, as I said, the whole thing works fine on my dev server but on the production server it never makes it into the for loop so I guess the condition $i<($x->length) isn't being met. I'm at a bit of a loss here. Is there anything like the PHP version or Apache version that may cause the "->" operator to not work? The prod PHP version isn't that much older than my dev PHP version so I doubt that's the issue but it's about all I can think of. Thanks! Ok, so I have a REALLY strange problem. So I am trying to delete an array of checkboxes with an input delete piece and I have used a bit of a tutorial on the deletion part. But, my form works fine in IE9 when I do this and doesn't work in firefox when I have it inside a <form> tag. Code: [Select] <form name="deletecheckbox" method="post" action=""> <input name="delete" class="delete_button" type="submit" id="delete" value="Delete" /> //some checkboxes pulled in dynamically thru ajax inside a loop and I won't put the whole looping code just what the checkbox looks like <input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"$ID\"> <? $contact_query = "SELECT ID FROM Contacts ORDER BY ID ASC"; $contact_query_result = mysql_query($contact_query); $count=mysql_num_rows($contact_query_result); if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM Contacts WHERE ID='$del_id'"; $result = mysql_query($sql); } } ?> </form> Now, if I do the same thing without the form part, it works in Firefox but not in IE Code: [Select] <input name="delete" class="delete_button" type="submit" id="delete" value="Delete" /> //some checkboxes pulled in dynamically thru ajax inside a loop and I won't put the whole looping code just what the checkbox looks like <input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"$ID\"> <? $contact_query = "SELECT ID FROM Contacts ORDER BY ID ASC"; $contact_query_result = mysql_query($contact_query); $count=mysql_num_rows($contact_query_result); if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM Contacts WHERE ID='$del_id'"; $result = mysql_query($sql); } } ?> Anyone know what's goin on here? I'm lost. |