PHP - Help With Script To Send Now Playing Data To Tunein Api
Hey there,
I gotta say I am new to this forum and new to PHP. I found a script online that sends NOW PLAYING data, from a text file, to a shout cast server. We're not using shout cast and I need to modify this script to make it work with TuneIn AIR API. The script is based on this server URL: Quote http://myusername:pass@192.168.1.22:8543/admin/metadata?mount=/live&mode=updinfo&song=somesongandartist Though TuneIn uses a different URL and API Quote GET http://air.radiotime.com/Playing.ashx?partnerId=<id>&partnerKey=<key>&id=<stationid>&title=Bad+Romance&artist=Lady+Gaga I currently don't have the PartnerID and PartnerKey but that should be easy to replace in the script. I'm calling everyone on this forum to help me out with this and change the code to make this script work. I would appreciate it very much!! I'm a radio guy and not not a coder. Thats why I ask for this big favor. Thank you very much. WPBK FM Similar TutorialsThe top half of this code works great ( where the HR line across ) now I'm trying to get it to post the some of the same data to another process script. I keep getting errors. can some please tell me what I'm doing wrong or missing. <?php function dataPost($fieldValue){ //extract data from the post extract($_POST); //set POST variables $url = 'http://www.domain.com/processform1.phpp'; $fields = array( 'how_you_heard_about_us'=>$how_you_heard_about_us, 'how_you_heard_about_us_other'=>$how_you_heard_about_us_other, 'chk_atm_machines'=>$chk_atm_machines, 'custom1'=>$custom1, 'txt_business_adrss'=>$txt_business_adrss, 'txt_city'=>$txt_city, 'txt_state'=>$txt_state, 'txt_zip'=>$txt_zip, 'txt_country'=>$txt_country, 'txt_phone'=>$txt_phone, 'txt_fax'=>$txt_fax, 'txt_website'=>$txt_website, 'firstname'=>$firstname, ); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); from here down I'm not to sure with..... //create array of data to be posted $post_data['firstname'] = 'firstname'; $post_data['custom1'] = 'custom1'; $post_data['txt_state'] = 'txt_state'; //traverse array and prepare data for posting (key1=value1) foreach ( $post_data as $key => $value) { $post_items[] = $key . '=' . $value; } //create the final string to be posted using implode() $post_string = implode ('&', $post_items); //create cURL connection $curl_connection = curl_init('http://www.domain.com/processform2.php'); //set options curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); //set data to be posted curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); //perform our request $result = curl_exec($curl_connection); //show information regarding the request print_r(curl_getinfo($curl_connection)); echo curl_errno($curl_connection) . '-' . curl_error($curl_connection); //close the connection curl_close($curl_connection); } dataPost('Some Data'); ?> Here's the code that deals with the client side:
<?php session_start(); if(!isset($_SESSION['Logged_in'])){ header("Location: /page.php?page=login"); } ?> <!DOCTYPE Html> <html> <head> <!--Connections made and head included--> <?php require_once("../INC/head.php"); ?> <?php require_once("../Scripts/DB/connect.php"); ?> <!--Asynchronously Return User Names--> <script> $(document).ready(function(){ function search(){ var textboxvalue = $('input[name=search]').val(); $.ajax( { type: "GET", url: 'search.php', data: {Search: textboxvalue}, success: function(result) { $("#results").html(result); } }); }; </script> </head> <body> <div id="header-wrapper"> <?php include_once("../INC/nav2.php"); ?> </div> <div id="content"> <h1 style="color: red; text-align: center;">Member Directory</h1> <form onsubmit="search()"> <label for="search">Search for User:</label> <input type="text" size="70px" id="search" name="search"> </form> <a href="index.php?do=">Show All Users</a>|<a href="index.php?do=ONLINE">Show All Online Users</a> <div id="results"> <!--Results will be returned HERE!--> </div>search.php <?php //testing if data is sent ok echo "<h1>Hello</h1><br>" . $_GET['search']; ?>This is the link I get after sending foo. http://www.family-li...php?&search=foo Is that mean it was sent, but I'm not processing it correctly? I'm new to the whole AJAX thing. ..and its not working (i replaced <textarea> with <div> to apply some html tags inside it ) and this is my form : Code: [Select] <form action="proc.php" method="post"> <div id="text" name="question_text" class="text" contenteditable="true"></div> </form> but when i submit some text the $_POST['question_text'] is not set ! Hey, I'm trying to send a form input to a page, and then get the response (as in, the body) from that page without leaving my PHP script. So instead of when you normally submit a form and it will take you to the 'action="/somepage"'. I want it to get that information and bring it back to the original page. No navigation should happen. I'm almost certain this is possible, but the only thing I've found at the moment requires a custom addon - which, isn't on most hosting sites. Sorry if I haven't described this very well, but any help would be appreciated Thanks tree How to send multipart/form-data ? via curl or so ... here i am going to send it - http://dezend.me/dezend/ I needed a server side PHP validation script for my form to use on top of client side Javascript as a backup. I found a nice package where I just include the validator and set a few options then it does the rest. However it doesn't seem to work with the action="whateveraction.php" for the form. It will skip all the validation and immediately go to the action script. So I left that blank as you can see in the form below and figured I would send the post data somehow to the script using PHP when the validation is successful. However I am stumped on how to do that can I get some coding help? This is the small validation script. I will attach the formvalidator.php in this post. Code: [Select] <?php require_once "formvalidator.php"; if(isset($_POST['submit'])) { $validator = new FormValidator(); $validator->addValidation("age","req","Please fill in your Age"); $validator->addValidation("mcid","req","Please fill in your Minecraft Username"); $validator->addValidation("description","req","Please fill in a Description"); if($validator->ValidateForm()) { //need something here to have it send the post data to /mcbuildapp/form_submit.php } else { echo "<div class=blockrow><b><font size=5>Form Errors:</font><b></div>"; $error_hash = $validator->GetErrors(); foreach($error_hash as $inpname => $inp_err) { echo "<div class=blockrow><p><font color=red>$inp_err</font></p>\n</div>"; } } } Then the form if it matters.... Code: [Select] <div class="blockrow"> <font size=4><b>Minecraft Building Rights Application</b></font> <br /> <br /> <b>Failing to fill in any of these fields sufficiently will result in an automatic denial of your application!</b><br /> <b>Think of it this way, being lazy and applying wrong is only wasting your time. Take the time to do it correctly the first time.</b> <br /> <br /> <b><font color=red>To ensure proper user authentication and security you must first join the server at least once before applying for your building rights to work!</font></b> <br /> <br /> <form action="" id="mcbuilderapp" name="mcbuilderapp" method="post"> <label><b>Your Minecraft Username (required)</b><br /> Use exact capitalization and punctuation that matches your Minecraft.net account!</label> <br /> <br /> <input type="text" name="mcid" id="mcid" maxlength="25"/> <br /> <br /> <label><b>Your Age (required)</b></label> <br /> <br /> <input type="text" name="age" id="age" maxlength="3"/> <br /> <br /> <label><b>Describe Yourself (required)</b><br /> Describe yourself in <b>no less</b> than 3 sentences using <b>correct grammar</b>.</label> <br /> <br /> <textarea name="description" id="description" minlength="10" maxlength="1000" cols=60 rows=5 wrap="physical"> </textarea> <br /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </div> MOD EDIT: PHP manual tags changed to code tags . . . [attachment deleted by admin] Hello, i want to send and receive data from https url. how it can be done in php? Thanks Hello everyone, I am trying to submit a comment in a comment box and send it to the DB but is not happening. The connection is good as I am logging in and all but no data is sent to the DB when I post the comment. It doesn't show in my comment section either.
Form <!--comment section--> <?php if(isset($_SESSION['id'])) { echo "<form method='POST' action='" . setComments($conn) . "'> <input type='hidden' name='uidUsers' value='".$_SESSION['id']."'> <input type='hidden' name='posted' value='" . date('Y-m-d H:i:s') . "'> Comments: <textarea rows = '5' cols = '15' name='body'></textarea><br><br> <button name='commentSubmit' type='submit'>Comment</button> </form>"; }else { echo "Log in to comment!"; } getComments($conn);
Function to set and get comments function setComments($conn) { if (isset($_POST['commentSubmit'])){ $user_id = $_POST['uidUsers']; $body = $_POST['body']; $posted = $_POST['posted']; $sql = "INSERT INTO comments (uidUsers, posted, body) VALUES ('$user_id', '$posted', '$body')"; $result = mysqli_query($conn, $sql); } } function getComments($conn) { $sql = "SELECT * FROM comments"; $result = mysqli_query($conn, $sql); while ($row = $result->fetch_assoc()){ $id = $row['uidUsers']; $sql2 ="SELECT * FROM users WHERE uidUsers='$id'"; $result2 = mysqli_query($conn, $sql2); if($row2 = $result2->fetch_assoc()){ echo "<div class='comment-box'><p>"; echo $row2['uidUsers'] . "<br>"; echo $row['posted'] . "<br>"; echo nl2br($row['body']); echo "</p></div>"; } } }
I am successfully doing this, however, I believe I am doing it wrong. I am currently doing the following. How should I be doing this? My thought is getObject.php should return JSON, not JavaScript, but I don't know how to assign the received JSON to the myObj variable. Thanks I am retrieving Google Books info in JSON format and displaying it inside a div. I would like to send the contents of this div (name, title, description) to my database using Ajax.
Currently only the ISBN field sends because I have it declared as a variable. However my question is, how do I send the other fields (name, title, author). How do I declare these also, I'm not sure what format they need to be in etc.
My JS
$(document).ready(function() { $('#submit').click(function(ev) { ev.preventDefault(); var isbn = $('#isbn_search').val(); //get isbn direct from input var url='https://www.googleapis.com/books/v1/volumes?q='+isbn; $.getJSON(url,function(data){ $.each(data.items, function(entryIndex, entry){ var html = '<div class="results well">'; html += '<h3>' + entry.volumeInfo.title + '</h3>'; html += '<div class="author">' + entry.volumeInfo.authors + '</div>'; html += '<div class="description">' + entry.volumeInfo.description + '</div>'; }); }); }); });My Ajax; $.ajax({ type: 'POST', url: 'addIsbnScript.php', data: { 'isbn' : isbn, 'title' : title 'subtitle' : subtitle, 'authors' : authors, 'description' : description }, success: function () { $.growl({ message: " Record added" }); } });Note, if i manually set the vars like below they all do successfully send to my database, so I know my query is working ok var title = "some text", var author = "some text", Var description = "some text"Thanks in advance for any help, newbie here (incase it wasn't obvious!). J Quick question for you guys. I am collecting payment data for a product. Is it possible to send data from my form via http directly into another payment form via the post http headers? So say if i had all the details payment info and address info and i matched my form exactly to theirs. Is it possible to write a php script to send the data from my form directly to another websites form to make an order, say amazon or a big site like this? ?first_name=samuel&last_name=east&action=Submit Any Help? Thanks Hi there, hope u guys able to help. I'm have created a enquiry form where I want these actions to run when a button is submitted: 1. Insert data from form fields into my database 2. When data is inserted into database, then send an e-mail (multiple email user) to the address with the form fields. The e-mail is carrying the form fields. so ...what I need now is how to send the form field to email. Insert the data into my table in my database,then send en e-mail. Code: [Select] <? // Connects to your Database mysql_connect("xxxxxx","xxxxxx","xxxxxx") or die(mysql_error()); mysql_select_db("xxxxxx") or die(mysql_error()); // now we insert it into the database $insert = "INSERT INTO enquiry (name, email, cont_number, subject, msg) VALUES ('".$_POST['name']."', '".$_POST['email']."', '".$_POST['cont_number']."', '".$_POST['subject']."','".$_POST['msg']."')"; $add_member = mysql_query($insert); ?> <?php function error_bool($error, $field) { if($error[$field]) { print("<td style=color:red>"); } else { print("<td>"); } } function show_form() { global $HTTP_POST_VARS, $print_again, $error; ?> <h2 align="center"> Enquiry Form</h2> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table align="center" cellpadding="3"> <tr> <?php error_bool($error, "name"); ?> Name </td> <td>:<input name="name" type="text" id="name" SIZE="33" value="<? echo $_POST["name"]; ?>"></td> </tr> <tr> <?php error_bool($error, "email"); ?> Email </td> <td>:<input name="email" type="text" id="email" SIZE="33" value="<? echo $_POST["email"]; ?>"></td> </tr> <tr><td>Contact No. </td><td> :<input type="text" name="cont_number" SIZE="33" maxlength="10"> </td></tr> <tr><td>Subject </td><td> :<input type="text" name="subject" SIZE="33" maxlength="25"> </td></tr> <tr><td>Your Message :</td><td> <textarea name="msg" cols="27" rows="5" wrap="virtual"></textarea> </td></tr> <tr> <td><th colspan=4 align="right"> <input type="reset" value="CLEAR"><input type="submit" name="Submit" value="Submit"></td> </th><td> </td> </tr> </table> </form> <? } if(isset($_POST["Submit"])) { check_form(); } else { show_form(); } function check_email_address($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } function check_form() { global $HTTP_POST_VARS, $error, $print_again; $error['name'] = false; if($_POST["name"]=="") { $error['name'] = true; $print_again = true; $message="The name field is empty<br>"; } if(!check_email_address($_POST['email'])) { $error['email'] = true; $print_again = true; $message.="Either Field Empty or Invalid Email ID <br>"; } if($print_again) { show_form(); } else { show_form(); $message="Thank You !! <br> Form has been submitted"; } echo "$message"; } ?> </body> </html> How do i do this? Thank you in advanced and sorry for bad English. Best regards, Desmond hello, I was wondering if it is possible to get all the data sent by a html form via post/get method and use it somehow. it is difficult to explain what i mean, i don't mean to say how to get data normally i.e.. by using variables for example $data = $_POST['data']; that can only get only one field that is "data". The reason i am looking for this is because i have many forms that will have to use the mail() function, the problem is creating variables for each from then use the mail() function to send it will be time consuming. and the fields are different in different forms. I have noticed the similar technology used by mailmyform . com, they capture the data in any html form posted to their php page and mail it to the given email. I'm sure this is a simple question, and I'm not a total newbie, but I keep drawing a blank. In accordance with existing specifications, a client has created a PHP page on their web server which responds to a query by returning a small block of XML. I need to use that XML, and I have no problem doing that using XMLReader->open(clientURL). I can call the client's PHP page and get XML back that I can parse and everything is wonderful. Except for one thing: I need to send a product ID when I call the client's PHP page, and I need to send it using the POST method. I guess that means my clean and neat one-step process is going to have to become a two-step process, and I'm going to have to use some other means besides XMLReader->open() to retrieve the XML. Can sombody recommend the best way to do this? I need to send POST data first to get the correct XML response, and then I need to capture the XML in a way that allows me to parse it. All good with sending single dimensional form data to the server using application/x-www-form-urlencoded, and having PHP convert it into an array. Also, good with sending simple arrays using []. But then I find myself needing to send a deeper object to the server . For example, I have a form with three text inputs simpleFormName 1, 2, and 3 plus some deeper object. Array ( [simpleFormName1] => bla [simpleFormName2] => bla [simpleFormName3] => bla [deeperObject] => Array ( [0] => Array ( [prop1] => bla [prop2] => true [data] => Array ( [0] => Array ( [p1] => 321 [p2] => 123 ) [1] => Array ( [p1] => 121 [p2] => 423 ) [2] => Array ( [p1] => 221 [p2] => 133 ) ) ) [1] => Array ( [prop1] => blabla [prop2] => false [data] => Array ( [0] => Array ( [p1] => 222 [p2] => 443 ) [1] => Array ( [p1] => 321 [p2] => 213 ) [2] => Array ( [p1] => 111 [p2] => 421 ) ) ) ) )
I see at least four options: Come up with naming structure which "flattens" the data. I have used this approach in the past, but it quickly becomes difficult to manage and I don't want to do so. Not use PHP's POST and and instead use Content-Type: application/json and file_get_contents(php://input) and json_decode the entire request server side. Use PHP's POST and urlencoding but make deeperObject a string using JSON.stringify and json_decode this one field server side. Urlencode the entire object.simpleFormName1=bla&simpleFormName2=bla&simpleFormName3=bla&deeperObject%5B0%5D%5Bprop1%5D=bla&deeperObject%5B0%5D%5Bprop2%5D=true&deeperObject%5B0%5D%5Bdata%5D%5B0%5D%5Bp1%5D=321&deeperObject%5B0%5D%5Bdata%5D%5B0%5D%5Bp2%5D=123&deeperObject%5B0%5D%5Bdata%5D%5B1%5D%5Bp1%5D=121&deeperObject%5B0%5D%5Bdata%5D%5B1%5D%5Bp2%5D=423&deeperObject%5B0%5D%5Bdata%5D%5B2%5D%5Bp1%5D=221&deeperObject%5B0%5D%5Bdata%5D%5B2%5D%5Bp2%5D=133&deeperObject%5B1%5D%5Bprop1%5D=blabla&deeperObject%5B1%5D%5Bprop2%5D=false&deeperObject%5B1%5D%5Bdata%5D%5B0%5D%5Bp1%5D=222&deeperObject%5B1%5D%5Bdata%5D%5B0%5D%5Bp2%5D=443&deeperObject%5B1%5D%5Bdata%5D%5B1%5D%5Bp1%5D=321&deeperObject%5B1%5D%5Bdata%5D%5B1%5D%5Bp2%5D=213&deeperObject%5B1%5D%5Bdata%5D%5B2%5D%5Bp1%5D=111&deeperObject%5B1%5D%5Bdata%5D%5B2%5D%5Bp2%5D=421 Any recommendations how to best implement? If you recommend using urlencoding for simple forms, but some other approach for more complex data, what criteria do you use to transition from one approach to another? Thanks Hi, I am sending data from a form to a URL using $_GET but I would also like the user to be redirected to a thankyou page which is a different URL. Does anyone know if this is possible? Thanks, Hi All, I have a table (with an ID of example) that can be seen he http://tinyurl.com/cfla7wp The following script calls jeditable.js and makes the Telephone & Mobile columns editable. Once edited, the table shows the new value plus a * symbol. Code: [Select] <script type="text/javascript"> $(document).ready(function() { /* Init DataTables */ var oTable = $('#example').dataTable(); /* Apply the jEditable handlers to the table */ $('td:eq(4), td:eq(5)', oTable.fnGetNodes()).editable( 'update_table_tenants.php', { "callback": function( sValue, y ) { var aPos = oTable.fnGetPosition( this ); oTable.fnUpdate( sValue, aPos[0], aPos[1] ); }, "submitdata": function ( value, settings ) { return { "row_id": this.parentNode.getAttribute("1"), "column": oTable.fnGetPosition( this )[2] }; }, "height": "14px" } ); } ); </script> What I need to do however is add the value entered into my database, but I do not know how to do this. I believe I need to do something like: UPDATE my_table VALUE whatever column has been edited in the table WHERE tenID is the same as the row selected in the table i.e. if I update the MOBILE NUMBER of the person called BILL GATES it would find his tenID, update numMobile in the table called my_table All help appreciated Dave I have a new website which is using a php form send script for email enquiries. The old website was using a php script which worked fine but the new site has a problem with the script.
The builder of the site (who is currently on holidays and uncontactable) provided the form send script which sends a email to me notifying that someone has used the site to send an email but the email doesn't contain any information. I just get an email saying that an enquiry has been submitted through the site. No name, email or message.
Also the script doesn't send the person after they hit submit to the thank you for contacting us page it just provides a plain text message on a blank page. I have a thank you page set up but not sure what code needs to be used to send it to that page.
I am sure something like this is here somewhere but whilst I have a reasonably good knowledge of html I don't understand php at all and was wondering if someone could please help.
The script for the form send I have been given is
Hi guys, I am writing the php script to send the email. I have noticed when I picked up on my email, I can see that it have been covered with mailed-by: myservername.com. I want to hide it, but I can't find a way to get it resolve. Here's the code: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myusername'); define('DB_PASSWORD', 'mypass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $name = clean($_GET['name']); $email = clean($_GET['email']); $type = clean($_GET['type']); $comments = clean($_GET['comments']); if($name == ''){ $errmsg_arr[] = 'name are missing.'; $errflag = true; } elseif($email == ''){ $errmsg_arr[] = 'email are missing.'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $insert = array(); if(isset($_GET['name'])) { $insert[] = 'name = \'' . clean($_GET['name']) .'\''; } if(isset($_GET['email'])) { $insert[] = 'email = \'' . clean($_GET['email']) . '\''; } if(isset($_GET['type'])) { $insert[] = 'type = \'' . clean($_GET['type']) . '\''; } if(isset($_GET['comments'])) { $insert[] = 'comments = \'' . clean($_GET['comments']) . '\''; } if (count($insert)>0) { $names = implode(',',$insert); if(isset($email)){ $name = $_GET['name']; $email = $_GET['email']; $header = "From: $name <$email>". "\r\n"; $to = "myname@myemail.com"; $subject = $type; $message = "$comments & $rate"; $header .= "MIME-Version: 1.0\l\n"; $add = "<$email>"; mail($to, $subject, $message, $header, $add); echo "Thank you for sent us your email"; } } } ?> I guess that something got to do with this: if(isset($email)){ $header = "From: $name <$email>". "\r\n"; $header .= "MIME-Version: 1.0\l\n"; $add = "<$email>"; } I have disabled the safe-mode, so do you know how I can hide the mailed-by header using with the code on above?? Any advice would be much appreciate. Thanks in advance. Iwant to make a contact us script and here is done so far. I am almost sure its about preg match filters but cant find a solution why it doesnt work. Appreciate any help. Here is my code: $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email_from = $_POST['email']; $comments = $_POST['comments']; $emailtrue = '/^([A-Za-z0-9-_]+@[A-Za-z0-9-_]+\.[A-Za-z]{2,4})$/'; $nametrue = "/^[A-Za-z]+$/D"; if(!preg_match($nametrue,$first_name)) { echo "The First Name you entered does not appear to be valid."; die (); } if(!preg_match($nametrue,$last_name)) { echo "The Last Name you entered does not appear to be valid."; die (); } if(!preg_match($emailtrue,$email_from)) { echo "The Email Address you entered does not appear to be valid."; die (); } if(strlen($comments) < 4) { echo "The Comments you entered do not appear to be valid. Min. 4 letters." ; die (); } $to = xxxxxxxxxx.com'; $subject = 'User Email'; $headers = 'From: '.$email_from. "\r\n" . 'Reply-To: '.$email_from. "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $comments, $headers); |