Jump to content

Search the Community

Showing results for tags 'form'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. So a friend and I have recently started coding a simple posting webpage. At the moment we are trying to make a like button to like other posts but we are having trouble. We have made this like button and it works kind of right, the only problem is that when we click it, it adds a like to all the posts not just the one we click. Since we are trying to make a very simple page for now, we would like to keep the amount of files to a minimum and so we can not, nor would we like to, use the facebook like button. We are using Wamp, I don't think that would be relevant just like to add it in there. connection.php wall.php
  2. Hello, I've been having some troubles in form submitting with HTML and PHP dynamic pages. In this case, the link to register at my site is index.php?p=r Inside this link, I have a form where the user fills and then have a button to submit it: <form class="form-horizontal margin-none" id="registerform" method="_GET" autocomplete="on" action="index.php?p=r"> <!-- Widget --> <div class="widget widget-heading-simple widget-body-gray"> <div class="widget-body"> <h4>Personal Details</h4> <!-- Row --> <div class="row-fluid"> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="firstname">First name</label> <div class="controls"><input class="span12" id="firstname" name="firstname" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="lastname">Last name</label> <div class="controls"><input class="span12" id="lastname" name="lastname" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="email">E-mail</label> <div class="controls"><input class="span12" id="email" name="email" type="email" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="username">Username</label> <div class="controls"><input class="span12" id="username" name="username" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="password">Password</label> <div class="controls"><input class="span12" id="password" name="password" type="password" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="confirm_password">Confirm password</label> <div class="controls"><input class="span12" id="confirm_password" name="confirm_password" type="password" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <h4>Billing Details</h4> <!-- Row --> <!-- Alert --> <div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">x</button> <strong>Why we need your billing details?</strong> We need your billing details because as a seller/buyer, we need to know where to send the cards. So insert that data carefully, otherwhise can happen shipment mistakes. </div> <!-- // Alert END --> <div class="row-fluid"> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="address">Address</label> <div class="controls"><input class="span12" id="address" name="address" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="zipcode">Zip Code</label> <div class="controls"><input class="span12" id="zipcode" name="zipcode" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="city">City</label> <div class="controls"><input class="span12" id="city" name="city" type="text" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> <!-- Column --> <div class="span6"> <!-- Group --> <div class="control-group"> <label class="control-label" for="State">State</label> <div class="controls"><input class="span12" id="state" name="state" type="text" /></div> </div> <!-- // Group END --> <!-- Group --> <div class="control-group"> <label class="control-label" for="confirm_password">Country</label> <div class="controls"><input class="span12" id="confirm_password" name="confirm_password" type="text" /></div> </div> <!-- // Group END --> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <!-- Row --> <div class="row-fluid uniformjs"> <!-- Column --> <div class="span4"> <h4 style="margin-bottom: 10px;">Policy & Newsletter</h4> <label class="checkbox" for="agree"> <input type="checkbox" class="checkbox" id="agree" name="agree" /> I agree with <a href="#TOS" data-toggle="modal">Terms of Services</a> </label> <label class="checkbox" for="newsletter"> <input type="checkbox" class="checkbox" id="newsletter" name="newsletter" checked="true"/> Receive Newsletter </label> </div> <!-- // Column END --> </div> <!-- // Row END --> <hr class="separator" /> <!-- Form actions --> <div class="form-actions" align="right"> <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Register</button> </div> <!-- // Form actions END --> </div> </div> <!-- // Widget END --> </form> <!-- // Form END --> The problems keeps in this part of code: <!-- Form actions --> <div class="form-actions" align="right"> <button type="submit" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Register</button> </div> <!-- // Form actions END --> When I click the Register Button, it redirects me to index.php?username......password.... Instead of reloading in the same page (index.php?p=r&username=.... ) I would like too the browser link doesn't show that data ( username, password ). Already tried to change the method to POST but it doesn't work. Can anyone help me please?
  3. Hi! I read that for security reasons, the ideal is that the form data is validated two times ever. The first on the client side with javascript code and a second time on the server side with PHP code. The validation with javascript I have (almost) ready. However, I'm having problems with PHP validation ... <html> <head> <title>Formulario</title> <script type="text/javascript"> function frmRegisterValidate (){ var frmRegisterError = document.getElementById("frmRegisterError"); var frmRegisterUN = document.getElementById("frmRegisterUN").value; var frmRegisterPW = document.getElementById("frmRegisterPW").value; if (frmRegisterUN == "") { frmRegisterError.value = "Type your username"; return false; } else if (frmRegisterPW == "") { frmRegisterError.value = "Type your password"; return false; } document.getElementById("frmRegister").submit(); } </script> </head> <body> <form method="post" action="frmRegister.php" id="frmRegister" name="frmRegister" accept-charset="utf-8"> <label>Nombre de usuario: </label> <input type="text" id="frmRegisterUN" value="" name="frmRegisterUN" /> <br /> <label>Informe una contrasena: </label> <input type="text" value="" id="frmRegisterPW" name="frmRegisterPW"> <br /> <label>Se encontro un error: </label> <input type="text" value="" id="frmRegisterError" name="frmRegisterError"/> <br /> <input type="button" value="REGISTER" id="frmRegister_Button" onClick="frmRegisterValidate ()"/> </form> </body> </html> <?php if (!empty ($_POST['frmRegisterUN'])) { $frmRegisterUN = $_POST['frmRegisterUN']; } else { $frmRegisterUN = NULL; echo "Type your username <br />"; } if (!empty ($_POST['frmRegisterPW'])) { $frmRegisterPW = $_POST['frmRegisterPW']; } else { $frmRegisterPW = NULL; echo "Type your password <br />"; } ?> This is a very simplified version of the form that I am developing. As you can see, I can do data validation in both javascript and PHP ... My question is: with the PHP code, how should I do so that the error message is displayed in the value of the input called frmRegisterError equal to that done with javascript?
  4. Hello, it's my first time in this forum, I hope somebody could help me with my bug I have an extended class called 'Show' from 'Database' has a method called 'get_time'.. and it could be with arguments 'm' for minutes or 'h' for hours the class works as expected in any empty file.php but causes problem with the form here's the method class Show extends Database { //other methods above here public static function get_time ($arg=null) { $days = self::retreive_days(); // $days is supposed to retreive this string "dai-3:20 sun-1:30 tue-5:1 wed-1:3" $weekDays = array( 'dai', 'sat', 'sun', 'mon', 'tue', 'wed', 'thu', 'fri' ); foreach ($days as $key => $value) { $dayz[] = substr($days[$key], 0, 3); } $random_num = 0; foreach ($weekDays as $key => $value) { $myTime[$key] = null; foreach ($dayz as $key2 => $value) { if ($weekDays[$key] == $dayz[$key2]) { $myTime[$key] = substr( $days[$random_num], 4, strlen($days[$random_num]) ); $random_num++; } } } if ($arg=='m') { foreach ($myTime as $key => $value) { $seperator = strpos($myTime[$key], ':'); $results[] = substr($myTime[$key], $seperator+1, strlen($myTime[$key])); } return $results; } elseif ($arg=='h') { foreach ($myTime as $key => $value) { $seperator = strpos($myTime[$key], ':'); $results[] = substr($myTime[$key], 0, $seperator); } return $results; } else { return $myTime; } } } my problem is when I call the call it hides part of the form without even show me any php errors here's snapshot for the normal and after calling the calls.. notice the end of v-scroll
  5. I'll admit it upfront: I am a total noob to this, so please bare with me. I'm trying to create a simple PHP program with an HTML form to submit an input into PHP which then echos back the user's input but I keep getting an "Object not found!" error when I push the submission button on the page. If you could please tell me what I'm doing wrong, I would really appreciate it. My code is: <form action="index.php" method="post"> <input type="text" name="user_input" size="20"> <input type="submit" name="press" value="Press da button!"> </form> <?php if (isset($_POST['user_input'])) { $post= $_POST['user_input']; echo "You posted $post ."; } ?> Again, thanks a ton.
  6. my session value automatically changes, when i submit my form . actually i am using ajax in one of the fields in form. and when i submitthe form, my session value changes automatically to some random value. please suggest me, wat should i do??? do i use some other code instead of ajax for that field? or .... something else...???
  7. Hi, I don't know how create Form Select with the characteristics presented in the image attached. The "Search" is for search the options in the first window, and we choose the options we want pushing the sum symbol button for the other window (right). How I do?
  8. Hi! I need help! No other forum is helping me and it's a bit urgent. I have searched all over the internet and tried over 30 different codes but I can't get this to work. Im very new to php and that probably why. What I want help with: 1. I want my form to be validated server side. When the name or message field is left empty a errormessage(please fill in name, please fill in message) should be shown above the form on the SAME page without reloading or redirecting. 2. Check so that the email entered in the email field is a valid email and not just filled out. 3. If everything is filled out correctly the form should be sent and a message is displayed above the form just like the error-messages for the fields. Php: <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $recipient = "info@mydomain.com"; $subject = "Via Webbkontakt"; $formcontent = "Namn: $name <br/> Email: $email <br/> Telefon: $phone <br/><br/> Meddelande:<br/><br/> $message"; $headers = "From: " ."MyDomain<info@mydomain.com>" . "\r\n"; $headers .= "Reply-To: ". "$email" . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=utf-8\r\n"; if(@mail($recipient, $subject, $formcontent, $headers)) { echo "successful"; } else { echo "error"; } ?> Html: <form class="form" id="contactus" action="php/mail.php" method="post" accept-charset="UTF-8"> <label for="nametag">Namn<FONT COLOR="#FF0060">*</FONT></label> <input name="name" value="" type="text" id="name"> <label for="emailtag">Email<FONT COLOR="#FF0060">*</FONT></label> <input name="email" value="" type="text" id="email"> <label for="phonetag">Telefon</label> <input name="phone" type="text" id="phone" value="" /> <label for="messagetag">Meddelande<FONT COLOR="#FF0060">*</FONT></label> <textarea name="message" id="message" value="" style="width: 87%; height: 200px;"></textarea> <label class="placeholder"> </label> <button class="submit" name="submit">Skicka</button> </form>
  9. I am creating a clothing website and say for a color on the sidebar I want to be able to submit a form with 'onClick' that will refresh the page, which it already does but to keep the checkbox checked when doing so. Right now my code submits properly refreshing the page and displaying the right products but the check in the checkbox is gone. I need the check to stay. Here is my code $sidebar_color .= '<div id="sidebar"> <label><form action="?" method="REQUEST"> <input type="checkbox" name="color" value="'.$color.'" onClick="submit();" /> <font size="-2"> <a href="?color='.$color.'">'.$color.' ('.$row["COUNT(color)"].')</a> </font></form></label></div>'; Another problem is when the 'onClick="submit();"' refreshes the page and then I press back the checkbox is checked. I need it to be unchecked when I press back. Is this also possible? I have been at this for days and tried too many things to remember what I tried. I figure I need something like this if(isset($_REQUEST["color"])) echo "checked="checked"" but nothing seems to work for me. Anyone have any ideas how to fix the code?
  10. Hi, I have set up a number of pages with a vote poll on them, I need the page to refresh when the submit button is pressed, the php code is: I have tried doing it without the window.location.reload() but it makes not difference echo '<td width="330" valign="top"> <div class="vpolls" id="vp_1"> <div class="vpdt"></div> <span class="h5">Do you agree with this new system of collecting Council Tax? </span> <form action="http://www.tckennedy.co.uk/vpoll/vpoll.php" id="vpf1" method="post" onsubmit="return votePoll(this);window.location.reload();"> <input type="hidden" name="idp" value="1" /> <label for="p1i0"><input type="radio" name="item" value="Yes" id="p1i0" />Yes</label> <label for="p1i1"><input type="radio" name="item" value="No" id="p1i1" />No</label> <label for="p1i2"><input type="radio" name="item" value="Undecided" id="p1i2" /> Undecided</label> <input type="submit" value="Vote" name="sbm" /> <br> <p><span class="p5">Please note that only one vote per person is now permitted for each poll</span></p> </form> </div></td>'; echo '<td width="10"><p> </p></td>'; echo '<td width="330" valign="top">'; include('vpoll/vpoll.php'); echo '<div class="vpolls">'. $obVot->showPoll(1) .'</div>'; echo '</td>'; echo '<td width="290"></td>'; echo '</tr>'; echo '</table>'; ?> The website is tckennedy.co.uk where you can see what is happening. I need the page to refresh when the vote button is pressed and the results to update. Any help with this would be really gratefully recieved. Thanks
  11. hello everyone, im new here and i need help to complete a job. the thing is: i need a form that pulls data from database and then after the submit button it will save it to another table. the form will have 3 selects that are connected, all of them are filled with a table info. when the first one is choosen the second one will appear and so on. also the form will have to save the text from the selects, not the value: echo ("<option value=\"$row[cod_ano]\ " . ($ano == $row["cod_ano"]? " selected" : "" ) . "> ".$row['nome_ano'] . "</option>"); i need to save the .$row['nome_ano'] but it saves the .$row['cod_ano'], and if i change it the 2nd one doenst work. this is getting my crazy allready... can any1 help??? thanks.
  12. Hi, I have use the below link to make a contact form; http://www.websitecodetutorials.com/cod ... dation.php When I submit the form I get an error '22527'. Cant work out what it is and having searched I can't make sense of other answers mainly because I am only just starting out in PHP. The Form <form method="post" action="bookingform1.php"> <ul> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="First Name" name="firstname" maxlength="25"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Last Name" name="lastname" maxlength="25"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Nationality" name="nationality" maxlength="25"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Date Of Birth" name="dob" maxlength="25"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Gender" name="gender" maxlength="15"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Occupation" name="occupation" maxlength="40"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Home Address" name="address" maxlength="80"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="E-mail Address" name="email" maxlength="80"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Telephone Number" name="telephone" maxlength="25"></input></li> <p id='iyc-bold'>Your preferred choice of programme date</p> <li class="field" id='text_align_left'> <div class="picker" id='iyc-picker-width'> <select name="first"> <option>October 12-19th 2013</option> <option>November 16-23rd 2013</option> <option>January 18-25th 2014</option> <option>February 15-22nd 2014</option> <option>March 15-22nd 2014</option> </select> </div> </li> <p id='iyc-bold'>Your second choice, (should your preferred date be unavailable)</p> <li class="field" id='text_align_left'> <div class="picker" id='iyc-picker-width'> <select name="second"> <option>October 12-19th 2013</option> <option>November 16-23rd 2013</option> <option>January 18-25th 2014</option> <option>February 15-22nd 2014</option> <option>March 15-22nd 2014</option> </select> </div> </li> <p id='iyc-bold'>What experience do you have of the english language (self-taught/lessons/on-line programmes/immersion programmes)</p> <li class='field'><textarea class="input textarea" rows="6" placeholder="Background & experience" name="experience" maxlength="600"></textarea></li> <p id='iyc-bold'>Why do you want to attend the programme? (practice the language/to get a job/promotion/expand career opportunities/social)</p> <li class='field'><textarea class="input textarea" rows="6" placeholder="What do you want to get out?" name="why" maxlength="600"></textarea></li> <p id='iyc-bold'>How did you hear about the A.B.C. Experience Programme?</p> <li class='field'><textarea class="input textarea" rows="6" placeholder="How did you find us?" name="how" maxlength="600"></textarea></li> <p id='iyc-bold'>Additional information (include any dietary or other special needs you may require.)</p> <li class='field'><textarea class="input textarea" rows="6" placeholder="Additional information" name="info" maxlength="600"></textarea></li> <li class="field"><label class="checkbox" for="checkbox1" id='text_align_left'><input name="checkbox1" type="checkbox" id="checkbox1" name="terms" value="0"><span></span> *By ticking this box you accept our terms and conditions as per the below</label></li> <div class="pretty warning danger btn icon-left info-circled" id='iyc-btn'><a href="termsandconditions.pdf" target="_blank">Terms & Conditions</a></div> </ul> <div align="center"> <!-- <h4>For e-mail security purposes please enter in the words above and then click submit below.</h4> --> </div> <div class="pretty medium default btn" style='margin-top:20px;'><input type="submit" value="Submit"></input></div> </form> <?php // Input Your Personal Information Here $mailto = 'oliver@edwardsltd.co.uk' ; $from = "ABC Experience England Website - Participants" ; $formurl = "http://www.dev.abcexperienceengland.co.uk/bookingform1.php" ; $errorurl = "http://www.dev.abcexperienceengland.co.uk/formmailerror.php" ; $thankyouurl = "http://www.dev.abcexperienceengland.co.uk/thankyou.php" ; // End Edit // prevent browser cache header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); function remove_headers($string) { $headers = array( "/to\:/i", "/from\:/i", "/bcc\:/i", "/cc\:/i", "/Content\-Transfer\-Encoding\:/i", "/Content\-Type\:/i", "/Mime\-Version\:/i" ); if (preg_replace($headers, '', $string) == $string) { return $string; } else { die('You think Im spammy? Spammy how? Spammy like a clown, spammy?'); } } $uself = 0; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; if (!isset($_POST['email'])) { header( "Location: $errorurl" ); exit ; } // Input Your Personal Information Here $firstname = remove_headers($_POST['firstname']); $lastname = remove_headers($_POST['lastname']); $nationality = remove_headers($_POST['nationality']); $dob = remove_headers($_POST['dob']); $gender = remove_headers($_POST['gender']); $occupation = remove_headers($_POST['occupation']); $homeaddress = remove_headers($_POST['homeaddress']); $email = remove_headers($_POST['email']); $telephone = remove_headers($_POST['telephone']); $first = remove_headers($_POST['first']); $second = remove_headers($_POST['second']); $experience = remove_headers($_POST['experience']); $why = remove_headers($_POST['why']); $how = remove_headers($_POST['how']); $info = remove_headers($_POST['info']); $terms = remove_headers($_POST['terms']); $http_referrer = getenv( "HTTP_REFERER" ); // End Edit if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i",$email)) { header( "Location: $errorurl" ); exit ; } // Input Your Personal Information Here if (empty($firstname) || empty($lastname) || empty($nationality) || empty($dob) || empty($gender) || empty($occupation) || empty($homeaddress) || empty($email) || empty($telephone) || empty($first) || empty($second) || empty($experience) || empty($why) || empty($how) || empty($info) || empty($terms)) { header( "Location: $errorurl" ); exit ; } // End Edit if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } // sets max amount of characters in comments area (edit as nesesary) if (strlen($comments) > 1250) { $comments=substr($comments, 0, 1250).'...'; } // End Edit $message = "This message was sent from:\n" . "$http_referrer\n\n" . // Input Your Personal Information Here "First Name: $firstname\n\n" . "Last Name: $lastname\n\n" . "Nationality: $nationality\n\n" . "DOB: $dob\n\n" . "Gender: $gender\n\n" . "occupation: $occupation\n\n" . "homeaddress: $homeaddress\n\n" . "E-mail: $email\n\n" . "Telephone: $telephone\n\n" . "first: $first\n\n" . "second: $second\n\n" . "What experience do you have: $experience\n\n" . "Why do you want: $why\n\n" . "How did you hear about us: $how\n\n" . "Other Information: $info\n\n" . "Agree to the terms: $terms\n\n" . "\n\n------------------------------------------------------------\n" ; // End Edit mail($mailto, $from, $message, "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep ); header( "Location: $thankyouurl" ); exit ; ?> http://www.dev.abcexperienceengland.co.uk/ I am using GUMBY as the CSS framework. As mentioned I am a newbie to PHP so apologise in advance for any stupid mistakes. Any help to get this working would be much appreciated. Thanks in advance Olly Edwards
  13. I'm trying to create a field that will validation US phone numbers, and afterwards I will be attempting a field to validate income. So far, for the phone numbers, I have implemented the following regex expression and PHP. The regex has worked in someone elses implementation, however when I utilize it in this implementation it always returns an error that the phone number isn't valid. I'm having a difficult time seeing where the difficulty is: //1. Add a new form element... add_action('register_form','myplugin_register_form2'); function myplugin_register_form2 (){ $phone_number = ( isset( $_POST['phone_number'] ) ) ? $_POST['phone_number']: ''; ?> <p id="phone_number"> <label for="phone_number"><?php _e('Phone Number <font size="1">(XXX XXX XXXX)</font>','mydomain') ?><br /> <input type="text" name="phone_number" id="phone_number" class="input" size="25" style="text-align:right" maxlength="14" /> </p> <?php } //2. Add validation. In this case, we make sure phone_number is required. add_filter('registration_errors', 'myplugin_registration_errors2', 10, 3); function myplugin_registration_errors2 ($errors, $sanitized_user_login, $user_email) { $sPattern = "/^ (?: # Area Code (?: \( # Open Parentheses (?=\d{3}\)) # Lookahead. Only if we have 3 digits and a closing parentheses )? (\d{3}) # 3 Digit area code (?: (?<=\(\d{3}) # Closing Parentheses. Lookbehind. \) # Only if we have an open parentheses and 3 digits )? [\s.\/-]? # Optional Space Delimeter )? (\d{3}) # 3 Digits [\s\.\/-]? # Optional Space Delimeter (\d{4})\s? # 4 Digits and an Optional following Space (?: # Extension (?: # Lets look for some variation of 'extension' (?: (?:e|x|ex|ext)\.? # First, abbreviations, with an optional following period | extension # Now just the whole word ) \s? # Optionsal Following Space ) (?=\d+) # This is the Lookahead. Only accept that previous section IF it's followed by some digits. (\d+) # Now grab the actual digits (the lookahead doesn't grab them) )? # The Extension is Optional $/x"; // /x modifier allows the expanded and commented regex $aNumbers = array( '123-456-7890x123', '123.456.7890x123', '123 456 7890 x123', '(123) 456-7890 x123', '123.456.7890x.123', '123.456.7890 ext. 123', '123.456.7890 extension 123456', '123 456 7890', '123-456-7890ex123', '123.456.7890 ex123', '123 456 7890 ext123', '456-7890', '456 7890', '456 7890 x123', '1234567890', '() 456 7890' ); foreach($aNumbers as $sNumber) { if (!preg_match($sPattern, $phone_number, $aMatches)) { $errors->add( 'phone_number_error', __('<strong>ERROR</strong>: You must include a valid phone number.','mydomain') ); return $errors; } } if ( empty( $_POST['phone_number'] ) ) $errors->add( 'phone_number_error', __('<strong>ERROR</strong>: You must include a valid phone number.','mydomain') ); return $errors; } //3. Finally, save our extra registration user meta. add_action('user_register', 'myplugin_user_register2'); function myplugin_user_register2 ($user_id) { if ( isset( $_POST['phone_number'] ) ) update_user_meta($user_id, 'phone_number', $_POST['phone_number']); }
  14. Hi everyone, this is my first time using php. i have made a basic contact form and hosted it, (http://www.prowinduk.com/contact/index.html) how do i make it so after the form has been sent, it resets the form and shows a message saying "message sent" please can some one help, i am using dreamweaver cs5. sorry if this has been mentioned in the past as i searched all over but could not find a answer. any help/advise would be usehull, thanks below is the text code stuff: <?php $EmailFrom = "online@prowinduk.com"; $EmailTo = "turbine@prowinduk.com"; $Subject = "online form"; $Name = Trim(stripslashes($_POST['name'])); $Email = Trim(stripslashes($_POST['email'])); $Tel = Trim(stripslashes($_POST['tel'])); $Message = Trim(stripslashes($_POST['message'])); $Pcode = Trim(stripslashes($_POST['pcode'])); // validation $validationOK=true; if (!$validationOK) { echo "please check your details"; header("Location: http://prowinduk.com/contact/send_email.php"); exit; } // prepare email body text $Body = ""; $Body .= "Full Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Telephone #: "; $Body .= $Tel; $Body .= "\n"; $Body .= "E-mail: "; $Body .= $Email; $Body .= "\n"; $Body .= "Address: "; $Body .= $Message; $Body .= "\n"; $Body .= "Postcode: "; $Body .= $Pcode; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">"; } ?>
  15. Hi, I'm trying to make some kind of validation for my form but I've tried everything from Javascript to PHP and I can't seem to get it to work? I'll put my javascript code below but I would much rather use PHP as the validator as I don't like using alert boxes. The problem is that it's validating at all and any method that I try it just skips it and carrys on with the registration. For example I put "dd" as my username, email and password and it accepted it. Help would be much appreciated, thanks. The Javascript: <script type="text/javascript"> function validateForm(formElement) { if(formElement.username.length < 5) { alert('Username must be more than 5 characters.'); return false; } if(formElement.email.length < 5) { alert('Email must be more than 5 characters.'); return false; } if(formElement.password.length < { alert('Password should be more than 8 characters.'); return false; } } </script> The Form: <div id="register-section-wrapper"> <div id="inner-register-container"> <form action="" method="post" name="register_form" id="register_form" onsubmit="return validateForm(this);"> <table border="0" id="table-register"> <th colspan="2"> <h1>Register</h1> </th> <tr> <td> <p>Username:</p> </td> <td> <input type="text" name="username" id="username" class="frm-style" required /> </td> </tr> <tr> <td> <p>Email:</p> </td> <td> <input type="text" name="email" id="email" class="frm-style" required /> </td> </tr> <tr> <td> <p>Password:</p> </td> <td> <input type="password" name="password"id="password" class="frm-style" required /> </td> </tr> <tr> <td> <p>Retype Password:</p> </td> <td> <input type="password" name="cpassword" class="frm-style" required /> </td> </tr> <tr> <th colspan="2"> <input class="frm-submit-register" name="register" type="submit" value="Submit" onclick="return validateForm(this.form);" /> <th> </tr> </table> </form> The OLD PHP Validation: <?php $error_msg = ""; if(isset($_POST['register'])) { if(empty($_POST['username'])) { $error_msg = "Please enter your username."; } else { return true; } if($_POST['username'] < 5) { $error_msg = "Username must be more than 5 characters."; } else { return true; } } ?>
  16. I'm trying to get to grips with javascript, while conjuring up a form with suggestions built in; the form has two parts that autofill, the second part (var availableTags) of the script works fine, but the first part (var availableCust) doesn't, can anyone point out where I may have gone wrong? Thanks code: <script> /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// $(function() { var availableCust = [ <?php $sql = "SELECT * FROM `companyuser`.`customerDetails` ORDER BY `customerDetails`.`Account_Name` ASC "; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $value2 = $row['Address1']; $value1 = $row['Account_Name']; echo "'$value1 - $value2',\n"; } echo "'other'\n"; ?> ]; $( '#recipient' ).autocomplete({ source: availableCust }); }); /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// $(function() { var availableTags = [ <?php $sql = "SELECT * FROM `fullstocklist`"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $value4 = $row['Part_Name']; $value3 = $row['company_PartNo']; echo "'$value3 - $value4',\n"; } echo "'other'\n"; ?> ]; $( '#tags1' ).autocomplete({ source: availableTags }); $( '#tags2' ).autocomplete({ source: availableTags }); $( '#tags3' ).autocomplete({ source: availableTags }); $( '#tags4' ).autocomplete({ source: availableTags }); $( '#tags5' ).autocomplete({ source: availableTags }); $( '#tags6' ).autocomplete({ source: availableTags }); $( '#tags7' ).autocomplete({ source: availableTags }); $( '#tags8' ).autocomplete({ source: availableTags }); $( '#tags9' ).autocomplete({ source: availableTags }); $( '#tags10' ).autocomplete({ source: availableTags }); $( '#tags11' ).autocomplete({ source: availableTags }); $( '#tags12' ).autocomplete({ source: availableTags }); }); /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// </script>
  17. Hi there. I have a small problem, i want to use strrpos and i dont want to make a textbox in the browser so i can write what ever word i want to search for and enter it. here is the code. $string = "Dette er en dummy tekst. Den kan bruges til mange forskellige ting.<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam pellentesque faucibus pretium. Duis vehicula lacus vitae lacus adipiscing dignissim. Suspendisse mauris nulla, vehicula id orci semper, iaculis tincidunt nisl. Quisque congue magna eu elit posuere lacinia eu eget neque. Vivamus est sapien, porta at lacinia eget, commodo vitae lectus. Donec non velit at justo viverra suscipit eu quis purus. Integer tempor lacinia turpis, et aliquet est dignissim non. Aenean euismod dignissim turpis id sollicitudin. Phasellus vitae iaculis orci. Phasellus luctus faucibus tortor vitae porta. Proin semper tristique erat. Suspendisse ac fringilla elit, iaculis condimentum leo. Aliquam sit amet massa non dui congue laoreet eget et libero. Integer viverra nisi a justo tempor sollicitudin. Etiam volutpat aliquet malesuada. Ut erat neque, adipiscing sed dictum ut, commodo vel lacus.</p>"; echo '<h1>Strpos test</h1>'; echo ' <form> <input type="text" placeholder="Search" name="textbox" /> <input type="submit" name="searchButton" value="search" /> </form> '; if(isset($_POST['searchButton'])){ $textbox = $_POST['textbox']; }else{ echo 'type word to search '; } echo '<br />Your result is number '; echo strrpos($string, "word"); But i get the error that i have a Undefined variable: textbox in line 29 How can i make it so that what ever i enter in the textbox form will be the word that is searches for heres a link if you don't know what strrpos is. http://www.w3schools.com/php/func_string_strrpos.asp
  18. I need this to only print the little note at the bottom if the user has put in all the information.. Help please.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Assignment2</title> </head> <body> <h3>Personal Information </h3> <?php $chkErrors = FALSE; if(!empty($_POST['fName']) && isset($_POST['fName'])) { } else { echo 'First Name Fieldis empty'; } if(!empty($_POST['lName']) && isset($_POST['lName'])) { } else { echo 'Your last name field is empty'; } if(!empty($_POST['city']) && isset($_POST['city'])) { } else { echo 'Your city field is empty'; } if(!empty($_POST['state']) && isset($_POST['state'])) { } else { echo 'Your state field is empty'; } if(!empty($_POST['zipCode']) && isset($_POST['zipCode'])) { } else { echo 'Your zipcode field is empty'; } { $fName = filter_input(INPUT_POST, "fName"); $lName = filter_input(INPUT_POST, "lName"); $city = filter_input(INPUT_POST, "city"); $state = filter_input(INPUT_POST, "state"); $zipCode = filter_input(INPUT_POST, "zipCode"); } if($chkErrors == FALSE) { echo <<<HERE <h3> Hi there, $fName $lName, <br /> so you live in $city,<br /> in the great state of $state.<br /> I hear the climate around $zipCode is great this time of year. <br /> $fName, I hear that $state has alot to offer as far as recreation goes.<br />I hope that you have a great summer in $city. <br /></h3> HERE; }
  19. could someone look at this and see if they can tell what I am doing wrong? please and thanks <?php $chkerrors = FALSE; if (!filter_has_var(INPUT_POST, "fName"));{ echo " please enter a value "; $ckerrors = TRUE; } if (!filter_has_var(INPUT_POST, "lName"));{ echo " please enter a value "; $ckerrors = TRUE; } if (!filter_has_var(INPUT_POST, "city"));{ echo " please enter a value "; $ckerrors = TRUE; } if (!filter_has_var(INPUT_POST, "state"));{ echo " please enter a value "; $ckerrors = TRUE; } if (!filter_has_var(INPUT_POST, "zipCode"));{ echo " please enter a value "; $ckerrors = TRUE; } $fName = filter_input(INPUT_POST, "fName"); $lName = filter_input(INPUT_POST, "lName"); $city = filter_input(INPUT_POST, "city"); $state = filter_input(INPUT_POST, "state"); $zipCode = filter_input(INPUT_POST, "zipCode"); if($chkerrors == FALSE) { echo <<<HERE <h3> Hi there, $fName $lName, <br /> so you live in $city,<br /> in the great state of $state.<br /> I hear the climate around $zipCode is great this time of year. <br /> $fName, I hear that $state has alot to offer as far as recreation goes.<br />I hope that you have a great summer in $city. <br /></h3> HERE; } ?>
  20. Having just barely got to grips with PHP, I have made a PHP app that can be used to fill out out forms, at the moment it is a step by step process, loading a different function from a PHP file full of functions, loaded one at a time; when filling in an address, it is possible to load an address previously used, this is simply done by reloading the same PHP function with a MySQL lookup, it works great as is, but to make the app work more dynamically, I'd need to allow the user to fill in the whole form in one go. However, to write the whole form in one go I'd need to load this address into a possibly half completed form... As far as I can tell this isn't something suited to PHP, I believe JavaScript is the way to go; however I have never worked with JavaScript before, I was hoping someone could point me toward some tutorials and some relevant sample code for me to read through. Thanks!
  21. Hello everyone! This is my first post here! I was hoping I could get some help! I'm trying to create an age gate form and I'm running into a problem. The index page that I created actually works fine, but when I create the form and set up the php code the form is not interacting with the data beyond the action. I really don't understand what's going on here. I have a verify.php page that has a form on it and the php that should interact with it is at the top like so: <?php session_start(); if(isset($_POST['submit'])) { $remember = $_REQUEST ['remember']; $day = $_POST ['day']; $month = $_POST ['month']; $year = $_POST ['year']; $country = $_POST ['country']; $birthday = mktime(0,0,0,$month,$day,$year); $difference = time() - $birthday; $age = floor($difference / 31556926); echo $age; if($age >= 21) { $_SESSION ['verifyok'] = 1; header ("location: index.php"); } else { $_SESSION ['verifyfail'] = 0; header("loaction: http://www.centurycouncil.org/"); } if($remember == 'save') { setcookie("verifyok", 1,mktime(0,0,0,01,01,date("Y")+30)); $_SESSION['verified'] = 1; header("location: index.php"); exit(0); } } ?> And here I have the form that does not interact with the php and has the action as verify.php, the test server works and the php at the top of my index.php does redirect me to the verify page, but the verify page just isn't working. <form action="verify.php" method="POST"> <span class="heading">ENTER YOUR BIRTH DATE</span> <div id="dob"> <select name="day" class="styled" /> <option selected="selected" disabled="disabled">DD</option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select> <select name="month" class="styled" /> <option selected="selected" disabled="disabled">MM</option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> </select> <select name="year" class="styled" /> <option selected="selected" disabled="disabled">YYYY</option> <option>2013</option> <option>2012</option> <option>2011</option> <option>2010</option> <option>2009</option> <option>2008</option> <option>2007</option> <option>2006</option> <option>2005</option> <option>2004</option> <option>2003</option> <option>2002</option> <option>2001</option> <option>2000</option> <option>1999</option> <option>1998</option> <option>1997</option> <option>1996</option> <option>1995</option> <option>1994</option> <option>1993</option> <option>1992</option> <option>1991</option> <option>1990</option> <option>1989</option> <option>1988</option> <option>1987</option> <option>1986</option> <option>1985</option> <option>1984</option> <option>1983</option> <option>1982</option> <option>1981</option> <option>1980</option> <option>1979</option> <option>1978</option> <option>1977</option> <option>1976</option> <option>1975</option> <option>1974</option> <option>1973</option> <option>1972</option> <option>1971</option> <option>1970</option> <option>1969</option> <option>1968</option> <option>1967</option> <option>1966</option> <option>1965</option> <option>1964</option> <option>1963</option> <option>1962</option> <option>1961</option> <option>1960</option> <option>1959</option> <option>1958</option> <option>1957</option> <option>1956</option> <option>1955</option> <option>1954</option> <option>1953</option> <option>1952</option> <option>1951</option> <option>1950</option> </select> </div> <span class="heading" id="heading2">ENTER YOUR LOCATION</span> <div id="location"> <select name="country" class="styled" id="country" /> <option>USA</option> </select> </div> <div id="cookie"> <div id="box"><input type="checkbox" name="remember" value="save" class="styled" /></div><span id="notice"><b>Remember Me</b><br> <i>Do not check this box if you use a shared computer.</i> </span> </div> <div class="clear"></div> <div id="button"> <input id="enter" type="image" name="submit" src="images/enter_inactive.png" WIDTH="117" HEIGHT="44" BORDER="0" ALT="SUBMIT!"> </div> </form> I put a couple of divs inside the form but I don't see how that would really effect the PHP at all, the whole form is still together. I can't even get an echo test to work. I'm completely stumped here. I would greatly appreciate some help! Thanks You!
  22. I have a form that has a drop down list that gets company details from mysql database when the company name is selected. When the form is completed it will not submit??? If I remove the script that gets the data from the database i can submit the form? I'm not the best at javascript, so could do with pointing in the right direction!! Cheers Chris <script> function showCompany(str) { if (str=="") { document.getElementById("customerDetails").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("customerDetails").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getcustomer.php?customer_id="+str,true); xmlhttp.send(); } </script>
  23. Hey, I'm very new to PHP and I'm trying to create a form that posts data to a PHP document. Here's what I have so far: form.html: <form action="phpdoc.php" method="post"> <input type="checkbox" name="fun" value="yes" />Fun <input type="checkbox" name="ent" value="yes" />Entertaining <input type="checkbox" name="inf" value="yes" />Informative <br> <input type="submit" name="formSubmit" value="Submit" /> </form> phpdoc.php: <?php if(isset($_POST['fun']) && $_POST['fun'] == 'yes') { print "Try fdajkfda."; } else { print "You aren't fun."; } ?> The objective is to create a form with checkboxes, and so far, if you select the "fun" checkbox and submit the form, it will send the data to the phpdoc.php and the form will then print something depending on your selection. The problem is, the form isn't printing anything at all. This is a really amateur problem so I thank you for whatever help you can give
  24. Hi, sorry if this has come up before. I had a quick look through the forum but could find anything. I've been having a problem with this code for the last while and I can't seem to figure it out. I'm not all that proficient in PHP. I've a gallery of images from a festival. When people looking through the photo's spot themselves they click a callout "I'm in this photo!' When they click the call out a window pops up with a form. I need the imageID to transfer to that form, and then after completion of that form gets saved to the data base. Page 1: The Gallery. <li> <a class="thumb" name="007" id="007" href="images/9133440_DSC_0087.jpg" title="Title #6"> <img src="images/9133440_DSC_0087_thumb.jpg" alt="Title #6" /> </a> <div class="caption"> <!-- <div class="image-desc">Description</div> --> </div> </li> </ul> </div> <div id="inphoto"> <a href="#" onclick="wopen('compentry.php?imageid=<?php echo $imageID; ?>', 'popup', 448, 590); return false;"><img src="assets/inphotobutton.jpg"></a> </div> Page 2: The Competition Form. <div id="form"> <form name="epcomp" id="epcomp" method="GET" action="form.php" > <p class="name"><label>Full Name:</label><br/> <input type="text" name="name" id="name" value="Your Name" onblur="if(this.value == '') { this.value='Your Name'}" onfocus="if (this.value == 'Your Name') {this.value=''}" maxlength="30" required/></p> <p class="email"><label>Your Email:</label><br/> <input type="email" name="email" id="email" value="Your email" onblur="if(this.value == '') { this.value='Your email'}" onfocus="if (this.value == 'Your email') {this.value=''}" maxlength="60" required /> </p> <p class="entry"><label>Your favourite festival moment: <span style="font-size:10px;">(Max 50 words)</label> <br/> <p><textarea cols="40" rows="5" name="entry" id="entry" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" maxlength="50" required>Enter you answer here...</textarea></p> <p class="button"><input class="button" type="submit" value="Enter Competition" name="formSubmit"/></p> <?php echo '<input type="hidden" name="photoId" value="' . $_GET['imageID'] . '">' ?> </form> And Page 3: The Form.php page. $imageID = $_GET['imageID']; $varName = $_GET['name']; $varEmail = $_GET['email']; $varEntry = $_GET['entry']; $query = "insert into comp_entry (imageID, name, email, entry) values ('$imageID' , '$varName' , '$varEmail' , ' $varEntry')"; $qresult = mysql_query($query); ?> <input class="button" type="button" value="Close" onclick="closeWin()"> </div> Can anyone point me on the right path, any help would be greatly appreciated.
  25. So I have a form that I've been developing. I originally got the code from htmlDrive.net and have been working on applying it. Basically, I need this HTML form to post to my PHP page and generate/send the posted content into an email. I have been able to get this to work great for single selections but not for multiple selection boxes. Here is my form: <form id="formElem" name="formElem" action="mediaForm.php" method="post"> <fieldset class="step"> <legend>Media Request</legend> <p> <label for="segment">Product Segment: </label> <select name="segment[]" size="4" multiple id="segment"> <option selected> </option> <option>Pedestrian</option> <option>Industrial</option> <option>Security</option> <option>Sensorio</option> </select> </p> <p> <label for="media">Select Media: </label> <select name="media[]" size="4" multiple id="media"> <option selected> </option> <option>Catalog</option> <option>Media Kit</option> <option>Technical Binder</option> <option>General Information CD</option> </select> </p> <p> <label for="print">Printed Publication </label> <input name="print" type="checkbox" id="print"> </p> <p> <label for="digital">Digital Publication </label> <input name="digital" id="digital" type="checkbox"> </p> </fieldset> <fieldset class="step"> <legend>Personal Info</legend> <p> <label for="company">Company: </label> <input id="company" name="company" placeholder="ABC Automatics" AUTOCOMPLETE = "on" /> </p> <p> <label for="title">Job Title: </label> <input id="title" name="title" placeholder="President" AUTOCOMPLETE = "on" /> </p> <p> <label for="firstName">First Name: </label> <input id="firstName" name="firstName" placeholder="John" AUTOCOMPLETE = "on" /> </p> <p> <label for="lastName">Last Name: </label> <input id="lastName" name="lastName" placeholder="Smith" AUTOCOMPLETE = "on" /> </p> <p> <label for="customerType">Customer Type: </label> <select name="customerType[]" size="4" multiple id="customerType"> <option selected> </option> <option>Wholesale</option> <option>Distributor</option> <option>Architect</option> <option>Technician</option> <option>Sales</option> <option>End User</option> <option>Other</option> </select> <br> </p> <p> If you do not know your type, please choose "Other." </p> </fieldset> <fieldset class="step"> <legend>Contact Info</legend> <p> <label for="email">Email: </label> <input id="email" name="email" placeholder="jsmith@ABC_Auto.com" type="email" AUTOCOMPLETE = "on" /> </p> <p> <label for="phone">Phone Number: </label> <input id="phone" name="phone" placeholder="xxx-xxx-xxxx" type="tel" AUTOCOMPLETE = "on" /> </p> <p> <label for="address">Address: </label> <input id="address" name="address" placeholder="123 Enterprise Ln" AUTOCOMPLETE = "on" /> </p> <p> <label for="city">City: </label> <input id="city" name="city" placeholder="City Name" AUTOCOMPLETE = "on" /> </p> <p> <label for="state">State: </label> <input id="state" name="state" placeholder="ST" AUTOCOMPLETE = "on" /> </p> <p> <label for="zipcode">Zipcode: </label> <input id="zipcode" name="zipcode" placeholder="12345" AUTOCOMPLETE = "on" /> </p> <p> <label for="country">Country: </label> <select id="country" name="country"> <option selected> </option> <option>United States</option> <option>Mexico / Latin America</option> <option>Canada</option> <option>Other</option> </select> </p> </fieldset> <fieldset class="step"> <legend>Comments</legend> <p> <label for="comments"></label> <textarea name="comments" id="comments" placeholder="Insert additional comments here"></textarea> </p> </fieldset> <fieldset class="step"> <legend>Confirm</legend> <p> Everything in the form was correctly filled if all the steps have a green checkmark icon. A red checkmark icon indicates that some field is missing or filled out with invalid data. In this last step the user can confirm the submission of the form. </p> <p class="submit"> <button id="registerButton" type="submit" value="submit">Submit</button> </p> </fieldset> </form> My PHP: <?php if(isset($_POST['email'])) { $email_to = "email@yoursite.com"; $email_subject = "Media Request Form"; $segment = $_POST['segment']; $media = $_POST['media']; $print = $_POST['print']; $digital = $_POST['digital']; $company = $_POST['company']; $title = $_POST['title']; $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $customerType = $_POST['customerType']; $email = $_POST['email']; $phone = $_POST['phone']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zipcode = $_POST['zipcode']; $country = $_POST['country']; $comments = $_POST['comments']; $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Company: ".clean_string($company)."\n"; $email_message .= "Title: ".clean_string($title)."\n"; $email_message .= "Name: ".clean_string($firstName)." ".clean_string($lastName)."\n"; $email_message .= "Type: ".clean_string($customerType)."\n\n"; $email_message .= "Email: ".clean_string($email)."\n"; $email_message .= "Phone: ".clean_string($phone)."\n"; $email_message .= "Address: ".clean_string($address)."\n"; $email_message .= "City: ".clean_string($city)."\n"; $email_message .= "State: ".clean_string($state)."\n"; $email_message .= "Zipcode: ".clean_string($zipcode)."\n"; $email_message .= "Country: ".clean_string($country)."\n\n"; $email_message .= "Segment: ".clean_string($segment[])."\n"; $email_message .= "Media Type: ".clean_string($media)."\n"; $email_message .= "Printed Copy: ".clean_string($print)."\n"; $email_message .= "Digital Copy: ".clean_string($digital)."\n\n"; $email_message .= "Comments: ".clean_string($comments)."\n\n"; // create email headers $headers = 'From: '.$email."\r\n". 'Reply-To: '.$email."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- include your own success html here --> Thank you for contacting us. We will be in touch with you very soon. <?php } ?> My multiple selectors are not showing up correctly. They are only outputting "array" for the content. Any help would be much appreciated! Thanks!
×
×
  • 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.