Jump to content

frank_solo

Members
  • Posts

    109
  • Joined

  • Last visited

Everything posted by frank_solo

  1. I have a survey form and I want to post the results and send them by email through php. I have two scripts the form and the php script that sends it. I assuming I'm doing something wrong because the form does get sent but there are is info on the email. How do I post the values on the email. <form method="post" action="survey.php"> <table width="412" border="0" cellpadding="0"> <tr> <td colspan="5"><p><strong>1. Service Experience</strong></p></td> </tr> <tr> <td width="181"><p> </p></td> <td width="75"><p align="center">Excellent</p></td> <td width="51"><p align="center">Good</p></td> <td width="60"><p align="center">Fair</p></td> <td width="36"><p align="center">Poor</p></td> </tr> <tr> <td width="181"><p>Reservations</p></td> <td width="75"><p align="center"> <input type="radio" name="reservations_01" value="Excellent" /> </p></td> <td width="51"><p align="center"> <input type="radio" name="reservations_01" value="Good" /> </p></td> <td width="60"><p align="center"> <input type="radio" name="reservations_01" value="Fair" /> </p></td> <td width="36"><p align="center"> <input type="radio" name="reservations_01" value="Poor" /> </p></td> </tr> <tr> <td width="181"><p>Confirmation</p></td> <td width="75"><p align="center"> <input type="radio" name="confirmation_02" value="Excellent" /> </p></td> <td width="51"><p align="center"> <input type="radio" name="confirmation_02" value="Good" /> </p></td> <td width="60"><p align="center"> <input type="radio" name="confirmation_02" value="Fair" /> </p></td> <td width="36"><p align="center"> <input type="radio" name="confirmation_02" value="Poor" /> </p></td> </tr> <tr> <td width="181"><p>Airport Greeter<br /> (if applicable)</p></td> <td width="75"><p align="center"> <input type="radio" name="airport_greeter_03" value="Excellent" /> </p></td> <td width="51"><p align="center"> <input type="radio" name="airport_greeter_03" value="Good" /> </p></td> <td width="60"><p align="center"> <input type="radio" name="airport_greeter_03" value="Fair" /> </p></td> <td width="36"><p align="center"> <input type="radio" name="airport_greeter_03" value="Poor" /> </p></td> </tr> <tr> <td width="181"><p>Chauffeur</p></td> <td width="75"><p align="center"> <input type="radio" name="chauffeur_04" value="Excellent" /> </p></td> <td width="51"><p align="center"> <input type="radio" name="chauffeur_04" value="Good" /> </p></td> <td width="60"><p align="center"> <input type="radio" name="chauffeur_04" value="Fair" /> </p></td> <td width="36"><p align="center"> <input type="radio" name="chauffeur_04" value="Poor" /> </p></td> </tr> <tr> <td width="181"><p>Vehicle</p></td> <td width="75"><p align="center"> <input type="radio" name="vehicle_05" value="Excellent" /> </p></td> <td width="51"><p align="center"> <input type="radio" name="vehicle_05" value="Good" /> </p></td> <td width="60"><p align="center"> <input type="radio" name="vehicle_05" value="Fair" /> </p></td> <td width="36"><p align="center"> <input type="radio" name="vehicle_05" value="Poor" /> </p></td> </tr> <tr> <td width="181"><p>Billing</p></td> <td width="75"><p align="center"> <input type="radio" name="billing_06" value="Excellent" /> </p></td> <td width="51"><p align="center"> <input type="radio" name="billing_06" value="Good" /> </p></td> <td width="60"><p align="center"> <input type="radio" name="billing_06" value="Fair" /> </p></td> <td width="36"><p align="center"> <input type="radio" name="billing_06" value="Poor" /> </p></td> </tr> <tr> <td width="181"><p>Overall</p></td> <td width="75"><p align="center"> <input type="radio" name="overall_07" value="Excellent" /> </p></td> <td width="51"><p align="center"> <input type="radio" name="overall_07" value="Good" /> </p></td> <td width="60"><p align="center"> <input type="radio" name="overall_07" value="Fair" /> </p></td> <td width="36"><p align="center"> <input type="radio" name="overall_07" value="Poor" /> </p></td> </tr> <tr> <td width="181"></td> <td colspan="4"></td> </tr> <tr> <td width="181"><p>Comments</p></td> <td colspan="4"><p align="center"> <textarea name="comments_08"></textarea> </p></td> </tr> <tr> <td> </td> <td colspan="4"><input type="submit" value="Send" /> <input type="reset" value="Reset" /></td> </tr> </table> </form> Php Script <?php $to = "[email protected]"; // change to your email address $reservations_01 = $_POST["reservations_01"]; $confirmation_02 = $_POST["confirmation_02"]; $airport_greeter_03 = $_POST["airport_greeter_03"]; $chauffeur_04 = $_POST["chauffeur_04"]; $vehicle_05 = $_POST["vehicle_05"]; $billing_06 = $_POST["billing_06"]; $overall_07 = $_POST["overall_07"]; $comments_08 = $_POST["comments_08"]; $d = date('l dS \of F Y h:i:s A'); $sub = "Survey Form"; $headers = "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $mes .= 'Date & Time: '.$d; { mail($to, $sub, $mes, $headers); } ?>
  2. That didn't work for me.
  3. Ok so I'm still having problems. This is what I need: I want a function to echo a message if a username does not pass my requirments. - Only letters and / or numbers - Must start with a letter (not a number) - No spaces The current code is not working for me. Please help }else if (!(eregi('/[A-Za-z0-9-]+',($_POST["username"])))){ echo "<p> </p><p> </p><p> </p><br />Must only contain numbers and letters and cannot exceed 10 characters.<p> </p><p> </p><a href='javascript:javascript:history.go(-1)'>Click here to go back to previous page</a>";
  4. Thank you dcro2 and sorry I meant $gmap->showLocation($cross,$town,$county,$state);
  5. I had bought a script from here: php google maps and have been using the attached php script. It was working and than apparently stopped working with this error "602: Unable to Geocode this address" Can anyone tell me if there is another solution? Or if I can use another method besides $gmap->showLocation($cross,$town,$county$state); Thanks! <?php require_once('gmap.php'); $gmap = new GMap(); $cross = $result['cross_streets']; $county = $result['county']; $town = $result['town']; $state = 'New York'; $gmap->showLocation($cross,$town,$county$state); ?>
  6. Thank you gizmola your info was very helpful.
  7. I have a column that is named date_created and has a value of DATETIME. How on this script can I insert only the time it was created. Is it NOW()) and if so how do I write it in the script? // if residential if($_POST['type'] == ""){ mysql_select_db("", $con); $sql = "INSERT INTO apartments (username, title, county, town, type, description, phone, rooms, bath, square, rent, fees, service, imageurl1, imageurl2, imageurl3, imageurl4) VALUES ('".$myusername."', '".mysql_real_escape_string($_POST['title'])."', '".mysql_real_escape_string($_POST['county'])."', '".mysql_real_escape_string($_POST['town'])."', '".mysql_real_escape_string($_POST['type'])."', '".mysql_real_escape_string($_POST['description'])."', '".mysql_real_escape_string($_POST['phone'])."', '".$_POST[('rooms')]."', '".mysql_real_escape_string($_POST['bath'])."', '".mysql_real_escape_string($_POST['square'])."', '".mysql_real_escape_string($_POST['rent'])."', '".mysql_real_escape_string($_POST['fees'])."', '".mysql_real_escape_string($_POST['service'])."', '".mysql_real_escape_string($images[1])."', '".mysql_real_escape_string($images[2])."', '".mysql_real_escape_string($images[3])."', '".mysql_real_escape_string($images[4])."')"; $result = mysql_query($sql) or die(mysql_error());
  8. Dear dcro2, YOU ARE A GOD!!!!! Thanks everyone for the help!
  9. Does anyone know what these errors mean?
  10. The same happen to me Getting errors: Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in /../SimpleImage.php on line 28 Warning: imagesx(): supplied argument is not a valid Image resource in /../SimpleImage.php on line 60 Warning: imagejpeg(): supplied argument is not a valid Image resource in /../SimpleImage.php on line 40
  11. My script alone works corks correctly but I can't seem to find the correct way to include this include('SimpleImage.php'); $image = new SimpleImage(); $image->load($_FILES['uploaded_image']['tmp_name']); $image->resizeToWidth(150); $image->output(); into my script. My script uploads the image to a file directory, but I want to resize the image and then upload the image to the destination folder. Does anyone know how to write it in to script?
  12. I'm trying to use this script known as SimpleImage.php that can be found here <a href="http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php">link</a> I'm trying to include what is on the bottom of the page to my existing script can anyone help me I've tried several ways but its not working. <?php session_start(); error_reporting(E_ALL); ini_set('display_errors','On'); //error_reporting(E_ALL); // image upload folder $image_folder = 'images/classified/'; // fieldnames in form $all_file_fields = array('image1', 'image2' ,'image3', 'image4'); // allowed filetypes $file_types = array('jpg','gif','png'); // max filesize 5mb $max_size = 5000000; //echo'<pre>';print_r($_FILES);exit; $time = time(); $count = 1; foreach($all_file_fields as $fieldname){ if($_FILES[$fieldname]['name'] != ''){ $type = substr($_FILES[$fieldname]['name'], -3, 3); // check filetype if(in_array(strtolower($type), $file_types)){ //check filesize if($_FILES[$fieldname]['size']>$max_size){ $error = "File too big. Max filesize is ".$max_size." MB"; }else{ // new filename $filename = str_replace(' ','',$myusername).'_'.$time.'_'.$count.'.'.$type; // move/upload file $target_path = $image_folder.basename($filename); move_uploaded_file($_FILES[$fieldname]['tmp_name'], $target_path); //save array with filenames $images[$count] = $image_folder.$filename; $count = $count+1; }//end if }else{ $error = "Please use jpg, gif, png files"; }//end if }//end if }//end foreach if($error != ''){ echo $error; }else{ /* -------------------------------------------------------------------------------------------------- SAVE TO DATABASE ------------------------------------------------------------------------------------ -------------------------------------------------------------------------------------------------- */ ?>
  13. Its ok thank you to both for the help!
  14. Thanks Kadeous but I've tried this and nothing. <?php include "dbaptsConfig.php"; include "searchaptsstyle.css"; // test id, you need to replace this with whatever id you want the result from $id = "1"; $image1 = "image1"; // what you want to ask the db $query = "SELECT * FROM `apartments` WHERE `id` = ".$id; // actually asking the db $res = mysql_query($query, $ms); // recieving the answer from the db (you can only use this line if there is always only one result, otherwise will give error) $result = mysql_fetch_assoc($res); // if you uncomment the next line it prints out the whole result as an array (prints out the image as weird characters) // print_r($result); // print out specific information (not the whole array) echo "<br/>"; echo "<div id='title'>".$result['title']."<br/></div>"; echo "<br/>"; echo "<div id='description'>".$result['description']."<br /></div>"; echo "<br/>"; echo "<div id='table'><tr>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Provider's Phone Number: ".$result['phone']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Provider: ".$result['service']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Borough: ".$result['county']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Town: ".$result['town']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Bedrooms: ".$result['rooms']."</td>"; echo "<td> </td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Bathrooms: ".$result['bath']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Square Footage: ".$result['square']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Rent: ".$result['rent']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Listed On: ".$result['time']."<br /></td>"; echo "</tr></div>"; ?> <html> <body> <img src="<?php echo $image1 ;?>" width="200"> </body> </html>
  15. I read everywhere where it says not to stoe images in MYSQL but I have a code where I'm trying to display the images. They are all jpegs that are stored in the table. Here is the code <?php include "dbaptsConfig.php"; include "searchaptsstyle.css"; // test id, you need to replace this with whatever id you want the result from $id = "1"; // what you want to ask the db $query = "SELECT * FROM `apartments` WHERE `id` = ".$id; // actually asking the db $res = mysql_query($query, $ms); // recieving the answer from the db (you can only use this line if there is always only one result, otherwise will give error) $result = mysql_fetch_assoc($res); // if you uncomment the next line it prints out the whole result as an array (prints out the image as weird characters) // print_r($result); // print out specific information (not the whole array) echo "<br/>"; echo "<div id='title'>".$result['title']."<br/></div>"; echo "<br/>"; echo "<div id='description'>".$result['description']."<br /></div>"; echo "<br/>"; echo "<div id='table'><tr>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Provider's Phone Number: ".$result['phone']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Provider: ".$result['service']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Borough: ".$result['county']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Town: ".$result['town']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Bedrooms: ".$result['rooms']."</td>"; echo "<td> </td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Bathrooms: ".$result['bath']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Square Footage: ".$result['square']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Rent: ".$result['rent']."<br /></td>"; echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Listed On: ".$result['time']."<br /></td>"; echo "</tr></div>"; header("Content-type: image/jpeg"); echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'> Listed On: ".$result['image1']."<br /></td>"; ?> Thanks
  16. I have a table and one column has links that point to index.php?id= but I want it to display the info of that row of my database. On the index.php page i have this code <?php include "dbaptsConfig.php"; // test id, you need to replace this with whatever id you want the result from $id = "1"; // what you want to ask the db $query = "SELECT * FROM `apartments` WHERE `id` = ".$id; // actually asking the db $res = mysql_query($query, $ms); // recieving the answer from the db (you can only use this line if there is always only one result, otherwise will give error) $result = mysql_fetch_assoc($res); // if you uncomment the next line it prints out the whole result as an array (prints out the image as weird characters) // print_r($result); // print out specific information (not the whole array) echo "id: ".$result['id']."<br />"; echo "username: ".$result['username']."<br />"; echo "type: ".$result['type']."<br />"; echo "title: ".$result['title']."<br />"; echo "description: ".$result['description']."<br />"; echo "county: ".$result['county']."<br />"; echo "town: ".$result['town']."<br />"; echo "phone: ".$result['phone']."<br />"; echo "rooms: ".$result['rooms']."<br />"; echo "bath: ".$result['bath']."<br />"; echo "square: ".$result['square']."<br />"; echo "rent: ".$result['rent']."<br />"; echo "time: ".$result['time']."<br />"; ?> I know there is something wrong with this cause I always get the same info no matter which apartment I click. Do I use the $_GET function and how do I implement this?
  17. Please I need help?
  18. Ok I figured how to insert it to this echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'><a href='classified/searchapts/index.php?id=$title'>" . $row['title'] . "</a></td>"; but now what do I write in the page. In this case index.php to display the info of that row is it this <?php include "dbaptsConfig.php"; $query = mysql_query("SELECT * FROM apartments WHERE title ='$title'"); while($row = mysql_fetch_array($query)) { echo $row['title']; echo '<br>'; echo $row['town']; echo '<br>'; echo $row['rooms']; echo '<br>'; } ?>
  19. Ok so where can I put this " . $row['title'] . " in this echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'><a href='index.php?id=$title'>$title</a></td>";
  20. Thanks JohnOP for the response. I got it to link to another page like so echo "<td bgcolor='#FFFFFF' style='color: #000' align='center'><a href='classified/searchapts/index.php'" . $row['title'] . "'>".$row['title']."</a></td>"; My second question is how do i start to show the data on the href page for the item in the row. What function can I use or does anyone know of a good tutorial?
  21. I have a table where it displays some data. How do I make this echo "<td>" . $row['title'] . "</td>"; into a link?
  22. I've been working on a project and I have pretty much everything set up with a registration page, login and logout. After the user logs in it directs it to index.php. That's where it it ends. How do I start the page where it will display something like Hello, username! and than anything else the user has done in his or her account. Does anyone know a good tutorial? Thanks
  23. For some reason I was thinking elseif statement. Thank you for the help. Another question how can I limit password to 6 to 8 character?
  24. I have written the code for email check, but how and where can I put the code to check if a username has been used twice? Thanks in advance. <?php $servername = "localhost"; $username = ""; $password = ""; //validate fields if(!$_POST["username"] || !$_POST["email"] || !$_POST["password1"] || !$_POST["password2"]){ echo "<p> </p><p> </p><p> </p><br />Please fill the required fields, <p> </p><p> </p><a href='register.php'>Go to register page</a>"; //validate password }else if($_POST["password1"] != $_POST["password2"]){ echo "<p> </p><p> </p><p> </p><br />Please go back, PASSWORDS do not match! <p> </p><p> </p><a href='register.php'>Go to register page</a>"; //validate email }else if(!(eregi("^.+@.+\\..+$", $_POST['email']))){ echo "<p> </p><p> </p><p> </p><br />Please enter a valid EMAIL! <a href='register.php'><p> </p><p> </p>Go to register page</a>"; //validate captcha }else if(($_SESSION['security_code'] != $_POST['security_code']) || (empty($_SESSION['security_code'])) ){ echo "<p> </p><p> </p><p> </p><br />CAPTCHA CODE does not match! <p> </p><p> </p><a href='register.php'>Go to register page</a>"; }else{ $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); mysql_select_db("genesis_members",$conn); // check if already registered $sql_check = "SELECT * FROM users WHERE email = '".$_POST[email]."'"; $result_check = mysql_query($sql_check,$conn) or die(mysql_error()); $row = mysql_fetch_assoc($result_check); if($row['id']){ echo "<p> </p><p> </p><p> </p><br />EMAIL already registered! <p> </p><p> </p><a href='register.php'>Go to register page</a>"; }else{ // insert in db $sql = "INSERT INTO users (username, email, password, company, phone, services) VALUES ('".$_POST[username]."', '".$_POST[email]."', '".$_POST[password1]."', '".$_POST[company]."', '".$_POST[phone]."', '".$_POST[services]."')"; $result = mysql_query($sql,$conn) or die(mysql_error()); echo "<p> </p><p> </p><p> </p><br /><h1>You Have Successfully Registered</h1>"; echo "<p> </p><p> </p><br /><a href='main_login.php'>go to login page</a>"; } } ?>
  25. I've noticed that, thanks. I've changed the $data to $res but I still get the same result.
×
×
  • Create New...

Important Information

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