Jump to content

JoeLongstreet

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

JoeLongstreet's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm using the "PHP Simple HTML DOM Parser" - http://simplehtmldom.sourceforge.net/manual.htm I'm running through a bunch of elements and I need to determine what kind of element it is that I'm returning. For example <html> <div id='wrap'> <h1>Heading</h1> <p>something</p> <p>something</p> <h2>Second Heading</h2> </div> </html> //PHP $html = 'http://somehtmldoc.html' foreach($html->find('div[id=wrap]') as $thing) { $var = $thing->this should tell me if it's an h4, p, h1, etc. } Any help is much appreciated. Thanks, Joe
  2. Not sure if this is the best place to post a question like this, but I was wondering if anyone had some interesting ideas on how to search a user inputted string for emotion. I'd be looking for two fixed emotions - general positivity and general negativity. I could search each string for specific words (eg. 'Horrible', 'awful', and 'disgusting' would return negative while 'Great', 'Terrific', and 'delicious' would return positive). Just curious to know if anyone has a better idea, or a more thorough way of checking for emotion. Thanks for any ideas you can provide. Joe
  3. I'm not really much into php so I'm looking for some kind of a tool that will automatically push data from a form into a .xls of sql file. Anyone know of an easy way to do something like this, easy enough for a designer who writes css... Thanks, Joe
  4. Thanks for all the help. Got it working good. Even put some jquery in it. Thanks, Joe
  5. I am definitely not a PHP developer but I need a little help on a basic contact form I'm working on. Works ok so far, but I need to clean it up a little bit. This single line is the main concern, where $message is the body section of the email sent: $message = htmlspecialchars($_POST['name'] . '\n' . 'email' . '\n' . 'guests'); I thought the '\n' would make a new line in the sent email, but it didn't. Also, the guests variable is a select/option thing in the contact form and it is not sending it's value in the $message. Any help is much appreciated. Thanks, Joe HTML Form: <form id="rsvp" action="mail.php" method="post"> <div id="buttons"> <input class="button" id="rsvpButton" type="image" src="images/rsvpButton.png" /> </div><!--buttons--> <div id="inputs"> <label id="nameLabel" for="name">name</label> <input id="name" type="text" name="name" class="input" /> <label id="emailLabel" for="email">email</label> <input id="email" type="text" name="email" class="input" /> <label id="guestsLabel" for="guests">attending (including you)</label> <select id="guests" name="guests"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6+</option> </select> </div><!--inputs--> </form> PHP: <?php error_reporting(E_NOTICE); function valid_email($str) { return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; } if($_POST['name']!='' && $_POST['email']!='' && valid_email($_POST['email'])==TRUE) { $to = "email@email.net"; $headers = 'From: '.$_POST['email'].''. "\r\n" . 'Reply-To: '.$_POST['email'].'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $subject = "Addition to Wedding Guest List"; $message = htmlspecialchars($_POST['name'] . '\n' . 'email' . '\n' . 'guests'); if(mail($to, $subject, $message, $headers)) { echo 1; //SUCCESS } else { echo 2; //FAILURE - server failure } } else { echo 3; //FAILURE - not valid email } ?>
  6. Great. Thank you for your help. I appreciate it, Joe
  7. I'm trying to use this little piece of code to direct a user to another page on the site. If they select a specific dropdown they should go to one section and if they select a different dropdown, they should go to another. From my feeble understanding of php I think this should work. Why doesn't it? <?php if(isset($_POST['submit'])) { $to = "joe@jenningspr.net"; $subject = "New Download requested from JenningsPR.net"; $name_field = $_POST['name']; $email_field = $_POST['email']; $company_field = $_POST['company']; $dropdown = $_POST['drop_down']; $body = "Download Requested: $dropdown\n Name: $name_field\n Company: $company_field\n E-Mail: $email_field\n"; mail($to, $subject, $body); if ($dropdown == metro) { header('Location: http://testing.jenningspr.net/downloads/metro.html'); } else if($dropdown == fittyWest) { header('Location: http://www.jenningspr.net/downloads/fiftyWest.html'); } else if($dropdown == heartland) { header('Location: http://www.jenningspr.net/downloads/heartland.html'); } else if($dropdown == kcdma) { header('Location: http://www.jenningspr.net/downloads/kcdma.html'); } } else { echo "blarg!"; } ?> <fieldset> <legend>Download a Case Study</legend> <form action="caseStudies.php" method="POST"> <table cellspacing="10"> <tr> <td>Case Study:</td> <td> <select name="drop_down"> <option name="metro">Metropolitan</option> <option name="fittyWest">50West</option> <option name="heartland">HeartlandCremation</option> <option name="kcdma">KCDMA</option> </select> </td> </tr> <tr> <td>Name:</td> <td><input name="name" type="text" size="33"/></td> </tr> <tr> <td>Email:</td> <td><input name="email" type="text" size="33"/></td> </tr> <tr> <td>Company:</td> <td><input name="comapny" type="text" size="33"/></td> </tr> <tr> <td></td> <td><input name="submit" value="Submit" type="submit" /></td> </tr> </table> </form> </fieldset>
  8. I'm trying to include the latest blog post into a current website. This includes the entire blog: <? $a = file_get_contents("http://www.jenningspr.net/blogs/index.php"); echo ($a); ?> but I want the latest post to act as an individual object I can place anywhere I want. Is this possible and where can I find information like this? Thanks, Joe
  9. Still very new to PHP but I'm beginning to appreciate everything it can do. I found an application called Sphider, I'm sure all of you have heard of it, and it's seems to be working pretty good. The only thing is, I don't want users to have to go to a separate page to search. I have a form embedded on the home page and I want this to be used as the search form. Currently, you can type something into the search form, click search, and then you are taken to the real search, just seems repetitive. Can anyone enlighten me? Thanks, Joe
  10. Very new to PHP and don't really know anything web besides HTML and CSS. I was taking a look at this site: http://htmldog.com/ and saw their menu on the left. There is a heading that says "Tutorials" with a subheading called "HTML Beginner." When I click on "HTML Beginner" I go to another page and get a bunch of subheadings under HTML Beginner. Are they using PHP to do this? I would imagine it would take a long time to go in the code and add a subheading if ever need be. Also, at the top there is a mini navigation system (eg. Home > Tutorials > HTML Beginner Tutorial >). Is this done with PHP? Could anyone point me in the direction of some good beginner tutorials, if this is in fact what I need? Also, how do you tell if parts/all of a page are written in PHP? With HTML I can just click view source and I get everything I need. Thanks for any help you can provide, Joe
  11. Oh jeez, Don't I feel silly now. Thanks for pointing that out. I feel as if I should have noticed that. Thanks, Joe
  12. Hey, Thanks for the help. I tried it both ways but now I'm getting this error Parse error: syntax error, unexpected $end in /home/clean34/public_html/jenningspr/downloads.php on line 33 Line 33 is where the program closes out. I've attached the html, maybe it could be of some help Joe <form method="POST" action="downloads.php"> <table width="719" border="0"> <tr> <td> </td> <td><label> <select name="drop_down" size="1"> <option value="download1" label="download1">Download 1</option> <option value="download2" label="download2">Download 2</option> <option value="download3" label="download3">Download 3</option> <option value="download4" label="download4">Download 4</option> </select> </label></td> </tr> <tr> <td width="131"><div align="right">Your Name:</div></td> <td width="274"><label> <input name="name" type="text" size="40" /> </label></td> </tr> <tr> <td><div align="right">Your Email:</div></td> <td><label> <input name="email" type="text" size="40" /> </label></td> </tr> <tr> <td><div align="right">Your Company:</div></td> <td><label> <input name="company" type="text" size="40"/> </label></td> </tr> <tr> <td></td> <td>How did you hear about us?<br /><br /> <input name="input1" type="radio" />Saw a Speaker<br /> <input name="input2" type="radio" />Googled It<br /> <input name="input3" type="radio" />Heard From a Friend<br /> <input name="input4" type="radio" checked="checked" />Other<br /> </td> </tr> <tr> <td></td> <td><input name="submit" type="submit" value="Submit" /> <input name="input" type="reset" value="Reset" /></td> </tr> </table> </form>
  13. It gives me this error: Parse error: syntax error, unexpected '[' in /home/clean34/public_html/jenningspr/downloads.php on line 17 which is the line the switch statement starts
  14. Hey all, Real new to php here but I'm starting to understand the basics. I've done a little object oriented programming before, but not much. I wrote this small chunk of code but it isn't really working how I expected. The goal here is to collect some information, email it to someone, and then send the user to one of four other pages depending on what their form said. Can you user the header function within a switch like this? Thanks for any help you can provide, Joe <?php if(isset($_POST['submit'])) { $to = "joe@mywebsite.net"; $subject = "Mail from myWebsite.net"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $company = $_POST['company']; $option = $_POST['radio']; $dropdown = $_POST['drop_down']; $body = "New Download Requested\n\n Download: $dropdown\n Name: $name_field\n E-Mail: $email_field\n Company: $company_field\n Heard about Us: $option"; mail($to, $subject, $body); switch($dropdown) { case [download1]: header( "Location: http://www.mywebsite.net/download1.html" ); break; case [download2]: header( "Location: http://www.mywebsite.net/downlaod2.html" ); break; case [download3]: header( "Location: http://www.mywebsite.net/download3.html" ); break; case [download4]: header( "Location: http://www.mywebsite.net/download4.html" ); break; } ?>
  15. Anyone know of a good free database driven PHP weekly calendar? Something similar to this one: http://www.criticalresources.org/calendar2 Something with a good user interface that someone without knowledge of the language could update easily. Thanks for any help, Joe
×
×
  • 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.