PHP - Problem Sending Data From A Html Form To A Php File
So here is my code:
//form.html <form action="http://localhost/lab3/index.php" method="post " > <input type="text" name="numar" value=""><br> <input type="submit" name="submitButton" value="Submit"> </form> //and in index.php ,which is in the specified folder if I write : if($_POST['numar']!="") $m=$_POST['numar']; //then I get an error saying Undefined index: numar I really read a lot about forms and saw examples , but I can't figure out what's wrong. If you have any ideas.. Similar TutorialsOk, I have tried using the code from this link http://answers.yahoo.com/question/index?qid=20100927173625AAmEmiW Code: [Select] <?php // Get the name they entered in the form // We'll be naming the file this $file = $_POST['name']; // Get the email from the form $email = $_POST['email']; // We want the file to be a text file right? $ex = ".txt"; // Try to open a file named $file$ex (johndoe.txt for example) // Because this file doesn't exist yet the server creates it $write = fopen("$file$ex","w"); // Now open the file up again but this time save the email in it fwrite($write,$email); // MAKE SURE you close the file!!! fclose($write); // The folder that this script is in on the server is where the file we just made was saved // We can 'rename' it to another folder // The folder on the server we want to move it to $data = "../emails/"; // Now put it all together: This example goes out of the folder we're in and into the folder 'emails' // The new 'name' would be this now (../emails/johndoe.txt): So now the file is moved to where we want for storage rename ("$file","$data$file$ex"); // The script is done, send the user to another page (Just read the address below and you'll get it) exit; ?> unfortunately it doesn't do as i would like. I'm not sure how to get it to save a new file based on a variable on the form page or from one of the fields in the form. What i need is a way for a user to submit the form and it save the data into a uniquely named csv file. I know the code given is for text files, not csv, but that was about all i could find. If there is any help i would greatly appreciate it. Hello, Can someone help me with these contact-form please, I just want to include a file (.pdf, .jpg, .png) and send the mail.
For the moment, the mail is send but not with the file included.
Here is the website http://www.coeuraprendre.art
HTML CODE :
<form id="contact-form" class="checkform" action="#" target="contact-send.php" method="post" enctype="multipart/form-data" > <div class="form-row clearfix"> <label for="name" class="req">Nom *</label> <input type="text" name="name" class="name" id="name" value="" placeholder="Name" /> </div> <div class="form-row clearfix"> <label for="email" class="req">Email *</label> <input type="text" name="email" class="email" id="email" value="" placeholder="Email"/> </div> <div class="form-row clearfix textbox"> <label for="message" class="req">Nom du projet *</label> <textarea name="message" class="message" id="message" rows="15" cols="50" placeholder="Message"></textarea> </div> <div class="form-row clearfix"> <label for="pdf" class="req">Ajoutez votre dossier d'inscription (Pdf intéractif) *</label> <input type="file" id="pdf" class="pdf" name="pdf" placeholder="Pdf" accept="image/pdf"> </div> <div id="form-note"> <div class="alert alert-error"> <strong>Error</strong>: Please check your entries! </div> </div> <div class="form-row form-submit"> <input type="submit" name="submit_form" class="submit" value="Send" /> </div> <input type="hidden" name="subject" value="From Coeur à Prendre" /> <input type="hidden" name="fields" value="name,email,message," /> <input type="hidden" name="sendto" value="info@coeuraprendre.art" /> </form> </div> <!-- Contact form -->
PHP CODE :
<?php define("WEBMASTER_EMAIL", $_POST['sendto']); if (WEBMASTER_EMAIL == '' || WEBMASTER_EMAIL == 'Testemail') { die('<div class="alert alert-confirm"> <h6><strong>The recipient email is not correct</strong></h6></div>'); } define("EMAIL_SUBJECT", $_POST['subject']); if (EMAIL_SUBJECT == '' || EMAIL_SUBJECT == 'Subject') { define("EMAIL_SUBJECT",'Contact'); } $name = stripslashes($_POST['name']); $email = trim($_POST['email']); $message = stripslashes($_POST['message']); $pdf = stripslashes($_POST['pdf']); $custom = $_POST['fields']; $custom = substr($custom, 0, -1); $custom = explode(',', $custom); $message_addition = ''; foreach ($custom as $c) { if ($c !== 'name' && $c !== 'email' && $c !== 'message' && $c !== 'pdf' && $c !== 'subject') { $message_addition .= '<b>'.$c.'</b>: '.$_POST[$c].'<br />'; } } if ($message_addition !== '') { $message = $message.'<br /><br />'.$message_addition; } $message = '<html><body>'.nl2br($message)."</body></html>"; $mail = mail(WEBMASTER_EMAIL, EMAIL_SUBJECT, $message, "From: ".$name." <".$email.">\r\n" ."Reply-To: ".$email."\r\n" ."X-Mailer: PHP/" . phpversion() ."MIME-Version: 1.0\r\n" ."Content-Type: text/html; charset=utf-8"); if($mail) { echo ' <div class="alert alert-confirm"> <strong>Confirm</strong>: Your message has been sent. Thank you! </div> '; } else { echo ' <div class="alert alert-error"> <strong>Error</strong>: Your message has not been send! </div> '; } ?> Edited July 22 by cocolembo Hi, I'm new to PHP and have dabbled a little but need some help or someone to point me in the right direction if possible. I have an ajax web-form that sends the inputed data to a php file and then emails the results to the designated address (all working fine). However, what I am looking to do is have the php file (in addition to the current function) convert the data into XML and then attach the XML file to the email that is sent out. As mentioned I'm new to php and have a small amount of knowledge so any help on this would be very much appreciated. Cheers Basically what I am needing is when a visitor comes to my site and request info on a product, the form sends the product id or name.
I have the site set up like product.php?Item=26 and the item number changes based on the product. The page items are being populated with info stored in the mysql databse.
I need the email being sent to say something like
Visitors Name has requested info on Item 26 Name - Visitors Name Email - email@me.com Phone - 123-456-7890 Company - Visitors Company Item info requested for Here is the products name URL to product page Basically the "item info" is being pulled from the database. I have asked on different forums and I cannot get a good answer that I can use to make this happen. I might not be explaining it right. Page the form is on is (and all other new-product.php pages) http://www.packagingequipment4sale.com/new-product.php?Item=26Any help would be greatly appreciated Hi. I am writing a web app to control Zoom Player on my HTPC. I found that ZP supports listening on a TCP port to accept control commands. The docs say to quit ZP, send 5100,fnExit + ASCII 13/10 to port 4769. My original client was C# and I implemented it there, works great. I then realized WTF am I doing using an external .EXE to just send data to a TCP port? Switched to using PHP's fsockopen. Alas, that causes an error to pop up on ZP (List index out of bounds or some such). Perplexed, I wrote a GUI for the HTPC to just display an ASCII val breakdown of what it receives to compa So it looks like they both send the data the same. Any idea why the discrepancy? Here is the code: C# that works: Code: [Select] string cmdstr = ""; for (int x=2; x<=args.Length-1; x++) cmdstr += args[x] + " "; if (SendCommand(args[0], System.Convert.ToInt16(args[1]), cmdstr.Trim() + Environment.NewLine)) Console.WriteLine("Command string sent."); Environment.Exit(0); static bool SendCommand(string dest, int port, string cmd) { try { IPAddress[] ips = Dns.GetHostAddresses(dest); TcpClient client = new TcpClient(); IPEndPoint serverEndPoint = new IPEndPoint(ips[0], port); client.Connect(serverEndPoint); NetworkStream clientStream = client.GetStream(); ASCIIEncoding encoder = new ASCIIEncoding(); byte[] buffer = encoder.GetBytes(cmd); clientStream.Write(buffer, 0, buffer.Length); clientStream.Flush(); clientStream.Close(); clientStream.Dispose(); client.Close(); return true; } catch (Exception ex) { Console.WriteLine("Failed: " + ex.Message); return false; } } The PHP that is being difficult: Code: [Select] send_data("lioth", "4769", "5100,fnExit"); function send_data($host,$port,$data='') { $fp = fsockopen($host,$port); if($fp) { fputs($fp, "$data\r\n"); fclose($fp); } return; } Hi Friends, I did one contact.php and process.php(also i attached txt file). This process.php file send the data to my yahoo mail id. But i didnt receive any mails from this page. I dont know what i did the mistaken. so pls kindly send me you suggestion or feedback. waiting for your valuable suggestion. contact.php <!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>testing - Contact Page</title> </head> <body> <form name="contact" method="POST" action="process.php"> <table width="456" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="28" valign="top">Your name:</td> <td><input name="name" type="text"></td> </tr> <tr> <td height="28" valign="top">E-mail address:</td> <td><input name="email" type="text"></td> </tr> <tr> <td height="28" valign="top">Contact No:</td> <td><input name="contact" type="text"></td> </tr> <tr> <td height="28" valign="top">Message:</td> <td><input name="message" type="text" /></td> </tr> <tr> <td> </td> <td valign="top" align="center"><input type="submit" value="Submit" name="submit"></td> </tr> </table> </form> </body> </html> process.php <?php if(isset($_POST['submit'])) { $to = 'vjn_23@yahoo.co.in'; //put your email address on which you want to receive the information $subject = 'hello'; //set the subject of email. $headers = 'MIME-Version: 1.0' . "\r\n". 'Content-type: text/html; charset=utf-8' . "\r\n". 'From: vijay@telltales.in' . "\r\n" . 'Reply-To: vijay@telltales.in' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message = "<table><tr><td>Your Name</td><td>".$_POST['name']."</td></tr> <tr><td>E-Mail</td><td>".$_POST['email']."</td></tr> <tr><td>Contact No</td><td>".$_POST['contact']."</td></tr> <tr><td>Message</td><td>".$_POST['message']."</td> </tr></table>" ; mail($to, $subject, $message, $headers); header('Location: contact.php'); } ?> Thank U, vjn_23 I usually hate to post something like this as a first post...I'd like to at least do an into but I"m stumped and I think it's a totally stupid thing I"m not noticing. Anyway, this is the final step in a three step user verification; this is for a staff user to be verified. Anyway, by now they have already verified their email and entered a random code so I"m only worried about actually setting them to verified status in my database so they can start working on blogs etc. Anyway, this form is supposed to find all unverified staff members, and allow an admin to easily just click down the list (one at a time currently) and verify the user (ie. setting their database status to verified_staffUser). The username that is supposed to be verified (or declined and therefore their entry deleted) is supposed to be passed through as $_POST[vnsupUsername]. This is set each time it loops through and prints a new user. The problem is that it's only sending the final username when I click verify/decline on any user :\. I"m not sure why it's doing this. In firebug on firefox it's showing that the user name is set for each one to be properly in the form...but when I click on it (I am having on my machine) the username being worked with echoed..and it's always the last one that was entered into the database. I have no idea why this is happening ..any thoughts? Code: [Select] <?php if(isset($_GET[vnsufac]) || isset($_POST[svnsu]) || isset($_POST[dvnsu])){ // simply prints the back home button echo "<form action=\"http://localhost/~atharp1122/OGirly_Site/ogirly_staff_homepage.php\" method=\"post\">" ."<input type=\"submit\" value=\"Back to Staff Homepage\" style=\"margin-top:10px;\">"; // this will print out the form to verify/deny all new staff user requests that have been email verified $programCheckUVStaff = mysql_query("SELECT username, email, firstname, lastname FROM staffUNAP where verified_staff = '0'"); while($UVStaff = mysql_fetch_assoc($programCheckUVStaff)){ print "<div class=\"newVerifyUserContain\" >"; print "<div class=\"newVerifyUser\" >"; echo "<h3 style=\"text-align: center;\">Would you like to verify this Staff request?</h3>"; echo "<table><tr><td>" ."<img src=\"images/default_icons/di_bunny_rabbit.png\" width=\"56\" height=\"59\" />" ."<ul style=\"padding-left: 100px; padding-bottom: 20px; margin-top: -42px; list-style-type: none;\"><li>" ."{$UVStaff[username]} aka {$UVStaff[firstname]} {$UVStaff[lastname]}</li><li>" ."{$UVStaff[email]}</li></ul></td></tr><tr><td>" ."<form action=\"{$_SERVER[PHP_SELF]}\" method=\"post\">" ."<input type=\"checkbox\" name=\"isadmin\" value=\"1\" style=\"margin-left: 10px;\">Is Admin?" ."<input type=\"hidden\" name=\"vnsupUsername\" value=\"{$UVStaff['username']}\">" ."<input type=\"submit\" name=\"svnsu\" value=\"Verify Staff\" style=\"margin-left: 200px;\">" ."<input type=\"submit\" name=\"dvnsu\" value=\"Decline Request\">"; print "</table>"; print "</div></div>"; } } // verify a staff member if(isset($_POST[svnsu])){ echo "verifying a new user"; echo $_POST[vnsupUsername]; } ?> Hi guys! New to the community and hope to learn a lot here! Here is some background info and what I want to do, and what I know. I have been building websites for years, and I am familiar with Actionscript 3.0. And I have successful ran a few wordpress websites. What I am trying to do right now however is modify this form script I found, to only email the data when the field isn't left blank. It's stumping me because the actual "message" that ends up being the body of the email is a variable. And form what I can tell I can't figure out how to put if statements into it. If anyone can take a look at this script and give me any pointers you would be awesome. Code: [Select] <?php //trying to store the date in a separate variable only when it's not blank if ($_POST['starttime'] == '') { //nothing; } else { $showStartTime == "Start time: " . $_POST['starttime'] . ""; } if ($_POST['finishtime'] == '') { //nothing; } else { $showFinishTime == "Finish time: " . $_POST['finishtime'] . ""; } // Read POST request params into global vars $to = $_POST['to']; $from = $_POST['from']; $name = $_POST['name']; $company = $_POST['company']; $newcustomer = $_POST['newcustomer']; $address1 = $_POST['address1']; $address2 = $_POST['address2']; $subject = ("Event Rental for " . $name . ""); $description = $_POST['description']; $phone = $_POST['phone']; $message = (" Name: " . $name . " Company or Organization: " . $company . " Phone Number: " . $phone . " Email Address: " . $from . " Street Address: " . $address1 . " " . $address2 . " New Customer: " . $newcustomer . " Customer From: " . $_POST['howyouheard'] . " Interested in: SkyLoft " . $_POST['whichspace'] . " Date: " . $_POST['date'] . " Day of Week: " . $_POST['dayofweek'] . " " . $showStartTime . " " . $showFinishTime . " Number of Guests: " . $_POST['Guests'] . " Format: " . $_POST['format'] . " Occasion: " . $_POST['Occasion'] . " Optional Needs: " . $_POST['dj'] . " " . $_POST['tables'] . " " . $_POST['chairs'] . " " . $_POST['eventbanner'] . " " . $_POST['pasoundsystem'] . " Message: " . $description . " "); // Obtain file upload vars $fileatt = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name']; $headers = "From: $from"; if (is_uploaded_file($fileatt)) { // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // Base64 encode the file data $data = chunk_split(base64_encode($data)); // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; } // Send the message $ok = @mail($to, $subject, $message, $headers); if ($ok) { echo "<p><b>Thank you for your interest in SkyLofts!</b> <br>You should recieve a verification in your inbox that we recieved your request. We will contact you as soon as possible and hopefully be able to answer any questions you may have! You can also contact us via phone 410-791-6699, or toll-free 1-800-344-0410.</p>"; } else { echo "<p>There was an error when processing your request. Please try again.</p>"; } ?> Does anyone know of a way to use PHP to create and email a HTML file? I was attempting to use the standard PHP mail function to pass a HTML string to the message variable, but mail clients have a pretty hard time rendering HTML/CSS correctly. My thought was, if I could take my HTML string and turn it into a file and attach it to a email message the user would be able to open the file in there default browser which would render without issues. Just for the record my HTML string also contains PHP variables, so it must be processes before being sent. So far my research suggests using the PEAR library for sending mail with attachments, but I am only finding literature on how to attach a file already existing on the server to an email message. I am having trouble finding a way to create a HTML file on the fly and attach it to an email message. Has anyone had a similar problem? Is there a different way to accomplish what I am attempting to do here? Hi there I am trying to send an array of items to delete from a form, receive them back to the page then enter them into another form and then send them back to the page. Basically its a delete then confirm delete thing. So I can send the array from the first form though I am not sure how to place them into the second (confirm delete) form. What I've got so far considering the array does get sent in the first place is First I receive the array: if (isset($_POST['delete'])) { if (isset($_POST['todelete'])){ $todelete[] = ($_POST['todelete']);////here is my problem I think echo <<<_END <div>Are you sure you wish to make these changes</div> <div><form action="" method="post"> <input type='hidden' name='todelete'value="$todelete"/> <input type='hidden' name='confirm'value="confirm"/> <input id='inputform' type='submit' size='50' value='Yes' /> </form> <form action="" method="post"> <input type='hidden' name='rollback'value='rollback' /> <input id='inputform' type='submit' size='50' value='No' /> </form></div> _END; } } Then I try and receive the array back with if (isset($_POST['confirm'])){ foreach ($_POST['todelete'] as $delete_id) { $query ="DELETE FROM gallery WHERE id = $delete_id"; $result=mysql_query($query) or die("Invalid Query : ".mysql_error()); echo "Removing Data"; } } What I receive is a warning: 'Warning: Invalid argument supplied for foreach() in C:\wamp\www\css\enterphotos.php on line 91" I am sure that there is a simple solution! Can anyone help me here? Hi, I have a simple html form. <form action="mail.php" method="POST"> <p>Name</p> <input type="text" name="name"> <p>Email</p> <input type="text" name="email"> <p>Phone</p> <input type="text" name="phone"> <p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br /> <input type="submit" value="Send"><input type="reset" value="Clear"> </form> I send a simple recap to e-mail through PHP. Simultaneously with this recapitulation, I would like to generate XML, which would send it in an e-mail attachment. Somehow it's not working. Would anyone help? <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $formcontent=" From: $name \n Phone: $phone \n Call Back: $call \n Website: $website \n Priority: $priority \n Type: $type \n Message: $message"; $recipient = "**************"; $subject = "Contact Form"; $mailheader = "From: $email \r\n"; $doc = new DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $xmlRoot = $doc->createElement("xml"); $xmlRoot = $doc->appendChild($xmlRoot); $root = $doc->createElement('OrderDetails'); $root = $doc->appendChild($root); $ele1 = $doc->createElement('name'); $ele1->nodeValue=$name; $root->appendChild($ele1); $xml->saveXML(""); $mail->addStringAttachment($xml->asXML(), "xml.xml"); mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>"; ?> Thanks for any help!! I have an HTML form that I have a "select" drop-down menu that is selecting the name of the person you should send to. The names are being pulled from the Database, and here is what that code for the drop-down in the form looks like: <?php echo '<select name= "First_Name" , "Last_Name">'; while( $array = mysql_fetch_assoc($result) ) { $text_for_select = $array["First_Name"] . " " . $array["Last_Name"]. " " . $array["District"]; $value_for_select = $array["First_Name"] . " " . $array["Last_Name"] . "_" . $array["id"]; echo "<option></option>\n"; echo "<option value=\"$value_for_select\">$text_for_select</option>\n"; } echo '</select>';?> This works perfectly. However, what I want it to do is send the form to the email address of the person that is selected in the drop-down. The email address' are already entered in each record of the database in a field called "Email". I am using the $value_for_select variable to pull the id of the record, but I am unsure how to then tell the form to send to the email address of that record? Anybody know a way that this can be done? Here is the code of the for that should be sent: <?php if($_POST){ $to = $email; $subject = "WHAT SHOULD THIS BE"; $message = "Date: $date\n\r". "Dear $First_Name, $Last_Name,\n\r". "Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah..\n\r". "Sincerely,\n". "$name \n". "$street \n". "$city, $zip \n". "$email \\n". $headers = "From: $email"; mail($to, $subject, $message, $headers); // SUCCESS! echo '<p class="notice">'. 'Thank you for your submission. '. '</p>'; // clear out the variables for good-housekeeping unset($date,$legislator,$bill,$name,$street,$city,$zip,$email); $_POST = array(); } ?> Please help! I am trying to build a form that will process all the user inputted information, and put those contents into an html table so that I can send the info to both my customer and myself. I figured out how to send an email to myself as html, but the user email is arriving as plain text with all the html tags. Someone had suggested PHPMailer, but I cannot figure out how to format it properly to work with my setup. I am new to PHP so this is a learning curve. I have included a sample of my process form with fictitious email addresses. Any help is much appreciated. Thank you in advance for the help! Code: [Select] <?php header("Location: ../contactthank.php"); ?> <?PHP $field_Type = $_POST['field_Type']; $field_Service_Provider = $_POST['field_Service_Provider']; $field_Brand = $_POST['field_Brand']; $field_Model = htmlspecialchars($_POST['field_Model']); $field_Size = $_POST['field_Size']; $field_Charger = $_POST['field_Charger']; $field_Case = $_POST['field_Case']; $field_Software = $_POST['field_Software']; $field_Manual = $_POST['field_Manual']; $field_Box = $_POST['field_Box']; $field_Condition = $_POST['field_Condition']; $field_FirstName = htmlspecialchars($_POST['field_FirstName']); $field_LastName = htmlspecialchars($_POST['field_LastName']); $field_Email = $_POST['field_Email']; $field_ZipCode = (int)$_POST['field_ZipCode']; $field_Comments = $_POST['field_Comments']; ?> <?php $reference = (rand(100000000000,99999999999999)); echo $reference; ?> <?php $to = "email@mail.com"; $subject = "Submission# $reference"; $headers = 'From: $field_Email' . "\r\n"; $message = '<html> <head> <title>Cell Phone Form Submission</title> </head> <body> <h1>Thank you for your submission. We will get back to you shortly</h1> <table border="1"> <tr> <td>Reference#</td> <td>' . $reference . '</td> </tr> <tr> <td>I want to</td> <td><b>Sell</b></td> </tr> <tr> <td>Service Provider</td> <td>' . $field_Service_Provider . '</td> </tr> <tr> <td>Model</td> <td>' . $field_Model . '</td> </tr> <tr> <td>Size</td> <td> ' . $field_Size . '</td> </tr> <tr> <td>Accessories</td> <td>' . $field_Charger . " " . $field_Case . " " . $field_Software . " " . $field_Manual . " " . $field_Box . '</td> </tr> <tr> <td>Condition</td> <td>' . $field_Condition . '</td> </tr> <tr> <td>Name</td> <td>' . $field_FirstName . " " . $field_LastName . '</td> </tr> <tr> <td>Email</td> <td>' . $field_Email . '</td> </tr> <tr> <td>Zip Code</td> <td>' . $field_ZipCode . '</td> </tr> <tr> <td>Comments</td> <td>' . $field_Comments . '</td> </tr> </table></body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $user = "$field_Email"; $usersubject = "Form Submission# $reference"; $userheaders = "From: email@mail.com\n"; $usermessage = '<html> <head> <title>Form Submission</title> </head> <body> <h1>Thank you. We will get back to you shortly</h1> <table border="1"> <tr> <td>Reference#</td> <td>' . $reference . '</td> </tr> <tr> <td>I want to</td> <td><b>Sell</b></td> </tr> <tr> <td>Service Provider</td> <td>' . $field_Service_Provider . '</td> </tr> <tr> <td>Model</td> <td>' . $field_Model . '</td> </tr> <tr> <td>Size</td> <td> ' . $field_Size . '</td> </tr> <tr> <td>Accessories</td> <td>' . $field_Charger . " " . $field_Case . " " . $field_Software . " " . $field_Manual . " " . $field_Box . '</td> </tr> <tr> <td>Condition</td> <td>' . $field_Condition . '</td> </tr> <tr> <td>Name</td> <td>' . $field_FirstName . " " . $field_LastName . '</td> </tr> <tr> <td>Email</td> <td>' . $field_Email . '</td> </tr> <tr> <td>Zip Code</td> <td>' . $field_ZipCode . '</td> </tr> <tr> <td>Comments</td> <td>' . $field_Comments . '</td> </tr> </table></body> </html> '; mail($to,$subject,$message,$headers); mail($user,$usersubject,$usermessage,$userheaders,$headers); ?> There are two pieces to this- The HTML Form and the resulting php. I can't seem to make the leap, from the code to having the form produce the php page so others can view it until the form is again submitted overwriting the php, thus generating new content. The environment I am working in is limited to IIs 5.1 and php 5.2.17 without mySQL or other DB I'm new to php, this isn't homework,or commercialization, it's for children. I am thinking perhaps fwrite / fread but can't get my head around it. Code snipets below. Any help, please use portions of this code in hopes I can understand it Thanks Code snipet from Output.php Code: [Select] <?php $t1image = $_POST["t1image"]; $t1title = $_POST["t1title"]; $t1info = $_POST["t1info"]; $t2image = $_POST["t2image"]; $t2title = $_POST["t2title"]; $t2info = $_POST["t2info"]; ?> ... <tbody> <tr><!--Headers--> <td style="vertical-align: top; text-align: center; background-color: rgb(204, 255, 255);">Animal</td> <td style="vertical-align: top; text-align: center; background-color: rgb(204, 255, 255);">Image thumb<br> </td> <td style="vertical-align: top; text-align: center; background-color: rgb(204, 255, 255);">Date<br> </td> <td style="vertical-align: top; text-align: center; background-color: rgb(204, 255, 255);">Information<br> </td> </tr> <tr> <td style="vertical-align: top; text-align: center;">Monkey </td> <td style="vertical-align: top; text-align: center;"><img src="<?php echo $t1image.'.gif'; ?>"><!--single image presented selected from radio buttons--> </td> <td style="vertical-align: top; text-align: center;"><?php echo date("m/d/Yh:i A"); ?><!--time stamp generated when submitted form populates all fields at once--> </td> <td style="vertical-align: top; text-align: center;"><a href="#monkey" rel="facebox"><?php echo $t1title ?></a><!--Link name provided by "Title 1", that links to hidden Div generated page with content from "Info1" field--> <div id="Monkey" style="display:none"> <?php echo $t1info; ?> </div> </td> </tr> <tr> <td style="vertical-align: top; text-align: center;">Cat<br> </td> <td style="vertical-align: top; text-align: center;"><img src="<?php echo $t2image.'.gif'?>"></td> <td style="vertical-align: top; text-align: center;"><?php echo date("m/d/Yh:i A"); ?></td> <td style="vertical-align: top; text-align: center;"><a href="#Cat" rel="facebox"><?php echo $t2title ?></a> <div id="Cat" style="display:none"> <?php echo $t2info; ?> </div> </td> </tr> <tr> This replicates several times down the page around 15-20 times ( t1### - t20###) Code Snipet from HTML Form Code: [Select] <form action="animals.php" method="post"> <div style="text-align: left;"><big style="font-family: Garamond; font-weight: bold; color: rgb(51, 51, 255);"><big><big><span>Monkey</span></big></big></big><br> <table style="text-align: left; width: 110px;" border="0" cellpadding="2" cellspacing="0"> <tbody><tr> <td style="vertical-align: top;">Image thumb<br> <input type="radio" name="t1image" value="No opinion" checked><img src="eh.gif" alt="Eh"> <input type="radio" name="t1image" value="Ok"><img src="ok.gif" alt="ok"> <input type="radio" name="t1image" value="Like"><img src="like.gif" alt="Like"> <input type="radio" name="t1image" value="Dont"><img src="dont.gif" alt="Don't Like"> <input type="radio" name="t1image" value="Hate"><img src="hate.gif" alt="Hate"> <input type="radio" name="t1image" value="Other"><img src="other.gif" alt="Other"> <br> Why Title:<input type="text" name="t1title" size="45" value="..."/></td> <td style="vertical-align: top;"> Explain:<br> <textarea name="t1info" cols=45 rows=3 value="..."></textarea> </td></tr></table> <br> <!--Next--> How do I get the Form data to save to the php page for others to view? Hi all, I have an html form that sends formdata to a php script called example.php with the POST method. example.php then has the following structu Code: [Select] <?php if(isset($_POST['var1'])) {$var1 = $_POST['var1'];} else {$var1 = 'English';} if(isset($_POST['var2'])) {$var2 = $_POST['var2'];} else {$var2 = 'French';} print" <html> <body> <form> <select id='select1'> <option>var1</option> <option>var2</option> <option>etc...</option> </select> <input type='text' id='input1'> ETC. ETC. </form> </body> </html> "; ?> So example.php has an embedded html form. How do I specify that some elements of the form should take their values from the variables retrieved at the start of the script via the POST command? For example, I want select1 to have 'var1' pre-selected and I want input1 to display var2. var1 & var2 get sent through to example.php fine, I just don't know how to get the embedded html form to use them. Please help! Thanks a lot. Hello there.new member here in need of help! So i use the code the code below to display images from a folder into a form. My problem is that i put checkboxes with various selections in order to transfer the selected items later to a file or echo the submission. As it seems at the moment is that i can display correctly everything in my form but for some unknown reason i cannot echo/write to a txt file the files(names) that i choose with the checkbox.There seems to be something wrong with my loop but i'm not sure. I would appreciate any help.thank you in advance. Here is my code: <?php SESSION_START(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="author" content="vs" /> <meta name="robots" content="index, follow" /> <link rel="stylesheet" type="text/css" href="style.css" media="screen" /> <link rel="stylesheet" type="text/css" href="print.css" media="print" /> <link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <title></title> </head> <body> <div id="centerColumn"> <div id="header"> </div><!--//end #headern//--> <div id="navbar"> <ul> <li><a href="index.html" title="Home">Home</a></li> <li><a href="about.html" title="About us">About us</a></li> <li><a href="gallery.html" title="Gallery">Gallery</a></li> <li><a href="contact.html" title="Contact">Contact</a></li> </ul> </div><!--//end #nav//--> <?php echo '<h2 class="medium"><i>Hello '.$_SESSION['user'].'</i></h2>'; ?> <p><span class="small"></span><br /> This is your private directory. Please submit your selections and fill in the contact form, thank you. </p><br> <div align="center"> <form method="post" action="data2file.php"> <?php echo '<div STYLE="overflow: auto; width: 780px; height: 600px; border-left: 5px gray solid; border-bottom: 5px gray solid; border-top: 5px gray solid; border-right: 5px gray solid;; padding: 0px; margin: 0px";> <table border="1" cellspacing=0 cellpadding=1> <tr><td>'; $username = $_SESSION['user']; $url = $username."/"; $handle = opendir ($url); while (false !== ($file = readdir($handle))) { if($file != "." && $file != ".." && $file != basename(__FILE__)) { //echo '<table border=1><tr><td>'; echo '<a href="'.$url.$file.'" rel="lightbox"><img border=1 src="'.$url.$file.'"></a>'; echo '<br />'; echo "<input type=CHECKBOX name=$file>"; print $file; echo '<br>'; echo '<select name=color> <option>Select Color Format...</option> <option> Sepia </option> <option> Black & White </option> </select>'; echo '<br> <select name=size> <option>Select Size Format...</option> <option name=5x7> 5" x 7"(13x19 cm)</option> <option name=6x8> 6" x 8"(15x21 cm)</option> <option name=8x12> 8" x 12"(20x30 cm) </option> <option name=9x14> 9" x 14"(24x30 cm) </option> <option name=12x18> 12" x 18"(30x40 cm) </option> </select>'; echo '<br>Reprints <input type="text" name="reprints" size="1" value="0"><br />'; echo '<hr>'; //echo '</td></tr></table>'; } } echo '</td></div>'; echo ' <td valign="top"> <p>*First name, Last name, Country, Home Address, Postal code and email fields are required*</p> <input type="text" name="first" value="First Name" size="35"/><br> <input type="text" name="last" value="Last Name" size="35"/><br> <select name="country"> <option value=" " selected>(please select a country)</option> <option value="AF">Afghanistan</option> <option value="AL">Albania</option> <option value="DZ">Algeria</option> <option value="AS">American Samoa</option> <option value="AD">Andorra</option> <option value="AO">Angola</option> <option value="AI">Anguilla</option> <option value="AQ">Antarctica</option> <option value="AG">Antigua and Barbuda</option> <option value="AR">Argentina</option> <option value="AM">Armenia</option> <option value="AW">Aruba</option> <option value="AU">Australia</option> <option value="AT">Austria</option> <option value="AZ">Azerbaijan</option> <option value="BS">Bahamas</option> <option value="BH">Bahrain</option> <option value="BD">Bangladesh</option> <option value="BB">Barbados</option> <option value="BY">Belarus</option> <option value="BE">Belgium</option> <option value="BZ">Belize</option> <option value="BJ">Benin</option> <option value="BM">Bermuda</option> <option value="BT">Bhutan</option> <option value="BO">Bolivia</option> <option value="BA">Bosnia and Herzegowina</option>echo <option value="BW">Botswana</option> <option value="BV">Bouvet Island</option> <option value="BR">Brazil</option> <option value="IO">British Indian Ocean Territory</option> <option value="BN">Brunei Darussalam</option> <option value="BG">Bulgaria</option> <option value="BF">Burkina Faso</option> <option value="BI">Burundi</option> <option value="KH">Cambodia</option> <option value="CM">Cameroon</option> <option value="CA">Canada</option> <option value="CV">Cape Verde</option> <option value="KY">Cayman Islands</option> <option value="CF">Central African Republic</option> <option value="TD">Chad</option> <option value="CL">Chile</option> <option value="CN">China</option> <option value="CX">Christmas Island</option> <option value="CC">Cocos (Keeling) Islands</option> <option value="CO">Colombia</option> <option value="KM">Comoros</option> <option value="CG">Congo</option> <option value="CD">Congo, the Democratic Republic of the</option> <option value="CK">Cook Islands</option> <option value="CR">Costa Rica</option> <option value="CI">Cote dIvoire</option> <option value="HR">Croatia (Hrvatska)</option> <option value="CU">Cuba</option> <option value="CY">Cyprus</option> <option value="CZ">Czech Republic</option> <option value="DK">Denmark</option> <option value="DJ">Djibouti</option> <option value="DM">Dominica</option> <option value="DO">Dominican Republic</option> <option value="TP">East Timor</option> <option value="EC">Ecuador</option> <option value="EG">Egypt</option> <option value="SV">El Salvador</option> <option value="GQ">Equatorial Guinea</option> <option value="ER">Eritrea</option> <option value="EE">Estonia</option> <option value="ET">Ethiopia</option> <option value="FK">Falkland Islands (Malvinas)</option> <option value="FO">Faroe Islands</option> <option value="FJ">Fiji</option> <option value="FI">Finland</option> <option value="FR">France</option> <option value="FX">France, Metropolitan</option> <option value="GF">French Guiana</option> <option value="PF">French Polynesia</option> <option value="TF">French Southern Territories</option> <option value="GA">Gabon</option> <option value="GM">Gambia</option> <option value="GE">Georgia</option> <option value="DE">Germany</option> <option value="GH">Ghana</option> <option value="GI">Gibraltar</option> <option value="GR">Greece</option> <option value="GL">Greenland</option> <option value="GD">Grenada</option> <option value="GP">Guadeloupe</option> <option value="GU">Guam</option> <option value="GT">Guatemala</option> <option value="GN">Guinea</option> <option value="GW">Guinea-Bissau</option> <option value="GY">Guyana</option> <option value="HT">Haiti</option> <option value="HM">Heard and Mc Donald Islands</option> <option value="VA">Holy See (Vatican City State)</option> <option value="HN">Honduras</option> <option value="HK">Hong Kong</option> <option value="HU">Hungary</option> <option value="IS">Iceland</option> <option value="IN">India</option> <option value="ID">Indonesia</option> <option value="IR">Iran (Islamic Republic of)</option> <option value="IQ">Iraq</option> <option value="IE">Ireland</option> <option value="IL">Israel</option> <option value="IT">Italy</option> <option value="JM">Jamaica</option> <option value="JP">Japan</option> <option value="JO">Jordan</option> <option value="KZ">Kazakhstan</option> <option value="KE">Kenya</option> <option value="KI">Kiribati</option> <option value="KP">Korea, Democratic Peoples Republic of</option> <option value="KR">Korea, Republic of</option> <option value="KW">Kuwait</option> <option value="KG">Kyrgyzstan</option> <option value="LA">Lao Peoples Democratic Republic</option> <option value="LV">Latvia</option> <option value="LB">Lebanon</option> <option value="LS">Lesotho</option> <option value="LR">Liberia</option> <option value="LY">Libyan Arab Jamahiriya</option> <option value="LI">Liechtenstein</option> <option value="LT">Lithuania</option> <option value="LU">Luxembourg</option> <option value="MO">Macau</option> <option value="MK">Macedonia, The Former Yugoslav Republic of</option> <option value="MG">Madagascar</option> <option value="MW">Malawi</option> <option value="MY">Malaysia</option> <option value="MV">Maldives</option> <option value="ML">Mali</option> <option value="MT">Malta</option> <option value="MH">Marshall Islands</option> <option value="MQ">Martinique</option> <option value="MR">Mauritania</option> <option value="MU">Mauritius</option> <option value="YT">Mayotte</option> <option value="MX">Mexico</option> <option value="FM">Micronesia, Federated States of</option> <option value="MD">Moldova, Republic of</option> <option value="MC">Monaco</option> <option value="MN">Mongolia</option> <option value="MS">Montserrat</option> <option value="MA">Morocco</option> <option value="MZ">Mozambique</option> <option value="MM">Myanmar</option> <option value="NA">Namibia</option> <option value="NR">Nauru</option> <option value="NP">Nepal</option> <option value="NL">Netherlands</option> <option value="AN">Netherlands Antilles</option> <option value="NC">New Caledonia</option> <option value="NZ">New Zealand</option> <option value="NI">Nicaragua</option> <option value="NE">Niger</option> <option value="NG">Nigeria</option> <option value="NU">Niue</option> <option value="NF">Norfolk Island</option> <option value="MP">Northern Mariana Islands</option> <option value="NO">Norway</option> <option value="OM">Oman</option> <option value="PK">Pakistan</option> <option value="PW">Palau</option> <option value="PA">Panama</option> <option value="PG">Papua New Guinea</option> <option value="PY">Paraguay</option> <option value="PE">Peru</option> <option value="PH">Philippines</option> <option value="PN">Pitcairn</option> <option value="PL">Poland</option> <option value="PT">Portugal</option> <option value="PR">Puerto Rico</option> <option value="QA">Qatar</option> <option value="RE">Reunion</option> <option value="RO">Romania</option> <option value="RU">Russian Federation</option> <option value="RW">Rwanda</option> <option value="KN">Saint Kitts and Nevis</option> <option value="LC">Saint LUCIA</option> <option value="VC">Saint Vincent and the Grenadines</option> <option value="WS">Samoa</option> <option value="SM">San Marino</option> <option value="ST">Sao Tome and Principe</option> <option value="SA">Saudi Arabia</option> <option value="SN">Senegal</option> <option value="SC">Seychelles</option> <option value="SL">Sierra Leone</option> <option value="SG">Singapore</option> <option value="SK">Slovakia (Slovak Republic)</option> <option value="SI">Slovenia</option> <option value="SB">Solomon Islands</option> <option value="SO">Somalia</option> <option value="ZA">South Africa</option> <option value="GS">South Georgia and the South Sandwich Islands</option> <option value="ES">Spain</option> <option value="LK">Sri Lanka</option> <option value="SH">St. Helena</option> <option value="PM">St. Pierre and Miquelon</option> <option value="SD">Sudan</option> <option value="SR">Suriname</option> <option value="SJ">Svalbard and Jan Mayen Islands</option> <option value="SZ">Swaziland</option> <option value="SE">Sweden</option> <option value="CH">Switzerland</option> <option value="SY">Syrian Arab Republic</option> <option value="TW">Taiwan, Province of China</option> <option value="TJ">Tajikistan</option> <option value="TZ">Tanzania, United Republic of</option> <option value="TH">Thailand</option> <option value="TG">Togo</option> <option value="TK">Tokelau</option> <option value="TO">Tonga</option> <option value="TT">Trinidad and Tobago</option> <option value="TN">Tunisia</option> <option value="TR">Turkey</option> <option value="TM">Turkmenistan</option> <option value="TC">Turks and Caicos Islands</option> <option value="TV">Tuvalu</option> <option value="UG">Uganda</option> <option value="UA">Ukraine</option> <option value="AE">United Arab Emirates</option> <option value="GB">United Kingdom</option> <option value="US">United States</option> <option value="UM">United States Minor Outlying Islands</option> <option value="UY">Uruguay</option> <option value="UZ">Uzbekistan</option> <option value="VU">Vanuatu</option> <option value="VE">Venezuela</option> <option value="VN">Viet Nam</option> <option value="VG">Virgin Islands (British)</option> <option value="VI">Virgin Islands (U.S.)</option> <option value="WF">Wallis and Futuna Islands</option> <option value="EH">Western Sahara</option> <option value="YE">Yemen</option> <option value="YU">Yugoslavia</option> <option value="ZM">Zambia</option> <option value="ZW">Zimbabwe</option> </select> <input type="text" name="address" value="Home Address" size="45"> <input type="text" name="address" value="Postal Code" size="35" <input type="text" name="email" value="e-mail" size="35"/><br> <input type="text" name="date" value="Wedding Date (dd-mm-yyyy)" size="35"/><br> <input type="text" name="time" value="Wedding Time (hh:mm)"/><br> <input type="text" name="hotel" value="Hotel" size="35"/><br> <input type="text" name="room" value="Room Number" size="10"/><br> <hr> <TEXTAREA NAME="comments" ROWS=10 COLS=45 value="Comments">Notes / Comments </TEXTAREA><br> </td></tr> </table>'; echo '</div> <br> <input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset"> <a href="logout.php"><input type="button" name="logout" value="Logout"></form></a> </div> <br>'; ?> <div id="footer"> <a href="http://validator.w3.org/" title="W3C HTML Validation">XHTML</a> . <a href="http://jigsaw.w3.org/css-validator/validator-uri.html" title="W3C CSS Validation">CSS</a> . <a href="http://www.w3.org/TR/WCAG10/" title="Web Content Accessibility Guidelines">WCAG</a> . <a href="http://www.csstinderbox.com">The CSS Tinderbox</a></div> <div align="center" class="boxes"> <!--//end #footer//--><small> ©2009-2010</small></div> </div> <!--//end #centerColumn//--> <!--width=256 height=170--> </body> </html> and here is the process to file code: <?php SESSION_START(); $arxeio = "data.txt"; $fp = fopen($arxeio, "a") or die("Couldn't open $arxeio for writing!"); //fwrite($fp, $_POST[$file]."\n"); fwrite($fp, $_POST['color']."\n") or die("Couldn't write values to file!"); fwrite($fp, $_POST['size']."\n"); fclose($fp); echo $_SESSION['user']; echo $_POST['color']; echo $_POST['country']; echo "Saved to $arxeio successfully!"; ?> How should i make my code to work only for the selected items along with their attributes. Thank you very much. Hi Everyone, I'm new to PHP freaks, and I'm hoping someone might be able to help me. I have written some code for a html page and used php to retrieve confirm whether or not data is in a text file. I also tried to write some code to insert the data supplied to my html page to the text file but it's not working. Can someone help me figure out what my issue is. I have attached my text file, and my php code as well. Below you'll find the code I used for my html page. Thank you for all your help, Phee <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Telephone Directory</title> </head> <body> <form action='SignGuestBook.php' method='post'> <h1>Sign Guest Book</h1> <hr> <br> <table align='Left'> <tr> <td>Name: </td> <td><input name='name' /></td> </tr> <tr> <td>E-mail: </td> <td><input name='email' /></td> </tr> <tr> <td><input type="submit" value='Sign' /></td> <td><input type="reset" value='Reset Form' /></td> </tr> </table> <h3></h3> <br> <h4></h4> <br> <h5></h5> <br> <h6></h6> <br> <h7></h7> <br> <hr> <a href="http://helios.ite.gmu.edu/~smohamu2/IT207/Lab%20Assignment%208/AddNew.html">View Guest Book</a> </form> </body> </html> [attachment deleted by admin] Hello I am after some help with a concept to allow us to import some data into our database. I have a PDF which I have OCR'd and now have a word document... I then manually clean up the document to remove spurious characters, that part is fine. Now, the word document contains an unknown number of lines and an unknown number of records... and within those records an uknown number of fields... Here is an example of a single record: Mr G Aldred, 26/11/08, Canvardine Chance, Wolfies Dawn Tilley, KENINE SECRET DESTINY, d, c. Grey & White, KENINE SHADES OF THE NIGHT, d, c. Grey & White, KENINE SILENT WHISPER, b, c. Seal & White, KENINE SOFT KISSES, b, c. Grey & White, KENINE SPIRIT OF THE STORM, d, c. Seal & White KENINE STAR QUALITY, d, c. Seal & White And I could have multiple records like this, but with different number of names toward the end So, if I manually put some delimiting character instead of coma's , can I get PHP to read the WHOLE document in, split the document into records and then split those records into subfields to populate a form which I can then automatically submit to my database? Not sure if that is clear.... Thanks Hi all, this is the code i'm using at the moment which is at the bottom of a webpage Code: [Select] // Open file export.csv. $f = fopen("export.csv", "w"); // Put all values from $out to export.csv. fputs($f, $out); fclose($f); $filename = "StatisticalAnalysis-" . gmdate("Y-m-d-H-i-s") . ".csv"; header("Content-type: application/csv"); header("Content-Disposition: attachment; filename=" . $filename); readfile("export.csv"); The variable named $out is a long line of text in csv format. I've echoed that variable and it's all good. When a checkbox in a form further up the page is checked the code creates and fills in the $out variable and then carries out the code above. The problem i have is that when the csv save dialog comes up and the file is saved, all it contains is a copy of the html code which is on that page, not the info stored in the $out variable. Can anyone offer any advice on what the problem is? Cheers Hi, this is my first time here. i am trying to create an xls file from the data i get from mysql. here is the code i tried but i am not able to use it correctly. Code: [Select] ob_start(); include('config'); $datacat = mysql_query("SELECT * FROM `leads`") or die(mysql_error()); $name = mysql_fetch_assoc($datacat); $line1="Industry,Company Name,Officials Name,Job Title,Country,Direct Number Mobile Number,Switch Board Number,E-mail,Executive NamePitch Date,Call Back Date,Comments\t"; while($row = mysql_fetch_array($datacat, MYSQL_ASSOC)) { $line2= $name['industry'].",".$name['company_name'].",".$name['officials_name'].",".$name['job_title'].",".$name['country'].",".$name['direct_number_mobile_number'].",".$name['switch_board_number'].",".$name['email'].",".$name['executive_name'].",".$name['pitch_date'].",".$name['call_back_date'].",".$name['comment']."\t"."\n"; } $data="$line1\n$line2\n"; header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=extraction.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; i get my webpage title in the top of xls file and all the fields in xls file are separated by commas, whereas i want them to be in proper tables. Help would be much appreciated. |