Jump to content

mitchberry

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mitchberry's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. curl opens another page, and pulls the info from that page like a reverse post it seems like. i need to post from file A to file B,. then from B to URL.... meanwhile i am studying up on curl since i really have no idea what it is.. i just know it's not supported....
  2. it is not supported on my web server, and i know there's another way around it. that and, maybe i misunderstand curl, but... curl allows you to log into various websites and make use of various things within it, therefore, i would be logging into the other page and making use of IT to do this stuff... thing is, i have -0- access to the page that things post to currently. it's on the other company's server and is a general script that is used for all of their clients (us and hundreds of other companies), so i can't alter anything within it.. basically, i can take water to a wall in a bucket, and i can throw the bucket of water over wall, but.. i will never know where it's landing, or what happens to it when i do.... it just... does what it does... and i need to do all of my validation prior to posting to that url... then... post to that url without using a second button. -using GET- instead of post.
  3. [[[[[[[ How to submit a form WITHOUT taking action on a button click and WITHOUT using CURL OR Javascript??? ]]]]]]]]]] Hi.. So I have an interesting problem that is going to take a little bit of effort to explain. Please bare with me. I have a CRM that allows web to lead campaigns... the problem is, the CRM is part of a phone system, therefore no one here would be familiar with it. With this system, it is possible to do “Web to Campaign.” Basically, you put a form on your website, someone fills it out, and it posts to a specified address via “GET” then processes the information, posts the new “lead” to the call list for the employees to call. Here’s the thing though. Typically when making a contact form, I would have a form that posts to a second file once the info is filled and the submit button has been clicked (or posts to self depending). The second file would say “if this is blank then say that, if this is that way then do this, etc etc etc etc… You know……. Like NORMAL… But the problem is, I don’t really have that capability with this. I make a form, they fill it out, hit submit, then it passes the info to the post URL that they provide and IT does all of the work. -but NO error handling-. What I NEED is, when a client fills out the form, hits submit, MY code will say “if this is blank throw an error, if the state is Lower case, make it upper case before sending it, if there are “-“ in the phone number, take them out and eliminate the spaces etc etc etc etc etc etc etc THEN…. If everything is OK…… post it to this URL that is specified by that company. In other words <form method=”post” action=”validate.php”> <input ---- form stuff Form stuff Form stuff [submit button] </form> Then they click the submit button $name = $_POST[‘name’]; (etc etc) If this happens then that, if that happens then this, if everything is CORRECT ----POST to URL provided by our web to campaign company…… ---------------------------- DOES WHAT IT DOES ---------------------------- Does that make sense at all? FYI… I know how to do everything BUT post without making someone take action on a button… they WILL need to hit submit the first time... then it goes through my error handling code, and THEN gets sent to the Post URL they specify.. This is what the form does currently. At the bottom, I put a “spry” text area that will throw an error if it isn’t filled out. (for testing purposes) The problem is, IF JAVASCRIPT IS TURNED OFF ON THE CLIENT MACHINE THEN IT DOES NOT WORK. The other thing is, if ANYTHING is entered into the form incorrectly, we will not get the lead, and it will not TELL THEM that it was not successful. So… that is the reason I need this to be done in PHP. what i have currently is JUST a form... and it works as such... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> </head> <body> <?php $user_ip = $_SERVER['REMOTE_ADDR']; $client_date_entered = date("m-d-Y h:i:s a"); ?> <form id="form1" name="form1" method="get" action="https://(blah blah blah).com/web2campaign/AddToList"> <input name="F9domain" type="hidden" value="DRI1" /> <input name="F9list" type="hidden" value="from_web" /> <input name="F9retResults" type="hidden" value="1" /> <input name="F9retURL" type="hidden" value="http://www.mywebsite.com/Web2Campaign/index.php" /> <input name="IP" type="hidden" value="<? echo"$user_ip"; ?>" /> <input name="submit_dateTime" type="hidden" value="<? echo"$client_date_entered"; ?>" /> <input name="SourceID" type="hidden" value="P1" /><!-- P1 refers to the page that this information came from physically. --> <input name="lead_provider" type="hidden" value="LP2A" /> <input name="F9CallASAP" type="hidden" value="1" /> <table width="600" border="0"> <tr> <td>First Name</td> <td><input type="text" name="first_name" /></td> </tr> <tr> <td>Last Name</td> <td><input type="text" name="last_name" /></td> </tr> <tr> <td>Phone (no spaces)</td> <td> <input type="text" name="number1" id="number1" maxlength="10" size="10" /> </td> </tr> <tr> <td>City</td> <td><input type="text" name="city" /></td> </tr> <tr> <td>State</td> <td><input type="text" name="state" /></td> </tr> <tr> <td>Zip</td> <td><input type="text" name="zip" /></td> </tr> <tr> <td>Email</td> <td><input type="text" name="email" /></td> </tr> <tr> <td>Debt Amount</td> <td><input type="text" name="debt_amount" /></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <span id="sprytextfield1"> <input type="text" name="whatever" id="whatever" /> <span class="textfieldRequiredMsg">A value is required.</span></span> <script type="text/javascript"> <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1"); //--> </script> <input name="submit" type="submit" value="submit" /> </form> </body> </html> All of that was basically to ask how to post the second time without having them hit submit twice....... I have never made something submit without a submit button. Thanks in advance..
  4. So, i have a few different pages that correspond to each other.. it would take me a while to explain it, so i'll see if i can do so minimally while giving you enough info to go on.. when a person is logged in, it checks whether they are an admin or not. when they log in it takes them to a page that shows their sales and their commissions for those clients. they can click on "my account" which uses a form and a hidden field and passes them to the page in question. in this page, it gives them the ability to change their first and last name and their password... it also gives them a rundown of the totals of their numbers. by the way "pounds" in this case is actually an industry term, but i use the GBP symbol because it makes sense. here's the problem. when i am logged in as admin and i look at the overview page, it shows the numbers correctly.. when i log into the page in question as an admin AND OR when the employee logs in as a non admin to change their info, a lot of the information has DOUBLED ... <?php if ($_SESSION["contractor_login"] == "Admin" ) { $result = mysql_query("SELECT *, SUM(client_pounds), AVG(client_pounds), SUM(user_payment_left), COUNT(client_id) FROM contractors, whiteboard, lead_providers WHERE contractors.user_username = '".$user_username."' AND whiteboard.user_username = contractors.user_username"); } else { $result = mysql_query("SELECT *, SUM(client_pounds), AVG(client_pounds), SUM(user_payment_left), COUNT(client_id) FROM contractors, whiteboard, lead_providers WHERE contractors.user_username = '".$access."' AND whiteboard.user_username = contractors.user_username"); } ?> anything that says SUM gives double the amount it should... which is deals, total pounds and the commission.. which is not cool.... can anyone see why this would be the case? i'm pretty sure it's not taking values from a previous page. the only thing it's taking from another page that i know of is the log in information in sessions... any thoughts are greatly appreciated.. if i need to provide code for associated pages i will.. below is the entire code.. thanks in advance ------------------- <?php include "head.php"; include "menu.php"; $_SESSION["contractor_login"]; // store session data $_SESSION["contractor_password"]; $access= $_SESSION["contractor_login"]; if(isset($_SESSION['contractor_login'])) { if(isset($_SESSION["contractor_password"])) { //////////////// if ($_SESSION["contractor_login"] == "Admin" ) { $result = mysql_query("SELECT *, SUM(client_pounds), AVG(client_pounds), SUM(user_payment_left), COUNT(client_id) FROM contractors, whiteboard, lead_providers WHERE contractors.user_username = '".$user_username."' AND whiteboard.user_username = contractors.user_username"); } else { $result = mysql_query("SELECT *, SUM(client_pounds), AVG(client_pounds), SUM(user_payment_left), COUNT(client_id) FROM contractors, whiteboard, lead_providers WHERE contractors.user_username = '".$access."' AND whiteboard.user_username = contractors.user_username"); } ?> <?php <form action="employee_update_script.php" method="post"> <?php echo "<span class=\"smallfont\">welcome: ".$_SESSION['contractor_login']. "</span>"; while($row = mysql_fetch_array( $result )) { ///things that appear and disappear if someone is or isn't an admin.... if ($_SESSION["contractor_login"] == "Admin" ) { $EID = "<tr><td width=\"30px\"> </td> <td width=\"100px\"><span class=\"smallfont\">EID</span></td> <td><span class=\"smallfont\">".$row["emp_id"]."</span></td> <td><input name=\"emp_id\" value=\"".$row["emp_id"]."\" type=\"text\" /></td></tr>"; $username = "<tr><td width=\"30px\"> </td> <td width=\"100px\"><span class=\"smallfont\">User</span></td> <td><span class=\"smallfont\">".$row["user_username"]."</span></td> <td><input name=\"user_username\" value=\"".$row["user_username"]."\" type=\"text\" /></td></tr>"; $commission = "<td width=\"100px\"><span class=\"smallfont\">Commission</span></td> <td><span class=\"smallfont\">".$row["user_commission_rate"]."</span></td> <td><select name=\"user_commission_rate\" id=\"user_commission_rate\"> <option value=\"".$row["user_commission_rate"]."\">Select One...</option> <option value=\".1\">10</option> <option value=\".12\">12</option> <option value=\".15\">15</option> </select></td></tr>"; $old_leads = $row["user_leads"]; $leads = "<tr><td width=\"30px\"> </td> <td width=\"100px\"><span class=\"smallfont\">Total Leads</span></td> <td><span class=\"smallfont\">".$row["user_leads"]." + </span></td> <td><input name=\"new_leads\" type=\"text\" /> <input name=\"old_leads\" value=\"$old_leads\" type=\"hidden\" /></td></tr>"; $admin ="<tr><td width=\"30px\"> </td> <td width=\"100px\"><span class=\"smallfont\">Admin Status</span></td> <td><span class=\"smallfont\">".$row["user_isadmin"]."</span></td> <td><select name=\"user_isadmin\" id=\"user_isadmin\"> <option value=\"$user_isadmin\">Select One...</option> <option value=\"yes\">Allow</option> <option value=\"no\">Disallow</option> </select></td></tr>"; } echo " <br /> <br /> <input type=\"hidden\" name=\"user_username\" value=\"$user_username\"></td> <table class=\"table\" cellpadding=\"3px\" cellspacing=\"0\">"; echo "<tr align=\"center\" bgcolor=\"#006666\" > <td align=\"center\" width=\"80px\"><span class=\"smallwhitefont\">Employee ID</span></td> <td align=\"center\" width=\"80px\"><span class=\"smallwhitefont\">Deals</span></td> <td align=\"center\" width=\"80px\"><span class=\"smallwhitefont\">Total £</span></td> <td align=\"center\" width=\"80px\"><span class=\"smallwhitefont\">Avg £</span></td> <td align=\"center\" width=\"80px\"><span class=\"smallwhitefont\">Balance</span></td></tr>"; echo "<tr><td align=\"center\"><span class=\"smallfont\">".$row["emp_id"]."</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["COUNT(client_id)"]."</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["SUM(client_pounds)"]."</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["AVG(client_pounds)"]."</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["SUM(user_payment_left)"]."</span></td></tr>"; echo "</table><br /> <table class=\"table\" cellpadding=\"3px\" cellspacing=\"0\"> <tr align=\"center\" bgcolor=\"#006666\" > <td align=\"center\" width=\"80px\"><span class=\"smallwhitefont\">Commission</span></td> <td align=\"center\" width=\"80px\"><span class=\"smallwhitefont\">Leads Given</span></td> <td align=\"center\" width=\"80px\"><span class=\"smallwhitefont\">Admin</span></td> <tr> <tr> <td align=\"center\"><span class=\"negativenum\">".$row["user_commission_rate"]."</span></td> <td align=\"center\"><span class=\"negativenum\">".$row["user_leads"]."</span></td> <td align=\"center\"><span class=\"negativenum\">".$row["user_isadmin"]."</span></td> </tr>"; echo "</table><br />"; echo "<table width =\"900px\"> <tr><td><hr></td></tr></table>"; echo "<span class=\"smallfont\">CHANGE EMPLOYEE INFO</span>"; echo "<table border=\"0px\" cellpadding=\"3px\" cellspacing=\"0\">"; echo "$EID"; echo "$username"; echo "<tr><td width=\"30px\"> </td>"; echo "<td width=\"100px\" colspan=\"2\"><span class=\"smallfont\">Password</span></td>"; echo "<td><input name=\"user_password\" type=\"password\" value=\"".$row["user_password"]."\" type=\"text\" /></td></tr>"; echo "<tr><td width=\"30px\"> </td>"; echo "<td width=\"100px\"><span class=\"smallfont\">First</span></td>"; echo "<td><span class=\"smallfont\">".$row["user_first"]."</span></td>"; echo "<td><input name=\"user_first\" value=\"".$row["user_first"]."\" type=\"text\" /></td></tr>"; echo "<tr><td width=\"30px\"> </td>"; echo "<td width=\"100px\"><span class=\"smallfont\">Last</span></td>"; echo "<td><span class=\"smallfont\">".$row["user_last"]."</span></td>"; echo "<td><input name=\"user_last\" value=\"".$row["user_last"]."\" type=\"text\" /></td></tr>"; echo "<tr><td width=\"30px\"> </td>"; echo "$commission"; echo "$leads"; echo"$admin"; }///end while echo "<tr><td width=\"30px\"> </td>"; echo "<td width=\"100px\"></td>"; echo "<td><span class=\"smallfont\"><input name=\"Submit\" type=\"submit\" value=\"Change\" /></span></td>"; echo "</table></form>"; ?> <?php } } else { echo"not logged in <a href=\"index.php\">login</a>"; } include "footer.php"; ?>
  5. a combination of each of these things helped.. thanks for being a second pair of eyes. when the hours get rolling, it's easy to miss the little things and get stuck for hours on end.. i do appreciate it...
  6. i'm seriously frustrated right now. I've been working on this project since last sunday, i've successfully related 4 different tables together to find all sorts of information, and ... i get stuck HERE? ok here's the problem... and its probably something so incredibly stupid... $user_password = $_POST['user_password']; $user_username = $_POST['user_username']; $emp_id = $_POST['emp_id']; $user_first = $_POST['user_first']; $user_last = $_POST['user_last']; $user_commission_rate = $_POST['user_commission_rate']; $user_leads = $_POST['user_leads']; $user_isadmin = $_POST['user_isadmin']; mysql_query(" UPDATE contractors SET emp_id ='".$emp_id."', user_first ='".$user_first."', user_last ='".$user_last."', user_password ='".$user_password."', user_leads ='".$user_leads."', user_commission_rate ='".$user_commission_rate."', user_isadmin ='".$user_isadmin."; WHERE user_username = '".$user_username."' "); ---- $user_commission_rate and $user_isadmin are both formed from drop menus on a separate page... the commission rate one works.... the user is admin one does not work. can anyone shed light into this ?????????????????? $user_isadmin = $row["user_isadmin"]; echo "<tr><td width=\"30px\"> </td>"; echo "<td width=\"100px\"><span class=\"smallfont\">Admin Status</span></td>"; echo "<td><span class=\"smallfont\">$user_isadmin</span></td>"; echo "<td><select name=\"user_isadmin\" id=\"user_isadmin\"> <option value=\"$user_isadmin\">Select One...</option> <option value=\"1\">Allow</option> <option value=\"2\">Disallow</option> </select></td></tr>"; ------------------ echo "<tr><td width=\"30px\"> </td>"; echo "<td width=\"100px\"><span class=\"smallfont\">Commission</span></td>"; echo "<td><span class=\"smallfont\">".$row["user_commission_rate"]."</span></td>"; echo "<td><select name=\"user_commission_rate\" id=\"user_commission_rate\"> <option value=\"".$row["user_commission_rate"]."\">Select One...</option> <option value=\".1\">10</option> <option value=\".12\">12</option> <option value=\".15\">15</option> </select></td></tr>"; thanks in advance!!!!!!!!!!!!
  7. I figured out how to make what you said work.. you were right on... i may run into a problem if i have to do more than one sum though..... thanks
  8. ok, this is going to be kind of hard to explain, but any and all help is appreciated. Basically here's what i have. in my DB there is a table called "contractors" which is basically a list of employees and their info. also, i have a table called "whiteboard" which means something in my business. whiteboard is clients info. my employees work from home. whenever they close a deal, they enter certain into into this site. it knows who they are because they are logged in. when they put the info for the client in, it puts it in the whiteboard table with a reference to who "owns" that deal. ("user_username" field). once that is submitted, it re-directs them to a page that lists out all of their sales (clients) and tells them how much commission is coming to them and various other things they need to know. as an admin, i go in there and change things in the client's info as needed like.... if the employee has been paid for that one client. it does a lot of other calculations automatically when i alter certain things. well, i have all of this information, and want to make various admin statistic pages. now i'm getting to my point. the client record has who owns it, how much money they are paying us, the commission amount that the employee is getting for that deal, whether it's been drafted by our bank or not, the amount due etc. that info is NOT in the employee's record itself.. so what needs to happen typically is that it will do a search saying Select all from client where user_username = (whoever is logged in) and it displays info accordingly.. so.... my point.... I am building another page for myself as an admin.. it shows a list of all of the employees and builds a table. In this table, i want it to show several things, but.. for all intents and purposes, we'll say i want it to show the total commission due.. basically what it needs to do (i think) is do a for loop where it starts to build a table displaying all of the users... and while it's building a row for a user (lets say User X) while it's on user X, go and pull all of user X's client records from the other table,and then do the math and make a solid number and then insert that number into the appropriate field, then repeat process for the next.. that seems logical... here's the problem i had. Apparently, you can't do nested While loops....... So, i did a join instead, but what happens is it shows user commission X 20 Y 30 X 50 X 40 Y 20 etc.... i need it to show X 110 Y 50 so...... to support this long explanation, i have provided my code... PLEEEEEEEASSEEEEEE help for the record, the code below doesn't have any of the calculations etc, because i can't seem to TAME the information.... it runs wild this is the output of said file (at least the important parts).... todd 450 admin 0 todd 1012.5 admin 0 how the hell do i combine those numbers? ######################################### <?php include "head.php"; include "menu.php"; $_SESSION["contractor_login"] = $contractor_login; // store session data $_SESSION["contractor_password"] = $contractor_password; // store session data $checkusername = mysql_query("SELECT * FROM contractors WHERE user_username = '".$contractor_login."'"); $checkpassword = mysql_query("SELECT * FROM contractors WHERE user_password = '".$contractor_password."'"); ///// check if the user is admin.. if not, don't let them in $result1 = mysql_query("SELECT * FROM contractors WHERE user_username = '".$contractor_login."' AND user_password = '".$contractor_password."' "); while($r=mysql_fetch_array($result1)) { $admin_check=$r["user_isadmin"]; }//end while if ($admin_check == "yes") { ////// now the fun stuff echo "<span class=\"smallfont\">welcome: ".$_SESSION["contractor_login"]."</span>"; ?> <table width="1000px" border="0px" > <tr> <td> </td> </tr> </table> <? echo "<table class=\"table\" cellpadding=\"3px\" cellspacing=\"0\"> <tr bgcolor=\"#006666\"> <td align=\"center\"><span class=\"smallwhitefont\">Update</span></td> <td align=\"center\"><span class=\"smallwhitefont\">User</span></td> <td align=\"center\"><span class=\"smallwhitefont\">Emp ID</span></td> <td align=\"center\"><span class=\"smallwhitefont\">First Name</span></td> <td align=\"center\"><span class=\"smallwhitefont\">Last Name</span></td> <td align=\"center\"><span class=\"smallwhitefont\">Rate</span></td> <td align=\"center\"><span class=\"smallwhitefont\">Pounds</span></td> <td align=\"center\"><span class=\"smallwhitefont\">Balance</span></td> <td align=\"center\"><span class=\"smallwhitefont\">Leads</span></td> <td align=\"center\"><span class=\"smallwhitefont\">Avg &#163</span></td> <td align=\"center\"><span class=\"smallwhitefont\">CPC</span></td> <td align=\"center\"><span class=\"smallwhitefont\">adm</span></td> </tr>"; /* this WORKS, but doesn't do what i want it to do... $result5 = mysql_query("SELECT * FROM whiteboard"); while($row = mysql_fetch_array( $result5 )) { $ass = $row["user_payout_status"]; //figure out who is who } */ ///////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $query = "SELECT * ". "FROM contractors, whiteboard ". "WHERE contractors.user_username = whiteboard.user_username"; $result = mysql_query($query) or die(mysql_error()); // for later use maybe $result = mysql_query("SELECT * FROM contractors ORDER BY user_last DESC"); while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr> <td align=\"center\"> <form method=\"post\" action=\"client_update.php\"> <input type=\"hidden\" name=\"client_id\" value=\"".$row["user_uid"]."\"/> <input name=\"update\" type=\"image\" src=\"images/update.jpg\" /> </form>"; echo "</td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["user_username"]; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["emp_id"]; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["user_first"]; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["user_last"]; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["user_commission_rate"]; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">(pounds) calcneeded"; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">" .$row["user_commission"]."<"; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["user_leads"]; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\"> avg"; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\"> cpc"; echo "</span></td>"; echo "<td align=\"center\"><span class=\"smallfont\">".$row["user_isadmin"]; echo "</span></td>"; echo "</tr>"; } echo"</table>"; } else { echo"<span class=\"smallfont\">You do not have access to this page.</span>"; } include"footer.php"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.