PHP - Remote Xml Values To Php From Form Results?!
Sounds a bit long winded in the name so i'll explain...
I'm coding a site where the user inputs their vehicle reg, and submits the form. The site will then show their car's details. This is being done using an external service that provides an up to date database of vehicle details. So far, i've got the form and when you submit it, it returns the vehicle data in an XML, but the XML it displays is remote. I need to retrieve the details back to the website to display on the page. Here is what I have already: Code: [Select] <html> <head> <title>Reg Test Page</title> </head> <body> <form method="post" action="https://www.****.com/UAT/"> <input type="hidden" name="ESERIES_FORM_ID" value="B2INT"> <input type="hidden" name="MXIN_USERNAME" value="****"><br /> <input type="hidden" name="MXIN_PASSWORD" value="****"><br/> REG<input type="text" name="MXIN_VRM" value="REG NUM"><br /> <input type="hidden" name="MXIN_TRANSACTIONTYPE" value="03"><br /> <input type="hidden" name="MXIN_PAYMENTCOLLECTIONTYPE" value="02"><br /> <input type="hidden" name="MXIN_CAPCODE" value="1"><br /> <input type="submit" /> </form> </body> </html> I've ***'d out some details for obvious reason. The form currently works fine and returns a valid XML response, but it's remote. My original plan was to get the form to load up in another php file that processes the detail and sends a file_get_contents() request, but looking at the results page on the xml, there is no extension to the posted url and if you go directly to it, you get the error "METHOD NOT ALLOWED. ONLY 'POST' IS ALLOWED." The other issue I have is that i'm not sure how it's handling the request, and the url is not modified, so i'm not sure how i'd set an url with values to retrieve it? Any help is gratefully received. Cheers Guys. Similar TutorialsA couple months back, I asked on a gaming forum if anyone knew of a website that would track your *Steam Wishlist and email you when one of your wishlist games went on sale. No one at the time knew of a **solution, so I decided to buy "PHP, MySQL and Javascript" and try to roll my own. I managed to get the basics working. After the basics, I started thinking about fun stuff I could do with the data I collected from Steam regarding the games that go on sale regularly. The first part of my code file_get_content's the ***sale page(s) of games, and sucks out the games name, regular price, sale price, and the games homepage URL on Steam. This is enough to accomplish my basic task. The second part is where I need help, and that's getting more details on the game. The additional details I want to get about the game include its Publisher and Developer, and to get that detail I need to go to the games homepage URL I previously got from the global sale page. The issue is this: Some games have an age-restriction limitation, and you have to fill out a date form before entering the games homepage. An example of one of those pages would be: http://store.steampowered.com/agecheck/app/1250/ I want to be able to POST a legal age to the above URL, and then (this is where I'm hazy) "re-load" the same URL, authorized by my previous POST. Is that possible? * Steam is a digital download service for computer games. ** Subsequently, there was another website found. But I was well into developing my solution and having fun. *** Example: http://store.steampowered.com/search/?specials=1 Hello, is it possible to retrieve data from remote form, from another domain that I can't control. I want to type in number in my local form text field and then post it to remote form and retrieve data. I know how to retrieve data from local mysql, but don't know how to retrieve it from remote form. Remote form: http://www.otto.de/is-bin/INTERSHOP.enfinity/WFS/Otto-OttoDe-Site/de_DE/-/EUR/PV_DirectOrder-Start?ls=0#lmPromo=la,3,hk,home,fl,Sidebar_Bestellen Working number: 31477682 I want to type in 31477682 on my local text field and retrieve data(price, color, status like "lieferbar") from another domain. Hi there, I'm running a php based website and I'm getting a lot of remotely posts to the forms. Is any way to prevent this using php or .htacces. Any tip o a site from where I should start? Thank you in advance. Say I have a table called artists with these fields (artistid, rank).
Then say I have an array called $rankadjustments with a value for each artist (like 1, 7, 3,-3, 5, 9, etc).
I am doing a MYSQL query that gets the info from artists table and sorts according to the rank field like this...
$sql = "SELECT * FROM artists ORDER BY rank";Easy enough. But what if I would like to bring that data back sorted by (rank + rankadjustment). For example, if the artist ranked 1st had a rank of "1" from mysql, but had a rankadjustment of "5" from the rankadjustment array, his "true" rank would be "6". Again, rankadjustment is NOT a field in my table, otherwise it would obviously be simple. It's calculated on the fly and stored in an array. FYI, the array has an index with their "artistid". For example, $rankadjustment[341][8] would be the artist with an artistid of "341" has a rank adjustment of 8. Is there a way to do this IN the query itself? It doesn't seem possible but wanted to find out for sure. If not, what is best way to do? I assume... Get the data sorted JUST by rank and put it all into an array, then create a new array that adds rank to rankadjustment and reorder by the "new" rank amount? I guess that wouldn't be too bad but again, wanted to make sure I'm not missing something that would allow me to do it all in the query (or just more efficiently). Thanks! Edited by galvin, 21 December 2014 - 09:13 PM. I have a html form that submits to another website. Everything works fine in firefox and chrome however the data is duplicated in IE. Is there some quirk in IE when submitting a form to a different website? Hi, I have search form which works apart from 1 part, I have set the results limit to 10 per page with a next link if there are more than 10 results, however when the next link is clicked, i get the error 'you do not have a search parameter' which comes from this code: Code: [Select] if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } The next link is defined by the code below: Code: [Select] // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } Can anyone see where I have gone wrong with this code without me sending the whole search form? Any help would be very much appreciated. Thanks I have a simple form which sends results (using php) to my email. It works fine. I want to make a similar form, and send the results not to email but to another web page, showing a summary of the form results, so user can check if all is entered correctly before continuing. Can anyone advise if this is possible and how. I am a real php beginner ... EDIT: sorry - new to posting guidelines - using XAMPP with mysql 5.1.44 (I think this is correct!!) Newbie question he I have successfully created a form that that displays students (based on a selected lesson/group/date) with the ability to enter scores. I'm now trying to set the form up so that if data already exists then it is displayed in the form. Eg: if a member of staff choses group 7AS, lesson 1, 24/09/2010 and another member of staff has entered a score already for one student it shows up in the <select> drop down by using Code: [Select] <option>" . $scorevalue . "</option> I had this working at one point but have made a change somewhere and cannot get it working again! can anyone spot an obvious mistake I am making? The code I am using is as follows: Code: [Select] <input type="hidden" name="tutor" value="<?php echo $_GET["tutor"]; ?>" /> <input type="hidden" name="date" value="<?php echo $_GET["date"]; ?>" /> <input type="hidden" name="lesson" value="<?php echo $_GET["lesson"]; ?>" /> <?php error_reporting(-1); $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("lakeside", $con); $result = mysql_query("SELECT students.admin, students.fname, students.surname, students.tutor FROM students WHERE tutor='$_GET[tutor]' ORDER BY students.tutor, students.surname"); echo "<table class='scores'> <tr> <th>Admin</th> <th>Firstname</th> <th>Surname</th> <th>Tutor</th> <th>Score</th> <th>Code</th> <th>Comment</th> </tr>"; while($row = mysql_fetch_array($result)) { $sqlstatement = "SELECT * FROM scores where admin = '" . $row['admin'] . "' and lesson = '" . $_GET[lesson] . "' and date = '" . $_GET[date] . "' "; $scorevalue = mysql_query($sqlstatement); echo " . $score . "; while($rowvalue = mysql_fetch_array($scorevalue)) { $score = $rowvalue['score']; $comment = $rowvalue['comment']; $code = $rowvalue['code']; } echo "<tr>"; echo "<td>" . $row['admin'] . "</td>"; echo "<td>" . $row['fname'] . "</td>"; echo "<td>" . $row['surname'] . "</td>"; echo "<td>" . $row['tutor'] . "</td>"; echo "<td><select name='score" . $row['admin'] . "' value='{$row['score']}' /> <option>" . $scorevalue . "</option> <option>0</option> <option>1</option> <option>2</option> <option>2.5</option> <option >3</option> <option>3.5</option> <option>4</option> </select> </td>"; Hi, I'm currently learning PHP through tutorials and I am working on a webpage that filters statistics (crime records) from an SQL table and filters them by an option of years that the user has picked from a dropdown box. $desiredyear = $_POST['year'] is the year picked from the drop down box on a different page. I did not encounter any problems simply displaying the entire table until I tried to filter the crimes by year. I keep getting this error message. Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in C:\RDEUsers\NET\400792\1.php on line 40 Here is the error line. Code: [Select] while($row = sqlsrv_fetch_array($results, SQLSRV_FETCH_ASSOC)) And here is my code so far Code: [Select] <?php $server = 'SQL2008'; $connectionInfo = array( "Database"=>"rde_400792"); $conn = sqlsrv_connect($server,$connectionInfo); $desiredyear = $_POST['year']; $describeQuery='select year, force, homicide from crime where year = $desiredyear '; $results = sqlsrv_query($conn, $describeQuery); echo '<table border="1" BORDERCOLOR=Black>'; echo '<tr><th bgcolor = "LightBlue">Year</th><th bgcolor = "LightBlue" >Force</th><th bgcolor = "LightBlue">Homicide</th></tr>'; while($row = sqlsrv_fetch_array($results, SQLSRV_FETCH_ASSOC)) { echo '<tr>'; echo '<td >' .$row['year'].'</td>'; echo '<td>' .$row['force'].'</td>'; echo '<td>' .$row['homicide'].'</td>'; echo '</tr>'; } echo '</table>'; sqlsrv_close($conn); Please can somebody help me fix this? It's driving me mad and I've exhausted my limited knowledge on the subject. I just don't understand what I'm doing wrong. Hi Guys. I have some code which displays the rows of a database table in a html table on my webpage: Code: [Select] <?php//to display image from source$dir = "360_covers";echo '<table>';echo '<tr><th>Title</th><th>Cover</th><th>comment</th></tr>';$result = mysql_query("SELECT * FROM xbox_games order by gametitle");while ($row = mysql_fetch_assoc($result)) { echo "<tr><td>{$row['gametitle']}</td><td><img src=\"$dir/{$row['cover']}\" width='38' height='38'></td><td>{$row['cover']}</td></tr>";}//close out tableecho '</table>';?> What i want to do now is add a form, possibly at the end of each row of the html table, which will allow a session user to update that record. Can anybody advise on the best way to do this?
Hello,
<?php I know the php is basic and not completed yet, but I am working on that. My next step I want the result to show on index.php when a form is submitted to calculator2.php. I just cant seem to get it. Please help! index.php Code: [Select] <div class="post"> <h2 class="title">Calculator</h2> <hr /> <form method="post" action="calculator2.php"> Fireplace Front Width: <input type="text" name="fw"> <br /> Fireplace Back Width: <input type="text" name="bw"> <br /> Fireplace Depth: <input type="text" name="fd"> <br /> <input type="submit" name="Submit" value="Submit"> </form> Pounds Of Glass Needed: <?php echo $res1; ?> </div> calculator2.php Code: [Select] <?php $frontwidth = $_POST['fw']; $backwidth = $_POST['bw']; $firedepth = $_POST['fd']; $x = $frontwidth + $backwidth+ $firedepth; $y = ($x / 3) * .6667; $res1 = $y *2; echo $res1; ?> This sounds like overkill, but is there any way I can take the results of an html form, and plug them into their respective cells on a excel spreadsheet? Thanks in advance! -Brad I have a Login page which i want to check if the user details (username, password and activation) are valid then redirect user dependent on his/her "accessLevel" (admin, member and none)
Admin will be directed to "index.php"
Member will be directed to "tasks.php"
and none will be redirected to "notActive.php"
here is my current code which half works;
<?php include ('connect.php'); if(isset($_POST['submit'])) { // Initialize a session: session_start(); // Define $username and $password $username=$_POST['username']; $password=$_POST['password']; // To protect MySQL injection $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $sql="SELECT * FROM ecmt_members WHERE username='$username' and password='$password' AND Activation IS NULL"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $username and $password, table row must be 1 row if($count==1){ // Register $username, $password and redirect to file "index.php" $role = mysql_fetch_array($result); $_SESSION['username']= $username; $_SESSION['password']= $password; //$_SESSION['role']= $role['accessLevel']; if($role['accessLevel'] == "admin"){ $_SESSION['adminuser']=$role['accessLevel']; header("location:index.php"); exit(); } elseif($role['accessLevel'] == "member"){ $_SESSION['user']=$role['accessLevel']; header("location:tasks.php"); exit(); } else { echo "Error: Username, Password or Access Level incorrect! Go Home, you're Drunk!!!"; } } } // End of the main Submit conditional. ?><!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>Login Form</title> <!-- jQUERY --> <script src="//code.jquery.com/jquery-latest.js"></script> <!-- Add Main CSS --> <link rel="stylesheet" type="text/css" href="../tool/css/main.css"> <!-- Font-Awesome --> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <style> body { background: url(../tool/images/bg1.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .exactCenter { width:auto; height:auto; position: fixed; top: 50%; left: 50%; margin-top: -200px; ; } </style> </head> <body> <div class="exactCenter"> <div id="login-container"> <img src="../tool/images/bigLogo.png" /><br /> <form action="login.php" method="post" class="form"> <fieldset class="group"> <input class="input" type="text" id="username" name="username" size="25" placeholder="username"/> <img src="../tool/images/spacer.png" width="5" height="5" /> <input class="input" type="password" id="password" name="password" size="25" placeholder="password"/> <img src="../tool/images/spacer.png" width="5" height="5" /> </fieldset> <input type="hidden" name="formsubmitted" value="TRUE" /> <button type="submit" name="submit" class="btn btn-blue" ><i class="fa fa-unlock-alt"></i> Login</button> <img src="../tool/images/spacer.png" width="5" height="5" /> <a href="Register.php"><button type="button" class="btn btn-green" ><i class="fa fa-hand-o-up"></i> Register</button></a> </form> </div></div> </body> </html>When i test it with admin login credentials i get the page refresh again without error, when i login with member credentials it shows tasks.php and when i try to log in with unactivated account "acivation column is not NULL" i get a page refresh also with no error. Can someone help me make it work for each role and perhaps have some sort of error reporting depending on error. im pulling my hair out here and this is the first time i have worked with login conditions, and im VERY confused. Edited by jacko_162, 28 October 2014 - 05:12 PM. I am looking for a high-level (but detailed) conceptual technique on making dynamic selection via a web page, where selection options are stored for later use in a database.
Scenario: I have various options for assembling a custom-made product. I can select demands that the product must satisfy via a form, and submit my selection to the server.
It then runs an algorithm to match my selections to the possible products that can be built to satisfy the demands. There can be anywhere from 0 (not possible to build product), to 1 to 200 various ways to build possible products that match my selection. I will call original user selection as "original selection" and the 200+ options as "options".
Right now there is an existing system in place which is a hideous mess of JSON, JS, HTML, and PHP. Maybe the technologies are the way to solve my problem, but the way it is solved now is hard to maintain. I don't know if there is a better way. Right now, all options are being pre-generated via PHP, and are encoded into JSON, then JSON is read by JS, which drives the dynamic selection of options. Then when an option is saved, entire list of options is saved along with it... Then, when we want to know which original selection was made, we read back all the options from the database and the index of the one we actually need. They are in JSON, we decode that, and then we have what we went. It sounds convoluted to me, and I would like to simplify it a lot, potentially rewriting it. How?
Basically I want this end-user scenario:
1. User makes selections via form, submit
2. User is presented with all options. Since there are a lot of options we want user to be able to navigate through them in real time. JS may be of value here, rather than doing new page loads, including AJAX page loads.
3. User saves their selection, and results from page are either displayed back to the user or are saved in DB.
I'm very new to this and really could use some help. I've got a Web app that has one form that collects data from the user and puts it into a mysql database and has another form that allows the user to select critiera to find records in the database and display them on the page. All this is working just fine, but now that my database is getting more data in it, I want to add functionality to display 10 records on a page with results page navigation links so the user can move forward and backward in the results set. This part is not working and I've put in echo statements to figure out what the code is doing. The problem I'm having is that when the selection critiera pulls more than 10 records from the database, the first page of results is correct per the selection criteria entered by the user on the select form. When the 'next' link is selected to review the second page of results, the query is executed again. But this time the form variables have been reset and the results now contains the entire contents of the db. The start record is set to look at the 11th instance of the results set, so the second page starts with the 11th record in the database instead of the 11th record in the original results set. The original select statement is built by determining which criteria is selected using $_POST against each form variable. How can I retain the form variables or the original select statement so the second execution of the select statement results in the same results set as the first? The other option that may be better is to retain the original results set and avoid re-executing the select statement altogether. But I don't know how to do that either. Any suggestions, code samples or adivice is much appreciated! Hi all, I am new to PHP and am trying to implement a window that opens when a user is trying to validate an organisation on our site. I have an initial page where users can enter data. One of the fields is organisations. This has a button to its right that lets the user search existing organisations in the mysql db. I have the search piece thanks to some code I found and altered. However, instead of a static non-linked list 1,2,3 coming back from the search, I need the search results to be links / or at least "select"-able. When the user chooses the organisation they were referring to that exists in the db I would like the selection to go back to the original php page and populate the organisation field. Ideally without having other data in the original form being lost. Any tips, hints or links would be greatly appreciated. Here is my code: <?php $dbHost = 'localhost'; $dbUser = 'root'; $dbPass = 'mypass'; $dbDatabase = 'mydb'; $con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); // Set up our error check and result check array $error = array(); $results = array(); // First check if a form was submitted. // Since this is a search we will use $_GET if (isset($_GET['search'])) { $searchTerms = trim($_GET['search']); $searchTerms = strip_tags($searchTerms); // remove any html/javascript. if (strlen($searchTerms) < 3) { $error[] = "Search terms must be longer than 3 characters."; }else { $searchTermDB = mysql_real_escape_string($searchTerms); // prevent sql injection. } // If there are no errors, lets get the search going. if (count($error) < 1) { $searchSQL = "SELECT Organisation_Name FROM vcaccount_contact_organisation WHERE "; // grab the search types. $types = array(); $types[] = isset($_GET['Organisation_Name'])?"`Organisation_Name` LIKE '%{$searchTermDB}%'":''; $types = array_filter($types, "removeEmpty"); // removes any item that was empty (not checked) if (count($types) < 1) $types[] = "`Organisation_Name` LIKE '%{$searchTermDB}%'"; // use the body as a default search if none are checked $andOr = isset($_GET['matchall'])?'AND':'OR'; $searchSQL .= implode(" {$andOr} ", $types) . " ORDER BY `Organisation_Name`"; // order by organisation. $searchResult = mysql_query($searchSQL) or trigger_error("There was an error.<br/>" . mysql_error() . "<br />SQL Was: {$searchSQL}"); if (mysql_num_rows($searchResult) < 1) { $error[] = "The search term provided {$searchTerms} yielded no results."; }else { $results = array(); // the result array $i = 1; while ($row = mysql_fetch_assoc($searchResult)) { $results[] = "{$i}: {$row['Organisation_Name']}<br /><br />"; $i++; } } } } function removeEmpty($var) { return (!empty($var)); } ?> <html> <title>My Simple Search Form</title> <style type="text/css"> #error { color: red; } </style> <body> <?php echo (count($error) > 0)?"The following had errors:<br /><span id=\"error\">" . implode("<br />", $error) . "</span><br /><br />":""; ?> <form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>" name="searchForm"> Organisation: <input type="text" name="search" value="<?php echo isset($searchTerms)?htmlspecialchars($searchTerms):''; ?>" /><br /> <input type="submit" name="submit" value="Search!" /> </form> <?php echo (count($results) > 0)?"Your search term: {$searchTerms} returned:<br /><br />" . implode("", $results):""; ?> </body> </html> When I click on the letter of the alphabet on my form page, it will bring up the results of my query. I got this part working. The next part is to be able to click on any of the populated results and have it autofill my form with organization, first name, last name, email address and phone number.
I know that I need to use Ajax and jQuery to accomplish this.
Here is my html
<!-- Letter Search --> <div class="searchBox span12"> <h3>Choose the First Letter of the Person's Last Name</h3> <ul> <li class="alphabets" id="A"><a href="?by=A">A</a></li> <li class="alphabets" id="B"><a href="?by=B">B</a></li> <li class="alphabets" id="C"><a href="?by=C">C</a></li> <li class="alphabets" id="D"><a href="?by=D">D</a></li> <li class="alphabets" id="E"><a href="?by=E">E</a></li> <li class="alphabets" id="F"><a href="?by=F">F</a></li> <li class="alphabets" id="G"><a href="?by=G">G</a></li> <li class="alphabets" id="H"><a href="?by=H">H</a></li> <li class="alphabets" id="I"><a href="?by=I">I</a></li> <li class="alphabets" id="J"><a href="?by=J">J</a></li> <li class="alphabets" id="K"><a href="?by=K">K</a></li> <li class="alphabets" id="L"><a href="?by=L">L</a></li> <li class="alphabets" id="M"><a href="?by=M">M</a></li> <li class="alphabets" id="N"><a href="?by=N">N</a></li> <li class="alphabets" id="O"><a href="?by=O">O</a></li> <li class="alphabets" id="P"><a href="?by=P">P</a></li> <li class="alphabets" id="Q"><a href="?by=Q">Q</a></li> <li class="alphabets" id="R"><a href="?by=R">R</a></li> <li class="alphabets" id="S"><a href="?by=S">S</a></li> <li class="alphabets" id="T"><a href="?by=T">T</a></li> <li class="alphabets" id="U"><a href="?by=U">U</a></li> <li class="alphabets" id="V"><a href="?by=V">V</a></li> <li class="alphabets" id="W"><a href="?by=W">W</a></li> <li class="alphabets" id="X"><a href="?by=X">X</a></li> <li class="alphabets" id="Y"><a href="?by=Y">Y</a></li> <li class="alphabets" id="Z"><a href="?by=Z">Z</a></li> </ul> <? include('search.php'); ?> </div> <hr style="color:#ccc; margin-bottom:20px;" /> <!-- Main Form --> <div id="mainForm"> <form method="post" id="icsForm" class="searchBox span12"> <div id="col1" class"span6"> <h3>Contact Information</h3> <label>Church / Organization:</label><input type="text" name="organization" id="organization" class="span6 upright" /><br /> <label>First Name:</label><input type="text" name="firstName" id="firstName" class="span6 upright" /> <label>Last Name:</label><input type="text" name="lastName" id="lastName" class="span6 left upright" /> <label>Email Address:</label><input type="text" name="email" id="email" class="span6 left upright" /> <label>Phone Number:</label><input type="text" name="phone" id="phone" class="span6 left upright" /> </div> </div>Here is my php if(preg_match("/^[A-Z | a-z]+/", $_POST['name'])){ $name=$_POST['name']; } if(isset($_GET['by'])){ $letter=$_GET['by']; //query to sort by last name $sql="SELECT contact_id, first_name, last_name, church_org, email_address, phone_number FROM ics_data WHERE last_name LIKE '$letter%' ORDER BY last_name ASC"; //run the query against the mysql query function $result=mysql_query($sql); //count results $numrows=mysql_num_rows($result); echo "<p>" .$numrows . " results found for " . $letter . "</p>"; //Create while loop and loop through result set while($row=mysql_fetch_array($result)){ $first_name=$row['first_name']; $last_name=$row['last_name']; $church_org=$row['church_org']; $email_address=$row['email_address']; $phone_number=$row['phone_number']; $contact_id=$row['contact_id']; //display the result of the array echo "<div id=\"search-results\">"; echo "<ul class=\"letter-results\">\n"; echo "<li class=\"result-row\">" . "<a href=\"#\" class=\"testclass\">" .$first_name . " " .$last_name . "". ", " ."" .$church_org ."</a></li>\n"; echo "</ul>"; echo "</div>"; } }Here is my Javascript file (Ajax) $(document).ready( function() { function formfill() { var organization = $('#organization').val(); var firstname = $('#firstname').val(); var lastname = $('#lastname').val(); var email = $('#email').val(); var phone = $('#phone').val(); $.ajax ({ method: "GET", url: "search.php", dataType: 'json', data: { organization:organization, firstname:firstname, lastname:lastname, email:email, phone:phone }, type: "POST", success: function(data) { $organization $firstname $lastname $email $phone }, failu function() { alert('fail!'); } }); }I know that I do not have a reference yet to JSON in my php file and that it is needed. I'm not solid on the Ajax part. That is the part that is tripping me up. I know that I need to make the form autofill when clicking on a specific result returned from my query... but i'm not sure how to do that. Thank you in advance for any help or advice you can give!! I am relatively new to programming. Hopefully I posted this in the right forum as a lot of these technologies overlap. Edited by kjetterman, 26 September 2014 - 10:23 AM. the form results are being sent to the selected email address in the array ... but I need a copy sent to the admin email address as well. before adding the array addresses ... the forms results were being sent to the admin, but after adding the array ... the admin address is out of the loop. How do I get the admin@home.com address to receive a copy of the forms results? I'm not sure if it needs to be a Bcc or what? Thanks in advance. _________________________________________________ _______________________________________ $to = $_POST["to"]; if(!in_array($to,array("ian@elsewhere.com","adam@elsewhere.com","keith@elsewhere.com","sue@elsewhere.com","mark@elsewhere.com","scott@elsewhere.com","joyce@elsewhere.com","joe@elsewhere.com","ken@elsewhere.com","info@elsewhere.com"))) $to = "admin@home.com"; $subject = "Order"; Hi,
Total PHP noob, obviously.
I want some form submission results to be in bold text. So I have:
$open = echo htmlentities("<strong>"); $close = echo htmlentities("</strong>"); $message .= 'Cushion Refilling Service: ' . $open . $_POST['cushion-refilling'] . $close . "\n\n";How should I be doing this? Thanks Richard |