Jump to content

RClapham

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by RClapham

  1. My blog is just a mashup of me really. I blog about everything but put my twist on it. I'm usually ridiculously sarcastic and use the world actually far far far too much I like to think that people can learn from my content but also be entertained by it. Examples of things that I blog about are: Current Affairs Web Design Web Projects Politics Games Reviews The people who actually read it quite like it, apparently it's coffee break reading.
  2. Just a small explanation of what you did wrong to back this up. You had passed your $_POST variables into variables called fieldnameField and then you're trying to call them with $fieldname. You were calling variables that weren't defined. Check your variable names in future! Don't worry, it's quite a common mistake
  3. No problem, though in the future it's more grammatically correct to have it with the form field name as the array key, so: $fields["Zip_Code"] and have it be set to the name of the field, so $fields["Zip_Code"] = "Zip Code". It's all the same just reads nice imo that way.
  4. Like this it should work, I haven't really changed much but I know that it should definitely work now: $to = "myemail@email.com,"; $from = $_REQUEST['Email']; $name = $_REQUEST['Requested_By']; $subject = "Request Certificate"; $fields = array(); $fields["Requested By"] = "Requested_By"; $fields["Insured Company Name"] = "Insured_Company_Name"; $fields["Certificate Holder"] = "Certificate_Holder"; $fields["Email"] = "Email"; $fields["Address1"] = "Address1"; $fields["Address2"] = "Address2"; $fields["Phone"] = "Phone_Number"; $fields["City"] = "City"; $fields["State"] = "State"; $fields["Zip Code"] = "Zip_Code"; $fields["Attention"] = "Attention"; $fields["Job Description"] = "Job_Description"; $fields["Job Number"] = "Job_Number"; $fields["Additional Insured"] = "Additional_Insured"; $fields["Primary Wording"] = "Primary_wording"; $fields["General Liability"] = "Coverage-General_Liability"; $fields["Auto Liability"] = "Coverage-Auto_Liability"; $fields["Workers' Compensation"] = "Coverage-Workers_Comp"; $fields["Umbrella Policy"] = "Coverage-Umbrella_Policy"; $fields["Evidence of Property"] = "Coverage-Evidence_of_Property"; $fields["Certificate Holder Fax"] = "Certificate_Holder_Fax_Number"; $fields["Notes (Certificate Holder's Requirements if Applicable)"] = "Certificate_Holder_Requirements"; $body = "We have received the following information:\r\n\r\n"; foreach($fields as $a => $b) { $body .= $a.": ".$_REQUEST[$b]."\n"; } if($name == '') { print "You have not entered a name, please go back and try again"; } else { $send = mail($to, $subject, $body); if($send) { header( "Location: http://www.companyname.com/thanks.php" ); } else { print "We encountered an error sending your mail, please notify .com"; } } ?>
  5. 404 Error is the web server telling you that the file doesn't exist. It's nothing to do with the GET method in this case it's just that you're pointing to a file on the server that isn't there. Check to make sure that file paths are correct and definitely pointing to the next.php file.
  6. Hi Andy, The problem that we have with your script here is that it's not using MySQL. Most image galleries use MySQL because of it's ability to select only certain images based on a range. You'd usually in this case get MySQL to retrieve a page number, lets say 2 for example, now on page 2 we'd want images 25 - 28. The code would look a bit like this (the maths is a slightly long version I can't remember the faster route at this moment in time): <?php $page = $_GET['page']; // We get the number of the last image on the page -1 to take array indexes into consideration $lastimg = ($page * 24) - 1; // Then create a range (25 - 48) $firstimg = $lastimg - 23; // Once we have these two numbers, we'd normally do an sql query but this is a bit different ?> Your case is a bit different, but it shouldn't be too hard, what we're going to do is change your foreach array slightly. The array you're building would look a bit like: Array( [0]=>"imgurl" [1]=>"imgurl" ... ) So what we can do is change the foreach using the code above: foreach($files as $key => $file){ if($key >= $firstimg && $key <= $lastimg){ if($colCtr %$cols == 0) echo '</tr><tr><td colspan="' . $cols . '"><hr /></td></tr><tr>'; echo '<td align="center"><a href="index.php?image=' . $file . '"><img src="' . $images . $file . '" /></a></td>'; $colCtr++; } } That should work though the numbers may need a few bits of tweaking. I haven't made a gallery in ages and never with a file array > SQL! Any problems just ask and I'll work through it with you.
  7. 9three got it bang on, here's a quick example though just to give you a bit more of a helping hand: <?php // Check if the form's been submitted if($_POST['submit']){ //Make sure the values aren't empty if(!empty($_POST['firstname'])&&!empty($_POST['lastname'])){ // Make a body string $body = $_POST['firstname'].$_POST['lastname']."\n"; // Handle the file $fp = fopen(people_processed.txt, "w" ) or die("Couldn't open file"); fwrite($fp, $body); fclose($fp); } else { // If there's form errors, set a variable... $error = "You didn't enter a required field"; } } ?> // HTML of the page <?php // ... and tell the user echo $error; ?> <form method="post" action=""> <input type="text" name="firstname" id="firstname" /> <input type="text" name="lastname" id="lastname" /> <input type="submit" name="submit" id="submit" /> </form>
  8. Someone might be able to correct me if I'm wrong here, but only you can set $_SESSION variables. I don't think that you need to keep checking against the server once the user's validated because you're the one who's set the session.
  9. In the checklogin.php file set a $_SESSION['username'] variable to the value of the member's username, once they've been validated. Then whenever you want to call the username just use that variable. So change this bit: if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } to if($count==1){ $row = mysql_select_assoc($result); // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['username'] =$row['username']; header("location:login_success.php"); }
  10. An example using Ken2k7's suggestion: <?php // Random number $rand = rand(10,20); // Repeat x times $str = str_repeat("#",$rand); // Echo the result, should be #the number of times the random number is set to. echo $str; ?>
  11. It's definitely possible, although making the documents Office 2007 files might be easier. DOCX files are basically just ZIP archives with XML documents inside. If it was just text that you wanted to send it'd probably be better to save them as .txt or .rtf as they're much easier to compose programatically (and are much smaller with regard to file size) than a Word Document. There is this: http://phpclasses.mirror.8086.net/browse/package/388.html But it's only for Windows as it uses COM. It's up to you. Though, zipping files is easy enough - the PHP website has a nice long document on it: http://uk.php.net/manual/en/class.ziparchive.php
×
×
  • 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.