Jump to content

Search the Community

Showing results for tags 'form data'.

  • 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

Found 2 results

  1. Hi all, I have a form that submits data to a mysql db. It's working fine. What I am trying to do is output an html page (or possibly 2) that is propagated with the data that I just sent to the db. example: when I submit a new workorder, a page comes up with all the data i just submitted. so that can be printed as a "customer copy". and in a perfect world, another page comes up that is a material order form. That can be faxed to my vendor to order the materials for that job. Not looking to auto print or fax anything. I am just having trouble getting the data into my html page. Here is what I have, but sadly is not working. <?php $link = mysqli_connect("xxxx", "xxxx", "xxxx", "xxxx"); $sql = "SELECT customer FROM jobs WHERE id=6487"; echo $sql; mysqli_close($link); ?> I would like to use the data from the last id submitted and have tried several things like: WHERE id=mysqli::$insert_id and WHERE id=$insert_id with no luck. Here is a pic of the html form and the output i'm getting. Any help would be greatly appreciated. Thanks in advance. OGBugsy
  2. Anyone please help, i'm very desperate. I am new in php coding, therefore I am having a tough time troubleshooting my website. I have a form on this wedding website to should send the data directly to an email account. It was working perfectly, but all of a sudden as become flakey. Sometimes it will send no problem and other times it will not (not browser specific or device specific). It still appears to work properly once the form is completed. It just never reaches the email. My hosting does allow email to be sent and supports php, I double checked. Thanks in advance to anyone who can help! Again, I am just a begginer with php so it might be something real elementary that i'm doing. ------- This is from my index page: <div id="contact-form" class="clearfix"> <div id="contact" class="section"> <form id="contact-us" action="rsvp-form-send.php" method="post"> <?php if(isset($emailSent) && $emailSent == true) { ?> <p class="info">Thanks for sending us your RSVP! Cant wait to CELEBRATE!</p> <?php } else { ?> <?php if(isset($hasError) || isset($captchaError) ) { ?> <p class="alert">Error submitting the form</p> <?php } ?> <div class="left-container"> <div id="contact-name-container" class="formblock"> <?php if($contactName != '') { ?> <br /><span id="contact-name-error" class="error"><?php echo $contactNameError;?></span> <?php } ?> <label class="screen-reader-text">Name</label> <input type="text" name="contactName" id="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="txt requiredField" placeholder="your name" /> </div> <div id="rsvp-text-container" class="formblock"> <?php if($rsvpError != '') { ?> <br /><span class="error"><?php echo $rsvpError;?></span> <?php } ?> <label id="rsvp-text" class="screen-reader-text">RSVP total</label> <input type="text" name="rsvpTotal" id="rsvpTotal" value="<?php if(isset($_POST['rsvpTotal'])) echo $_POST['rsvpTotal'];?>" class="txt requiredField" placeholder="#" /> </div> <div id="additional-guest" class="formblock"> <label class="screen-reader-text">Additional guest name(s) <small>(leave blank if your rolling solo!)</small></label> <div class="clearfix"></div> <input type="text" name="guestName1" id="guestName1" value="<?php if(isset($_POST['guestName1'])) echo $_POST['guestName1'];?>" placeholder="guest name 1" /> <input type="text" name="guestName2" id="guestName2" value="<?php if(isset($_POST['guestName2'])) echo $_POST['guestName2'];?>" placeholder="guest name 2" /> <input type="text" name="guestName3" id="guestName3" value="<?php if(isset($_POST['guestName3'])) echo $_POST['guestName3'];?>" placeholder="guest name 3" /> <input type="text" name="guestName4" id="guestName4" value="<?php if(isset($_POST['guestName4'])) echo $_POST['guestName4'];?>" placeholder="guest name 4" /> <input type="text" name="guestName5" id="guestName5" value="<?php if(isset($_POST['guestName5'])) echo $_POST['guestName5'];?>" placeholder="guest name 5" /> <input type="text" name="guestName6" id="guestName6" value="<?php if(isset($_POST['guestName6'])) echo $_POST['guestName6'];?>" placeholder="guest name 6" /> </div> <div class="formblock"> <label class="screen-reader-text">Comments, Questions, Special Requests!</label> <textarea name="comments" id="commentsText" class="txtarea" placeholder="enter your thoughts!"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?></textarea> </div> </div> <div class="right-container"> <div id="email-container" class="formblock"> <?php if($emailError != '') { ?> <br /><span class="error"><?php echo $emailError;?></span> <?php } ?> <label class="screen-reader-text">Email Address</label> <input type="text" name="email" id="email" value="<?php if(isset($_POST['email'])) echo $_POST['email'];?>" class="txt requiredField email" placeholder="email address" /> </div> <p>Total your number of meal choices <br />for yourself and your guest(s)</p> <div class="formblock formblock-no-margin"> <div class="beef-img"></div> <label class="screen-reader-text" id="beef-text">Beef total</label> <input type="text" name="beefTotal" id="beefTotal" value="<?php if(isset($_POST['beefTotal'])) echo $_POST['beefTotal'];?>" class="txt" placeholder="#" /> </div> <div class="formblock formblock-no-margin"> <div class="chicken-img"></div> <label class="screen-reader-text" id="chicken-text">Chicken total</label> <input type="text" name="chickenTotal" id="chickenTotal" value="<?php if(isset($_POST['chickenTotal'])) echo $_POST['chickenTotal'];?>" class="txt" placeholder="#" /> </div> <div class="formblock formblock-no-margin"> <div class="fish-img"></div> <label class="screen-reader-text" id="fish-text">Fish total</label> <input type="text" name="fishTotal" id="fishTotal" value="<?php if(isset($_POST['fishTotal'])) echo $_POST['fishTotal'];?>" class="txt" placeholder="#" /> </div> <div class="formblock"> <label class="screen-reader-text" id="hotel-label">Spending the night in our hotel?</label> <label class="screen-reader-text" id="radio-yes-label">yes</label> <input id='radio-yes' type="radio" value="YES"name="hotel"> <label class="screen-reader-text" id="radio-no-label">no</label> <input id='radio-no' type="radio" value="NO" name="hotel"> </div> <div class="formblock"> <label class="screen-reader-text">Like to dance?</label> <input type="text" name="songRequest" id="songRequest" value="<?php if(isset($_POST['songRequest'])) echo $_POST['songRequest'];?>" class="txt" placeholder="give us a song request" /> </div> <button id="submit-button" name="submit" type="submit" class="subbutton">CLICK TO SEND YOUR RSVP!</button> <input type="hidden" name="submitted" id="submitted" value="true" /> </div> </div> <?php } ?> <div class="clearfix"></div> <!-- End #contact --> </div> </form> </div> -------------------------- This is the scripting on the index page: <!--//--><![CDATA[//><!-- $(document).ready(function() { document.getElementById("contact-us").reset(); $('form#contact-us').submit(function() { $('form#contact-us .error').remove(); var hasError = false; $('.requiredField').each(function() { if($.trim($(this).val()) == '') { var labelText = $(this).prev('label').text(); $(this).parent().append('<span class="error">you forgot your '+labelText+'!</span>'); $(this).addClass('inputError'); /* $("#contactName").onclick().hide("span .error");*/ hasError = true; } else if($(this).hasClass('email')) { var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; if(!emailReg.test($.trim($(this).val()))) { var labelText = $(this).prev('label').text(); $(this).parent().append('<span class="error">oops! you\'ve entered an invalid '+labelText+'.</span>'); $(this).addClass('inputError'); hasError = true; } } }); $('#contactName').click(function(){ if($(this).hasClass('inputError')) { $('#contact-name-container .error').css({ 'display' : 'none' }); } }); $('#rsvpTotal').click(function(){ if($(this).hasClass('inputError')) { $('#rsvp-text-container .error').css({ 'display' : 'none' }); } }); $('#email').click(function(){ if($(this).hasClass('inputError')) { $('#email-container .error').css({ 'display' : 'none' }); } }); if(!hasError) { var formInput = $(this).serialize(); $.post($(this).attr('action'),formInput, function(data){ $('form#contact-us').slideUp("fast", function() { $(this).before('<p class="rsvp-thanks"><strong>Thanks for the RSVP!</strong> <br />Cant wait to CELEBRATE!</p>'); }); }); } return false; }); }); //-->!]]> ------------------------ and this is the backend php file: <?php error_reporting(E_ALL ^ E_NOTICE); // hide all basic notices from PHP //If the form is submitted if(isset($_POST['submitted'])) { // require a name from user if(trim($_POST['contactName']) === '') { $contactNameError = 'Forgot your name!'; $hasError = true; } else { $contactName = trim($_POST['contactName']); } // require a RSVP Number if(trim($_POST['rsvpTotal']) === '') { $rsvpError = 'Forgot your RSVP total number!'; $hasError = true; } else { $rsvpTotal = trim($_POST['rsvpTotal']); } // Not required $hotel = trim($_POST['hotel']); $guestName1 = trim($_POST['guestName1']); $guestName2 = trim($_POST['guestName2']); $guestName3 = trim($_POST['guestName3']); $guestName4 = trim($_POST['guestName4']); $guestName5 = trim($_POST['guestName5']); $guestName6 = trim($_POST['guestName6']); $beefTotal = trim($_POST['beefTotal']); $chickenTotal = trim($_POST['chickenTotal']); $fishTotal = trim($_POST['fishTotal']); $songRequest = trim($_POST['songRequest']); // need valid email if(trim($_POST['email']) === '') { $emailError = 'Forgot to enter in your e-mail address.'; $hasError = true; } else if (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['email']))) { $emailError = 'You entered an invalid email address.'; $hasError = true; } else { $email = trim($_POST['email']); } // we need at least some content if(trim($_POST['comments']) === '') { $commentError = 'You forgot to enter a message!'; $hasError = true; } else { if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['comments'])); } else { $comments = trim($_POST['comments']); } } // upon no failure errors let's email now! if(!isset($hasError)) { $emailTo = 'nsiri335@live.com'; $subject = ' Wedding RSVP!'; $sendCopy = trim($_POST['sendCopy']); $body = "Name: $contactName \n\nRSVP #: $rsvpTotal \n\nChicken Total #: $chickenTotal \n\nBeef Total #: $beefTotal \n\nFish Total #: $fishTotal \n\nGuest Name 1: $guestName1 \n\nGuest Name 2: $guestName2 \n\nGuest Name 3: $guestName3 \n\nGuest Name 4: $guestName4 \n\nGuest Name 5: $guestName5 \n\nGuest Name 6: $guestName6 \n\nEmail: $email \n\nSong Request: $songRequest \n\nHotel Room?: $hotel \n\nComments: $comments"; $headers = 'From: ' .' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); // set our boolean completion value to TRUE $emailSent = true; } } ?>
×
×
  • 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.