PHP - How Can I Get My Results From An Html Form To Be Outputted On A Separate Php File?
Hi, When the user creates a contact, then edits the contact that final edited information is shown in a file called "my data.txt". After this, when I select my php file "save_contact_details.php" the details stored in the text file "my data.txt" are not retrieved. How can I retrieve them? At the moment the issue I'm having is that I see no data when I click on "save_contact_details.php" after I filled in all the contact persons information. Feel free to watch this video I recorded to help you understand what I am talking about. https://streamable.com/rbw6p save_contact_details.php code <html> <body> <?php $myFile=fopen("mydata.txt","r") or exit("Can’t open file!"); // Write each line of text into the text file file fwrite($myFile, $_POST["lastname"]."\r\n"); fwrite($myFile, $_POST["firstname"]."\r\n"); fwrite($myFile, $_POST["address01"]."\r\n"); fwrite($myFile, $_POST["address02"]."\r\n"); fwrite($myFile, $_POST["town"]."\r\n"); fwrite($myFile, $_POST["postcode"]."\r\n"); fwrite($myFile, $_POST["telephone"]."\r\n"); fwrite($myFile, $_POST["email"]."\r\n"); fclose($myFile); ?> <h1>My Contact Details</h1> <p>The contact details that you have submitted are shown below:</p> <table> <tr> <td align="right">Last name: </td> <td><?php echo $_POST["lastname"]; ?></td> </tr> <tr> <td align="right">First name: </td> <td><?php echo $_POST["firstname"]; ?></td> </tr> <tr> <td align="right">Address 01: </td> <td><?php echo $_POST["address01"]; ?></td> </tr> <tr> <td align="right">Address 02: </td> <td><?php echo $_POST["address02"]; ?></td> </tr> <tr> <td align="right">Town / city: </td> <td><?php echo $_POST["town"]; ?></td> </tr> <tr> <td align="right">Post code: </td> <td><?php echo $_POST["postcode"]; ?></td> </tr> <tr> <td align="right">Telephone: </td> <td><?php echo $_POST["telephone"]; ?></td> </tr> <tr> <td align="right">E-mail: </td> <td><?php echo $_POST["email"]; ?></td> </tr> </table> </body> </html>
<html> <body> <?php $myFile=fopen("mydata.txt","r") or exit("Can’t open file!"); // read each line of text from the text file $lastname = fgets($myFile); $firstname = fgets($myFile); $address01 = fgets($myFile); $address02 = fgets($myFile); $town = fgets($myFile); $postcode = fgets($myFile); $telephone = fgets($myFile); $email = fgets($myFile); fclose($myFile); ?> <h1>My Contact Details</h1> <p> The contact details on file are as shown below.<br> Edit the data and save your changes to file. </p> <form action="save_contact_details.php" method="post"> <table> <tr> <td align="right">Last name: </td><td> <?php echo "<input size=\"20\" type=\"text\" name=\"lastname\" value=\"$lastname\">"?> </td> </tr> <tr> <td align="right">First name: </td><td> <?php echo "<input size=\"20\" type=\"text\" name=\"firstname\" value=\"$firstname\">"?> </tr> <tr> <td align="right">Address 01: </td><td> <?php echo "<input size=\"30\" type=\"text\" name=\"address01\" value=\"$address01\">"?> </td> </tr> <tr> <td align="right">Address 02: </td><td> <?php echo "<input size=\"30\" type=\"text\" name=\"address02\" value=\"$address02\">"?> </td> </tr> <tr> <td align="right">Town / city: </td><td> <?php echo "<input size=\"20\" type=\"text\" name=\"town\" value=\"$town\">"?> </td> </tr> <tr> <td align="right">Post code: </td><td> <?php echo "<input size=\"10\" type=\"text\" name=\"postcode\" value=\"$postcode\">"?> </td> </tr> <tr> <td align="right">Telephone: </td><td> <?php echo "<input size=\"15\" type=\"text\" name=\"telephone\" value=\"$telephone\">"?> </td> </tr> <tr> <td align="right">E-mail: </td><td> <?php echo "<input size=\"50\" type=\"text\" name=\"email\" value=\"$email\">"?> </td> </tr> <tr> <td> </td> <td colspan="2" align="left"><input type="submit" value="Save Changes"></td> </tr> </table> </form> </body> </html> create contact html code <html> <body> <h1>The contact details</h1> <p>Please enter your contact details:</p> <form action="save_contact_details.php" method="post"> <table> <tr> <td align="right">First name: </td> <td><input size="20" type="text" maxlength="15" name="firstname"></td> </tr> <tr> <td align="right">Last name: </td> <td><input size="20" type="text" maxlength="15" name="lastname"></td> </tr> <tr> <td align="right">Address line 1: </td> <td><input size="30" type="text" maxlength="50" name="address01"></td> </tr> <tr> <td align="right">Address line 2: </td> <td><input size="30" type="text" maxlength="50" name="address02"></td> </tr> <tr> <td align="right">Town / city: </td> <td><input size="20" type="text" maxlength="20" name="town"></td> </tr> <tr> <td align="right">Post code: </td> <td><input size="10" type="text" maxlength="10" name="postcode"></td> </tr> <tr> <td align="right">Telephone: </td> <td><input size="15" type="text" size="20" maxlength="15" name="telephone"></td> </tr> <tr> <td align="right">E-mail: </td> <td><input size="50" type="text" maxlength="50" name="email"></td> </tr> <tr> <td> </td> <td colspan="2" align="left"><input type="submit" value="Submit"></td> </tr> </table> </form> </body> </html>
Similar TutorialsHow to do it? I have read some methods but they seem to not work. This is what I have got so far:
<?php Hi, I have a separate form created using Dreamweaver that calls a separate php script when the Submit button is clicked. Currently I am able display form validation messages in a new html page. If the user leaves fields blank, I would like the messages to appear on the form itself instead of in a new page. How do you make the messages from the php form validation code display into the calling html form? I know I could just do this with Dreamweaver but I would like to learn to do this using php. It might be easier to embed the code within the html page but I was thinking that using the separate script would be more secure. My form can be found here. Validation is working but opens a new page: http://www.tallfirshoa.com/adform.htm Thanks! Rob Im inserting HTML into a database, and then outputting it on a PHP page. Its an iframe code, so when I output it, it shows the iframe. I need it to just display the HTML code. How can I do this? I thought it would be something simple but I can find anyway to do it. Help very appreciated!! Thanks 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 In the code below, I am trying to produce a google-like page where the user can type keywords and pages of search results are displayed. The main difficulty I am encountering is that when the browser changes pages, it forgets everything about current data. Perhaps I should include the display of pages inside the HTML form ? How can I fix this code ? Here is the contents of my searchpage.php file : <?php $keywords=''; $display_search_results=''; if(isset($_POST['search_submitted'])) { $keywords=$_POST['keywords']; $search_results=array(); $totalNbrOfItems=20; for($k=1;$k<=$totalNbrOfItems;$k++) { $search_results[$k]='Your keywords '$keyowrds.' have been found in item number '.$k; } $nbrOfItemsParPage = 5; $nbrOfPages = ceil($totalNbrOfItems / $nbrOfItemsParPage); // Compute current page $current_page = (isset($_GET['page']))?intval($_GET['page']):1; $display_pages=($nbrOfPages<2)?'<p>Page : ':'<p>Pages : '; for ($i = 1 ; $i <= $nbrOfPages ; $i++) { if ($i == $current_page) //No link to the current page { $display_pages=$display_pages.$i.' '; } else { $display_pages=$display_pages.'<a href="searchpage.php?'. 'page='.$i.'">'. $i . '</a> '; } } $display_pages=$display_pages.'</p>'; $display_items=''; $start=$nbrOfItemsPerPage*($current_page-1); for($k=1;$k<=$nbrOfItemsParPage;$k++) { $display_items=$display_items.($search_results[$start+$k]).'<br>'; } $display_search_results=$display_pages.$display_items; } echo '<form method="post" action="searchpage.php">'. ' Type your keywords here : <br><br>'. '<textarea cols="65" rows="1" '. 'id="keywords_id" name="keywords">'.$keywords.'</textarea>'. '<input type="submit" name="search_submitted" id="search_submitted_id" value="Search" /> '. '</fieldset>'. '</form>'; echo $display_search_results; ?> What is the most secure way? Having DB connect script in the beginning of every script you need db for, or Having a database.php script containing the script and then including it to all other php. $poststart = "<!-- Begin -->";
$poststop = "<!-- End -->";
$parsedpost1 = explode($poststart, $contenu);
$parsedpost2 = explode($poststop, $parsedpost1[1]);
$contenu = $parsedpost1[0] . $poststart . $newpost . $poststop . $parsedpost2[1];
The above code will set 2 markers and replace whatever inside by $newpost, which is defined elsewhere in the page. But what if $newpost is so long that I'd be more comfortable storing it in a separate file?
How would I go about calling said file on that last line? (I'm referring to the specific syntax.)
Thx
Hi.. been a while since I have touched php and need some help. What I am trying to do is have my links pull text from separate php files, and load them into main table. Here is my old php code..used to work.. I had my index.php with my website template on it. In the table I want my info to appear i put this code. <?php /* START MAIN AREA HERE */ if($news) include("news.php"); elseif($bio) include("bio.php"); elseif($draw) include("draw.php"); elseif($pic) include("pic.php"); else include("news.php"); /* END HERE */?> My link looks like this. <A HREF="?news=x" ONMOUSEOVER="changeImages('home', 'images/home-over.gif'); return true;" ONMOUSEOUT="changeImages('home', 'images/home.gif'); return true;"> <IMG NAME="home" SRC="images/home.gif" WIDTH=69 HEIGHT=31 BORDER=0 ALT=""></A> Any help much appreciated! I don't have any PHP skills at all. In fact I'm probably looking for a script that can help accomplish what I'm asking about. Regardless, I'm having a hard time getting any answers or solutions to this. I would like to make a web form that collects cc#'s from my customers that is PCI Compliant in as simple a manner as possible. 99% of the time my clients are not being charged at all, and the cc is used simply to ensure a service is confirmed. If they were to be charged, I would have to do that manually as no payment gateways currently deposit into banks in the country I am in. One thought I had would be if I could have the cc# either split, or broken up into separate fields and emailed separately. I am told this is PCI Compliant. I would also be fine with the cc# being split between database and email. I know this is possible w/ zen cart, but I have been unable to find any scripts that do this and don't have a need for a shopping cart addition to my site. But, I am aware that zen cart and other shopping cart add ons have options for X's to cover a bunch of numbers in the middle of the string and write that directly to the database. One thing that is a necessity is that the majority of the data input to the form be emailed. So, I'm basically hoping to protect the cc data in the simplest way possible, which I thought would be to break it up. I'll be trashing the cc #'s once I get them. I have no need to file them. I do have a SSL on my server. I am completely open to other suggestions. Is something like this, or another option a possibility? My skills are rudimentary. I taught myself to write some html and also use Dreamweaver to subsidize for what I can't code myself. I apologize if this should be in one of the other forums. Hey Everyone, I'll start by saying that I am a very novice php programmer. But I am working on a file storage website, and I have it working and running properly, what you see here is on a new page called index2.php (Thought you might need to know) and full working version can be found here, http://www.jstpreview.net84.net now want I want the site to do is automatically generate a new .php or .html page once the user presses the "submit" button, I've looked through many tutorials to figure this out but anything I have tried so far didn't work. So anyways, the page generated should be named the name of the file uploaded plus the extension. I also want this page to be generated using a pre-uploaded template but if you look at the code, you will see that I havn't implemented that part yet. Code: [Select] <?php //Load the settings require_once("settings.php"); $message = ""; //Has the user uploaded something? if(isset($_FILES['file'])) { $target_path = Settings::$uploadFolder; $target_path = $target_path . time() . '_' . basename( $_FILES['file']['name']); //Check the password to verify legal upload if($_POST['password'] != Settings::$password) { $message = "Invalid Password!"; } else { //Try to move the uploaded file into the designated folder if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $message = "The file ". basename( $_FILES['file']['name']). " has been uploaded"; } else{ $message = "There was an error uploading the file, please try again!"; } } //Clear the array unset($_FILES['file']); } if(strlen($message) > 0) { $message = '<p class="error">' . $message . '</p>'; } /** LIST UPLOADED FILES **/ $uploaded_files = ""; //Open directory for reading $dh = opendir(Settings::$uploadFolder); //LOOP through the files while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..') { $filename = Settings::$uploadFolder . $file; $parts = explode("_", $file); $size = formatBytes(filesize($filename)); $added = date("m/d/Y", $parts[0]); $origName = $parts[1]; $filetype = getFileType(substr($file, strlen($file) - 3)); $uploaded_files .= "<li class=\"$filetype\"><a href=\"$filename\">$origName</a> $size - $added</li>\n"; } } closedir($dh); if(strlen($uploaded_files) == 0) { $uploaded_files = "<li><em>No files have been uploaded yet!</em></li>"; } function getFileType($extension) { $images = array('jpg', 'gif', 'png', 'bmp'); $docs = array('txt', 'rtf', 'doc'); $apps = array('zip', 'rar', 'exe'); if(in_array($extension, $images)) return "Images"; if(in_array($extension, $docs)) return "Documents"; if(in_array($extension, $apps)) return "Applications"; return ""; } function formatBytes($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } ?> <!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=ISO-8859-1" /> <style type="text/css" media="all"> @import url("style/style.css"); </style> <script src="http://code.jquery.com/jquery-latest.js"></script> <title>JetStorm Technologies | Staff - CloudNet</title> </head> <body> <div id="container"> <h1></h1> <form method="post" action="index.php" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="15728640" /> <fieldset> <legend>Add a new file to CloudNet:</legend> <?php echo $message; ?> <p><label for="name">Select file:</label><br /> <input type="file" name="files" /></p> <p><label for="password">Authentication for upload:</label><br /> <input type="password" name="password" /></p> <p><input type="submit" name="submit" value="Start upload" /></p> </fieldset> </form> <fieldset> <center> <?php if(isset($_FILES['file'])); //else $file=1; $file = $_POST["$origName"]; // grabbed from the form $file = fopen("filepages/" . $origName .".php","x"); //(Creates the file) fwrite($out, "<p> Man this really does not work $origName</p>"); // Generates the contents of file ?> </center> </fieldset> <fieldset> <legend>Previousely uploaded files</legend> <ul id="menu"> <li><a href="">All files</a></li> <li><a href="">Documents</a></li> <li><a href="">Images</a></li> <li><a href="">Applications</a></li> </ul> <ul id="files"> <?php echo $uploaded_files; ?> </ul> </fieldset> </div> <script src="js/filestorage.js" /> </body> </html> I would greatly appreciate it if someone can point out and fix the errors in this code, but it would be even more appreciated if someone could provide a working source code of auto-generation of pages on form submit. Thanks in advanced Hello, any help would be greatly appreciated. I have two dropdowns with 2 options in each. Customer picks one option from each dropdown and the form gets emailed to addresses from the two selections. The code below gives and error. My form: <form method="POST" action="quote.php" onsubmit="return checkform(this)"> <input type="hidden" name="agent" value="recipient_1,recipient_2"> <input type="hidden" name="office" value="recipient_3,recipient_4"> <select name="agent" id="agent"> <option value="recipient_1">Agent1 </option> <option value="recipient_2">Agent2 </option> </select> <select name="office" id="office"> <option value="recipient_3">Location1 </option> <option value="recipient_4">Location2 </option> </select> <input type="submit" name="submit" value="Submit"> </form> quote.php is below: $recipients = array( 'recipient_1' => 'email_1@yahoo.com', 'recipient_2' => 'email_2@yahoo.com', 'recipient_3' => 'email_3@yahoo.com', 'recipient_4' => 'email_4@yahoo.com', ); $exploded_recipients = explode(",",$_REQUEST['agent']); foreach($exploded_recipients as $value) { $my_email = $recipients[$value]; $success = mail($my_email, $Subject, $Body, "From: <$EmailFrom>"); } Thanks in advance 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.. I have an excel file that has several columns with different data and I need to create a form that can upload this excel file and insert the data from the columns into its conrresponding data columns in a mysql database. I know how to create the form but I have no idea how to get the file and tell it to input each cell of data into its corresponding field in the mysql database. Does anyone know how to do this? Any help would be appreciated. Thanks, I basically have a PHP Search Form, and when a user fills in a form it outputs the results. Each result displays a image of a property, how could i make them images have their own unique link which will take them directly to the page of the property being shown? Im using PHP and mySQL tables Any help is appreciated, Thank You. Heres the PHP that outputs the results: Code: [Select] <?php require_once 'mstr_ref.php'; function san($input){ if(get_magic_quotes_gpc()){ $input=stripcslashes($input); } $output = mysql_real_escape_string($input); return $output; } if(isset($_POST['submit'])){ $pVars = array('area'=>$_POST['areas'], 'propType'=>$_POST['prop_type'], 'saleType'=>$_POST['ptype'], 'minB'=>$_POST['min_bedrooms'], 'maxB'=>$_POST['max_bedrooms'], 'minP'=>$_POST['min_price'], 'maxP'=>$_POST['max_price']); foreach ($pVars as $k=>$v){ $v = san($v); } $sql = new makeQuery(); $sql->manAdd('location_id', $pVars['area']); if($pVars['propType'] != 'Any'){ $sql->manAdd('catagory_id', $pVars['propType']); } if ($pVars['maxB'] > 0){ $sql->manAdd('bedrooms', $pVars['maxB'], '<='); } if($pVars['minB'] > 0){ $sql->manAdd('bedrooms',$pVars['minB'],'>='); } if($pVars['saleType'] != 'Any'){ if($pVars['saleType'] == "forsale"){ $sql->manAdd('market_type', 'sale'); if($pVars['minP'] != 0){ $pVars['minP'] = $pVars['minP'] * 1000; } if($pVars['maxP'] != 0){ $pVars['maxP'] = $pVars['maxP'] * 1000; } } if($pVars['saleType'] == 'forrent'){ $sql->manAdd('market_type', 'rent'); } } $qry = $sql->sqlStart.$sql->stmt.'Group By property.id'; $results = mysql_query($qry) or die (mysql_error()."<br />|-|-|-|-|-|-|-|-|-|-|-|-<br />$qry"); if(mysql_num_rows($results) < 1){ die ("Sorry, No Results Match Your Search."); } while($row = mysql_fetch_assoc($results)){ echo '<div class="container" style="float:left;">'; echo '<div class="imageholder" style="float:left;">'; echo "<img class='image1' src='{$row['image_path']}' alt='{$row['summary']}'> <br />"; echo '</div>'; echo '<div class="textholder" style="font-family:helvetica; font-size:14px; float:left; padding-top:10px;">'; echo "{$row['summary']}"; echo "<span style=\"color:#63be21;\"><br><br><b>{$row['bedrooms']} bedroom(s) {$row['bathrooms']} bathroom(s) {$row['receptions']} reception room(s)</b></span>"; if($row['parking'] != null){ echo "<span style=\"color:#63be21;\"><b> {$row['parking']} parking space(s)</b></span>"; } echo '</div>'; echo '<div style="clear:both"></div>'; } } else{ echo "There was a problem, please click<a href='index.php'> Here </a>to return to the main page and try again"; } ?> Greetings Fellow PHPFreaks! LovableCodeMan here - newbie to this forum an pretty new to this PHP thing that all these youngsters are raving about - who knew?! Anyway, so I have an HTML form set up with a PHP document attached in order to send the data from the form to an email -a pretty basic setup by todays standards. In the PHP document, you can see that there is a section for the user (sender@xyz.com) to submit the information in the form to us & is sent to our email address "receiver@xyz.com". The bottom segment is to send a confirmation email back to the sender - to "sender@xyz.com" - as a thank you and a "We will get back to you ASAP" etc etc etc. The confirmation email sent to the sender@xyz.com works flawlessly when pressing the "Send Your Message" button, but then I just see "https://www.xyz.com/scripts/mail.php" in the address bar and no email is received by receiver@xyz.com - aka "Us". This is the PHP document - confidential information redacted & the "sender@xyz.com" & "receiver@xyz.com" replace the real email addresses. <!doctype html> <?php $title = $_POST['title']; $first = $_POST['first']; $surname = $_POST['surname']; $email = $_POST['email']; <!------- sender@xyz.com---> $internationalCode = $_POST['internationalCode']; $number = $_POST['number']; $userMessage = $_POST['userMessage']; $company = $_POST['company']; $Industrytype = $_POST['Industrytype']; $inc_status = $_POST['inc_status']; $state = ['state']; $email_from = "$first $surname <smtp server login>"; $Password = 'smtp server password'; $email_subject = "Website Enquiry from $first $surname"; $messageTo = "receiver@xyz.com"; $email_body = "User title: $title. \n". "The department this message is for is: $department.\n". "User First Name: $first.\n". "User Surname Name: $surname. \n". "User email: $email.\n". "International Dialing Code: $internationalCode. \n". "User Contact Number: $number.\n". "State of Incorporation: $state.\n". "File: $attachment.\n". "Company Name: $company, $inc_status.\n". "Industry type: $Industrytype.\n". "User Message is: $userMessage.\n"; $headers = "From: $email_from" . "\r\n" . "Reply to: $first $surname". "\r\n"; mail($messageTo, $email_subject, $email_body, $headers, "-fweb_support@xyz.com"); header('Location: https://www.xyz.com/thank_you.html'); <!--------Confirmation email send to sender@xyz.com below----------------> $respond_subject = "Thank you for your message"; /* Prepare autoresponder message */ $respond_message = " Hi $first, Thank you for messaging to us. We will aim to reply to you within 24 hours. In the meantime, why not follow our other stories via, as well as following, our Facebook page. Simply go to https://www.facebook.com/xyz/ Yours sincerely, The Support Team receiver@xyz.com. "; $headers = 'From: <Sender> <no-reply@xyz.com>' . "\r\n" . 'Reply-To: $email' . "\r\n" .<!------- sender@xyz.com---> 'X-Mailer: PHP/' . phpversion(); /* Send the message using mail() function */ mail($email, $respond_subject, $respond_message, $headers, "-fno-reply@xyz.com"); //} ?>
This is the HTML document:
<!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> </head> <body> <form role="form-inline" method="POST" action="../scripts/mail.php"> <div class="form-group"> <div class="row"> <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4 select "> <select class="" id="standard-select" name="title"> <option selected disabled>Title *</option> <option>Dr.</option> <option>Mr.</option> <option>Mrs.</option> <option>Ms.</option> <option>Prof.</option> <option>Rev.</option> <option>Pastor.</option> <option>Miss.</option> </select> </div> <div class="col-lg-4 col-md-4 col-sm-8 col-xs-8"> <input name="first" type="text" placeholder="First Name *" required/> </div> <div class="col-lg-6 col-md-4"> <input name="surname" type="text" placeholder="Surname *" required/> </div> </div> <div class="row"> <div class="col-lg-6 col-md-4 col-sm-6 col-xs-12"> <input name="email" type="email" placeholder="Email *" required/> </div> <label for="standard-select"></label> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-5 select"> <select class="" name="internationalCode" id=""> <option data-countryCode="GB" value="44" Selected>UK (+44)</option> <option data-countryCode="US" value="1" >USA (+1)</option> <optgroup label="Other countries"> <option data-countryCode="DZ" value="213">Algeria (+213)</option> <option data-countryCode="AD" value="376">Andorra (+376)</option> <option data-countryCode="AO" value="244">Angola (+244)</option> <option data-countryCode="AI" value="1264">Anguilla (+1264)</option> <option data-countryCode="AG" value="1268">Antigua & Barbuda (+1268)</option> <option data-countryCode="AR" value="54">Argentina (+54)</option> <option data-countryCode="AM" value="374">Armenia (+374)</option> </optgroup> </select> </div> <div class="col-lg-4 col-md-4 col-sm-12 col-xs-7"> <input type="tel" name="number" placeholder="Telephone Number *" required/> </div> </div> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 select"> <select name="inc_status" required> <option selected disabled>Incorporation status *</option> <option>Limited by Guarantee</option> <option>Limited by Shares</option> <option>CIC</option> <option>CIO</option> <option>Unincorporated</option> <option>LLP</option> <option>LLC</option> <option>Other</option> </select> </div> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 select"> <select name="state" disabled> <option selected disabled>State of incorporation *</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="DC">District Of Columbia</option> <option value="FL">Florida</option> </select> </div> </div> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"> <input name="company" type="text" placeholder="Company *" required/> </div> <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 select"> <select class="" name="Industrytype" id="select" value=""> <option selected disabled value="">Industry *</option> <option value="Appraisal/Disposition">Appraisal/Disposition</option> <option value="Business Services">Business Services</option> <option value="Consulting">Consulting</option> <option value="Business Broker">Business Broker</option> <option value="Distribution">Distribution</option> <option value="Education">Education</option> <option value="Financial Services (Non-Lender)">Financial Services (Non-Lender)</option> <option value="Government">Government</option> <option value="Healthcare">Healthcare</option> <option value="Insurance">Insurance</option> <option value="Investment Banking">Investment Banking</option> <option value="Law">Law</option> <option value="Lender">Lender</option> <option value="Logistics">Logistics</option> <option value="Manufacturing">Manufacturing</option> <option value="Media/Print/Broadcast/Internet">Media/Print/Broadcast/Internet</option> <option value="Other">Other</option> <option value="Private Equity/Venture Capital">Private Equity/Venture Capital</option> <option value="Real Estate Services">Real Estate Services</option> <option value="Receivables">Receivables</option> <option value="Retail">Retail</option> <option value="Technology">Technology</option> <option value="Turnaround/Restructuring">Turnaround/Restructuring</option> <option value="Utility">Utility</option> <option value="Wholesale">Wholesale</option> </select> </div> </div> <div class="row"> <div class="col-lg-12"> <textarea name="userMessage" placeholder="Please type your message here. Do not include any personal information such as your NIN or any banking information."></textarea> </div> </div> <div class="row"> <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12"> <div class="" style="background-color: #E0DDDD; padding: 20px;"> <p style="font-size: 12px; color: #0d0155">Information is held under the provision of the General Data Protection Regulation (GDPR). We will not pass your details on to any other organisation. We will process your information in accordance with our privacy policy. By send this message, you agree to xxxxxxx's <a style="color: #0D0155; text-decoration: underline;" href="/privacy/online_privacy_notice.html" target="_new" class="inline_link__new_window">Online Privacy Policy</a> </p> </div> </div> <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12"> <input type="submit" id="submit" name="submit" value="Send your message"/> </div> </div> </div> </form> </body> </html> Anyone know where I'm going wrong, it "half works" so I'm Half Way There - & yes, I am Livin' on a Prayer! Thanks in advance! The LovableCodeman Hi. So I've coded many a file upload form and never had any trouble. Until now. For some reason when I try to upload MP3 files, I'll hit submit and the page just reloads. Once it does so, the file upload field is once again blank. What's odd is that images and documents upload just fine. It's only audio tracks that cause the page to reload and clear. My php.ini max file upload size is at this point set to 100M, and the files I'm trying to upload are under 10M. Any ideas? Here's the form code, just to post it-- pretty basic. I'm at a loss here.... Any ideas would be appreciated. Thanks very much. <form action="test.php" enctype="multipart/form-data" method="POST"/> <input type = "file" name = "audio" /> <p><input type ="submit" name="submit" value="do it."/><p> </form> I would like to write all files from specific folder into .txt file. The output working just fine, but I'm getting only one file saved into my txt file. Any idea? Thanks! $fileList = glob('C:\users\John\Documents\*pdf'); foreach($fileList as $filename){ if(is_file($filename)){ echo $filename, '<br>'; $save_files = fopen("list.txt", "w"); fwrite($save_files,$filename); fclose($save_files); } }
Ok, here's my code: How do i make it so that it outputs a maximum of only 5 results from the query where the img file exists. When I add LIMIT to the sql query it doesnt work so I guess its something else, but I have no clue. Can anyone help? $query = mysql_query("SELECT * FROM table WHERE date >= '$now' ORDER BY max(date) desc"); while ($row = mysql_fetch_assoc($query)) { $cid = $row['cat_id']; $title = $row['name']; $seoname = $row['seourl']; $img = 'images/'.$seoname.'.jpg'; if (!file_exists($img)) { $img = ''; } else { $img = 'images/'.$seoname.'.jpg'; } if (!empty($img)) { echo '<a href="images/'.$seoname.'/"><img src="'.$img .'" style="width:528px;" alt="" /></a>' . "\n"; } } Thanks. |