Jump to content

bukwus

Members
  • Posts

    44
  • Joined

  • Last visited

bukwus's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. bukwus

    Number formatting

    Awesome. Thank you.
  2. bukwus

    Number formatting

    More specifically, can I check to see if a number has commas and, if so, remove the commas?
  3. bukwus

    Number formatting

    HiRegarding the number_format() function, is there a way to check, perhaps with an "if else" statement, if the value of a variable which is a number string is formatted? Also, is there a function that strips a number's formatting?Thanks
  4. bukwus

    Form not working

    THANK YOU! Works like a charm.
  5. bukwus

    Form not working

    Hello I'm experimenting with PHP forms and am having trouble getting the form to recognize whether a field has been entered or not. I can't figure out where I'm going wrong. Here's the form, file name register_program.html: <?php$problem = $_SESSION['problem'];?><form id="regProg" action="verify.php" method="POST"> <?php if ($problem == 2) { echo '<p style="color:red;">Please fill in the form below</p>'; } elseIf ($problem == 1) { echo '<p>Thank you for filling in the form.</p>'; } ?> First Name: <input type="text" name="firstName" id="firstName" value="<?php echo $_SESSION['firstName']; ?>" size="40" maxlength="100" /><br /> <input type="submit" name="submit" value="Submit" /> <input type="submit" name="reset" value="Reset" /></form> And here's the PHP, file name verify.php: <?phpsession_start(); if (isset($_POST['reset'])) { session_destroy();}else { $_SESSION['firstName'] = $_POST['firstName']; if (isset($_POST['firstName'])) { $_SESSION['problem'] = 1; $to = "myemail@host.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "Me"; $headers = "From:" . $_POST['firstName']; mail($to,$subject,$message,$headers); } else { $_SESSION['problem'] = 2; }} header('Location: register_program.html');?> Many thanks,Andy
  6. Never mind. I solved it with "overflow:hidden" in the footer DIV.
  7. I have a DIV that spans 100% across the screen with a specific background color. Inside is a nested DIV that confines the width and has auto margins. Inside that DIV I have two DIVs that are meant to float left and right, but when I float them it cancels the background color of the grandparent DIV. Any reason this is happening?Many thanks,Andy HTML <div id="footer"> <div id="containerFooter"> <div id="address"> Island Shakespeare Festival<br /> PO Box 1262<br /> Langly, Whidbey Island, WA 98260 </div> <div id="footerMenu"> <span><a href="">Shows & Tickets</a></span> <span><a href="">Support</a></span> <span><a href="">Plan Your Visit</a></span> <span><a href="">Sponsors</a></span> <span><a href="">About</a></span> <span style="margin-right:0px"><a href="">Contact</a></span> </div> </div> </div> CSS #footer { width:100%; background-color:#496781; margin:2% 0% 0% 0%; }#containerFooter { width:950px; margin:auto; }#address { float:left; font-size:.9em; color:white; }#footerMenu { float:right; }#footerMenu SPAN { color:white; font-size:.9em; margin-right:2%; }#footerMenu SPAN A { color:white; text-decoration:none; }#footerMenu SPAN A:HOVER { text-decoration:underline; }
  8. HelloLet's say I wanted to generate a random number from 1 to 10. Then I want to do it again, only remove the previously generated number from the range. How would I go about this?Many thanks
  9. HiI'm using PHP to check if a form was filled out correctly, or at all. I have questions and three answers in the form of radio buttons.I'm using "if empty" to check if a question wasn't answered but it's not doing the trick: for ($i = 1; $i <= $numQuestions2; $i++) { if (empty($_POST['radio'.$i])) { $problem = TRUE; $dataSpan2[$i] = '<span style="color:red; font-weight:bold;">'.$questions2[$i].'</span>'; } else { $dataSpan2[$i] = $questions2[$i]; } } How should I be doing this?Many thanks
  10. HiI'm beginning a form that asks questions and has a drop down list of options to choose from. I'm going to use PHP to check for errors, loops to cut down on repetition, etc., but right now I'm just testing code at a basic level.Here's the PHP: if(isset($_POST['submit'])){ $value[1] = $_POST['choice1']; $value[2] = $_POST['choice2']; $value[3] = $_POST['choice3']; } else { $value[1] = 'Choose one...'; $value[2] = 'Choose one...'; $value[3] = 'Choose one...'; } Here's the basic form element: <select name="choice1"> <option value="0">'.$value[1].'</option> <option value="Addressed">Addressed</option> <option value="Does not apply">Does not apply</option> <option value="Needs attention">Needs attention</option> </select> My problem is that the text displayed in the select box is only the first letter of whatever it's supposed to be. For example: if it's the first time visiting the form, each box only has "C" in it instead of "Choose one..." OR if "Does not apply" was chosen and the form is submitted, "D" is all that shows up in that box.Any idea what's happening here?Many thanks,Andy
  11. I'm probably misunderstanding you, but do you mean something like this? I tested it and it just returns the literal value of $email_body. Am I just doing it wrong?for ($i = 1; $i <= $numQuestions; $i++) { $email_body = '.$question['.$i.']."\n" .$_POST[\'data\''.$i.']."\n"'; }
  12. HiI've built a form so that the questions generate automatically. I set the number of questions into $numQuestions, I put the questions in an array called $questions, then used a typical for loop to create the questions in an HTML table. for ($i = 1; $i <= $numQuestions; $i++) { echo '<tr> <td align="left" valign="top" border="0"> <p>'.$questions[$i].'</p> <textarea rows="5" cols="53" id="data'.$i.'" name="data'.$i.'">'.$_POST['data'.$i].'</textarea> </td> </tr>'; } It works fine. The purpose of this is because I'm building many forms with similar structure, but different questions and this saves a great deal of time.Here's where I'm getting stumped:When a user fills out the form and submits it, the results are sent to us as well as to their email address. I need to create a similar for loop that can generate the questions and the user's answers in the form email that is sent. The body of the email is the value of the $email_body variable.So, is there a way to assign the output of a for loop to the value of a variable?Many thanks,Andy
  13. Okay. Given that my checkboxes now look like this<input type="checkbox" name="category[]" value="Accounting" />and I've figured how to check if none are checked and how to carry over checked boxes, how do I now include the categories that were checked in the email that is sent as a result of correctly filling out the form?Here is the code that handles the content of the email. I've placed ??? in the place that I'm having trouble with: $to = 'email@company.org'; $email_subject = 'ExpertNet Aplicant'; $email_body = "Name: ".$_POST['firstName'] . $_POST['lastName']."\n Title: ".$_POST['title']."\n Email: ".$_POST['email']."\n Company: ".$_POST['company']."\n Company Description: ".$_POST['description']."\n Address: ".$_POST['address1']."\n Address: ".$_POST['address2']."\n City: ".$_POST['city']."\n State: ".$_POST['state']."\n Zip Code: ".$_POST['zip']."\n Phone#: ".$_POST['phone']."\n Fax#: ".$_POST['fax']."\n Web Address: ".$_POST['web']."\n Categories Chosen: "[u][b]???[/b][/u]" \n Other: ".$_POST['other']; $headers = "From:" .$_POST['email']; //Place variables in mail funciton mail($to, $email_subject, $email_body, $headers); Many thanks,Andy
  14. HiI'm using checkboxes in a form and have a few questions. Here is an example of the checkbox code in the HTML form: <input type="checkbox" name="category" value="Accounting" /> Accounting<br /><input type="checkbox" name="category" value="Administration" /> Administration<br /> The PHP file I wrote to handle the form data checks to see if required info was not included and displays the form again asking for the required info. Any info that was entered in the form is carried over:1. How do I check to see if none of the category boxes were checked?2. If a box is checked, how do I make sure it remains checked when the form is re-displayed due to a required field not being filled?3. How do I code it so that when the form is filled out correctly and an email with the info is sent, the checked categories are included in that email?Many thanks,Andy
  15. HiI've set my company's site up with Google Analytics and have a couple questions.My boss has been using Webalizer and AWStats as his analytics tools. These tools are counting an average of about 3000 visits/day. So far, Google has only counted around 400 visits/day. Would anyone happen to know how this could be?Secondly, we have pages on our site with links to sponsor sites. Is Google Analytics capable of counting when visitors click these links and which links are clicked?Many thanks.
×
×
  • Create New...