Jump to content

TwiztedCupid

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by TwiztedCupid

  1. Not 100% on this one but you can try... $endings = array("\n--\n==================================================================\nthis mobile text message is brought to you by at&t", "blue", "green"); $replace_text= "\n--\n==================================================================\nthis mobile text message is brought to you by at&t"; $replacement = ""; for($i=0;$i<count($endings);$i++) { if($endings[$i] == $replace_text) { $endings[$i] = $replacement; } } print_r($endings); This will find that text and remove it where ever it is in your array. It will however leave a blank spot in your array. I added "blue" and "green" to show what would happen if you added more stuff to the array. OUTPUT: Array ( [0] => [1] => blue [2] => green ) Or you can try..... $endings = array("\n--\n==================================================================\nthis mobile text message is brought to you by at&t", "blue" , "green"); unset($endings[0]); print_r($endings); This will remove the first entry in the array. If your red text is always in that position then this should also work. OUTPUT: Array ( [1] => blue [2] => green )
  2. Another noob question here. I've got a form that I use to collect info for an estimate. I also am using Developer toolbox from Adobe. Makes my life a lot easier, but doesn't teach you anything. lol Originally I had a drop down box that would hold the value of selected item and post it into to emailTO field. Which worked just fine. Example: //This is my array. $emails_array = array( 'Landscape Maintenance'=>'me@you.com', 'Landscape Design'=>'me@me.com', 'Planting Renovation'=>'me@me.com', 'Tree Service'=>'me@me.com', 'Weed Man Lawn Fertilization'=>'me@me.com', 'Snowplowing'=>'me@me.com', 'Other'=>'me@me.com'); //This grabs the post of the drop down box and inserts the email addy. $emailObj->setTo($emails_array[$_POST['Services']]); Now I have to change the drop down box to a check box group. In which the user can select multiple services and have multiple email sent out if necessary. This is where I'm stuck. I need to get the post values compare the results to the key in $emails_array then spit out the email associated with it. Here's what I got so far. $postresult = $_POST['services']; echo 'Postresult: ' . "$postresult" . "<br />"; $myarray = explode(",", $postresult); echo 'Dirty Array: '; print_r($myarray); Here are the results Postresult: Landscape Maintenance,Tree Service,Snowplowing<br> MyArray: Array ( [0] => Landscape Maintenance [1] => Tree Service [2] => Snowplowing ) How do I take either $postresult OR $myarray and compare it to $emails_array and get the unique email values for it? I want to maintain the original $postreault so i can insert it into a mysql db. Here is the code Developer toolbox produces for the checkbox group. <form method="post"> <label> <input type="submit" name="Submit" id="Submit" value="Submit"> <input name="services" id="services" wdg:recordset="Recordset1" wdg:subtype="CommaCheckboxes" wdg:type="widget" wdg:displayfield="service" wdg:valuefield="service" wdg:groupby="2" style="display: none; "><span><table cellpading="0" cellspacing="0" border="0"><tbody><tr><td><label id="services_label0" htmlfor="services_commacheckbox0" for="services_commacheckbox0"><input type="checkbox" id="services_commacheckbox0" value="Landscape Maintenance" cbFor="services">Landscape Maintenance</label></td><td><label id="services_label1" htmlfor="services_commacheckbox1" for="services_commacheckbox1"><input type="checkbox" id="services_commacheckbox1" value="Landscape Design" cbFor="services">Landscape Design</label></td></tr><tr><td><label id="services_label2" htmlfor="services_commacheckbox2" for="services_commacheckbox2"><input type="checkbox" id="services_commacheckbox2" value="Planting Renovation" cbFor="services">Planting Renovation</label></td><td><label id="services_label3" htmlfor="services_commacheckbox3" for="services_commacheckbox3"><input type="checkbox" id="services_commacheckbox3" value="Tree Service" cbFor="services">Tree Service</label></td></tr><tr><td><label id="services_label4" htmlfor="services_commacheckbox4" for="services_commacheckbox4"><input type="checkbox" id="services_commacheckbox4" value="Weed Man Lawn Fertilization" cbFor="services">Weed Man Lawn Fertilization</label></td><td><label id="services_label5" htmlfor="services_commacheckbox5" for="services_commacheckbox5"><input type="checkbox" id="services_commacheckbox5" value="Snowplowing" cbFor="services">Snowplowing</label></td></tr><tr><td><label id="services_label6" htmlfor="services_commacheckbox6" for="services_commacheckbox6"><input type="checkbox" id="services_commacheckbox6" value="Other" cbFor="services">Other</label></td><td colspan="2"> </td></tr></tbody></table></span> </label> </form> I would appreciate any help on this. thank you.
  3. Hi. I want to send an email to a specific person based on the selection made in a drop down list. I'm using Dreamweaver CS4 and Adobe Developer Toolbox for the existing code. Here is some of my code. This first part is where it sends the mail. I need to use the variable in the "setTo" line. I know if I use {Services} it will send it to the values selected in drop down. i.e. Tree@yahoo-inc.com; Service@yahoo-inc.com. function Trigger_SendEmail(&$tNG) { $emailObj = new tNG_Email($tNG); $emailObj->setFrom("webmaster@somewhere.com"); $emailObj->setTo("VARIABLE HAS TO GO HERE"); $emailObj->setCC("me@you.com"); $emailObj->setBCC(""); Here is the code for the select: <select name="Services" id="Services"> <option value="" <?php if (!(strcmp("", KT_escapeAttribute($row_rsestimate['Services'])))) {echo "selected=\"selected\"";} ?>>Select a service...</option> <option value="Landscape Maintenance" <?php if (!(strcmp("Landscape Maintenance", KT_escapeAttribute($row_rsestimate['Services'])))) {echo "selected=\"selected\"";} ?>>Landscape Maintenance</option> <option value="Landscape Design" <?php if (!(strcmp("Landscape Design", KT_escapeAttribute($row_rsestimate['Services'])))) {echo "selected=\"selected\"";} ?>>Landscape Design</option> <option value="Planting Renovation" <?php if (!(strcmp("Planting Renovation", KT_escapeAttribute($row_rsestimate['Services'])))) {echo "selected=\"selected\"";} ?>>Planting Renovation</option> <option value="Tree Service" <?php if (!(strcmp("Tree Service", KT_escapeAttribute($row_rsestimate['Services'])))) {echo "selected=\"selected\"";} ?>>Tree Service</option> <option value="Snowplowing" <?php if (!(strcmp("Snowplowing", KT_escapeAttribute($row_rsestimate['Services'])))) {echo "selected=\"selected\"";} ?>>Snowplowing</option> <option value="Other" <?php if (!(strcmp("Other", KT_escapeAttribute($row_rsestimate['Services'])))) {echo "selected=\"selected\"";} ?>>Other</option> </select> Is there a way if the user selects "Landscape Maintenance" or "Landscape Design" the email will go to "user1@somewhere.com". If they select "Tree Service" it will go to "user2@somewhere.com"? Something like: If Services = "Landscape Design" Or "Landscape Maintenance" Then $toEmail = "user1@somewhere.com" Else If Services = "Tree Service" Then $toEmail = "user2@somewhere.com"......and so on. Then place $toEmail into "$emailObj->setTo("$toEmail");"?
  4. Thank you for the help. First of all the /a is there for part of my pregmatch code. Second of all THANK YOU!! I had to change the count to $count =2; for it to display exactly how I wanted it to. Here's the whole code. $count = 1; echo "<table><tr><td>"; foreach ($matches as $match){ $rank = "$match[1]. $match[2]"; if ($count <= 5) { echo ($rank . "</a><br />"); // Don't know what you're doing with the /a in there. $count = $count+1; } else { echo ("</TD><TD>".$rank . "</a><br />"); $count = 2; } } echo "</tr></table>" But everything works just fine.
  5. I'm still learning PHP and need some help. I have a code that reads a page for a top 20 ranking type thing. The code works great but now I'm trying to build a table with it. Once it reads 5 names, I want it to start an new cell. Here's what I have so far. $count = 1; echo "<table><tr><td>"; foreach ($matches as $match){ $rank = "$match[1]. $match[2]"; if ($count <= 5) { echo ($rank . "</a><br />"); $count = $count+1; } } echo "<td>"; echo "</tr></table>" It does exactly what it's supposed to, so far. The problem is, once it reads the first or any other group of 5 names, I need it to insert <td> and and then continue with the next group of 5 names. If I was to write it out normal, this would be my results. <table> <tr> <td>1<br> 2<br> 3<br> 4<br> 5</td> <td>6<br> 7<br> 8<br> 9<br> 10</td> <td>11<br> 12<br> 13<br> 14<br> 15</td> <td>16<br> 17<br> 18<br> 19<br> 20</td> </tr> </table> Thanks in advance.
  6. Hello. I was trying to figure out how to get a "Thank you" type message to appear on the same page as the form, after a user clicks submit. Right now when form is submitted it returns back to same page. I'm using Dreamweaver and Adobe Developer Toolbox, formerly known as MX Kollection. (Yeah I know this is cheating, but I'm a newb and it's way beyond easy for me to use). Here is my form code. <?php echo $tNGs->getErrorMsg(); ?> <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>"> <table cellpadding="2" cellspacing="0" class="KT_tngtable"> <tr> <td class="KT_th"><label for="name">Name:</label></td> <td><input name="name" type="text" class="myform" id="name" value="<?php echo KT_escapeAttribute($row_rscomments['name']); ?>" size="32" /> <?php echo $tNGs->displayFieldError("comments", "name"); ?> </td> </tr> <tr> <td class="KT_th"><label for="email">Email:</label></td> <td><input name="email" type="text" class="myform" id="email" value="<?php echo KT_escapeAttribute($row_rscomments['email']); ?>" size="32" /> <?php echo $tNGs->displayFieldError("comments", "email"); ?> </td> </tr> <tr> <td class="KT_th"><label for="comments">Comments:</label></td> <td><textarea name="comments" cols="50" rows="5" class="myform" id="comments" style="height:100px"><?php echo KT_escapeAttribute($row_rscomments['comments']); ?></textarea> <?php echo $tNGs->displayFieldError("comments", "comments"); ?> </td> </tr> <tr> <td colspan="2"><input name="Reset" type="reset" class="button" id="button" value="Reset" style="margin-left:130px; margin-right:30px"> <input name="KT_Insert1" type="submit" class="button" id="KT_Insert1" value="Submit" style=""></td> </tr> </table> </form> I read somewhere that you can add a hidden field with a value of "contactus.php?submitted", and then call it with a function, or something? I'm guessing I would have to do some kind of "if url=contactus.php?submitted - echo thank you - else do nothing". But I'm not sure how to integrate this as easily as possible and not have to mess with the MX kollection's code. Any help would be appreciated. Thanks in advance. P.S. If it wasn't for us newbs you experts wouldn't have anything to laugh at.
  7. Hello, Yes I'm pretty much a n00b when it comes to PHP and Apache. I have the server all setup, php installed, PHP modules all setup in httpd.conf. I can run .php files with no problem. The one thing I'm not getting to work is [code]<?php phpinfo();?>[/code] It works when I save the file as test.php, but not when I save it as test.html, or test.htm. It just shows up as a blank page. I viewed the source and the code is still there. When I upload either htm file to another server, the phpinfo function works fine. I need to know if there's something in Apache or PHP that I have to configure to let this run properly on my machine. I'm using Apache 2.2.3 and PHP 5.2.
  8. Hello, Yes I'm pretty much a n00b when it comes to PHP and Apache. I have the server all setup, php installed, PHP modules all setup in httpd.conf. I can run .php files with no problem. The one thing I'm not getting to work is [code]<?php phpinfo();?>[/code] It works when I save the file as test.php, but not when I save it as test.html, or test.htm. It just shows up as a blank page. I viewed the source and the code is still there. When I upload either htm file to another server, the phpinfo function works fine. I need to know if there's something in Apache or PHP that I have to configure to let this run properly on my machine. I'm using Apache 2.2.3 and PHP 5.2.
×
×
  • 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.