Jump to content

Search the Community

Showing results for tags 'submit 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

Found 3 results

  1. Hello, I'm working on a small form script which submits the form without refreshing the whole page. its a email form which basically calles sendemail.php and returns either "done" or "failed". NOt yet scripted to send, just testing. I been at it for 3 days with no success and wondering if someone can help me fix the problem. Any help you can provide would be greatly appreciated... Thanks <!doctype html> <html> <head> <title>Submit form without refreshing the page</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" </script> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script> $(function() { $("#send").click(function(e) { e.preventDefault(); $.ajax( { type: "POST", url: "sendemail.php", data: $("#myform").serialize(), success: function(response) { if(response == "done") { alert("Form submitted successfully!"); } else { alert("Form submission failed!"); } } }); }); }); </script> </head> <body> <form id="myform" > Name: <br /><input type="text" name="name" id="name" /><br /> Email: <br /><input type="text" name="email" id="email" /> <br /> Message: <br /><textarea name="msg" id="msg"></textarea> <br /> <input type="submit" id="send" class="send" value="Submit" /> </form> </body> </html> small php script <?php $name = $_POST['name']; $message = $_POST['msg']; if(!empty($name) && !empty($message)) { //Do your MySQL or whatever you wanna do with received data //Do not forget to echo "done" when action was completed successfully. echo "done"; } else { echo "fail"; } ?>
  2. I'm trying to create a "Thank you" page where a user lands after he/she has opted into one of our forms. On that page there will be an option for the user to choose a free CD as a gift and will only have to pay for shipping. I would like to give the user an option to either choose a physical CD or a digital MP3. The logic here is that first I provide a user with selection of 4 CDs that I connect to each radio button. Then below that there will be the first Submit button that will say something like "Yes, please mail be a CD." Below the first button there will be a second Submit button that will say something like "Send me the download link instead". Thus if the user clicks on any of the radio buttons and then clicks on the first Submit button, they will be taken to the shopping cart for that CD where they will be prompted to pay the shipping charges for the CD. If the user click on that same radio button, but then clicks on the second Submit button, they will be taken to link to download it. The third link below would just take the user past the page if he chooses to opt out of this offer. I can't get the script to work correctly for me. Here is what I have so far: <?PHP $option1 = 'unchecked'; $option2 = 'unchecked'; $option3 = 'unchecked'; $option4 = 'unchecked'; if (isset($_POST['Submit1'])) { $selected_radio = $_POST['cd_choice']; if ($selected_radio == 'option1') { $option1 = 'checked'; ?> <a href="#">Purchase link 1</a> <?php } else if ($selected_radio == 'option2') { $option2 = 'checked'; ?> <a href="#">Purchase link 2</a> <?php } else if ($selected_radio == 'option3') { $option3 = 'checked'; ?> <a href="#">Purchase link 3</a> <?php } else if ($selected_radio == 'option4') { $option4 = 'checked'; ?> <a href="#">Purchase link 4</a> <?php } } else { $selected_radio = $_POST['cd_choice']; if ($selected_radio == 'option1') { $option1 = 'checked'; ?> <a href="#">Download link 1</a> <?php } else if ($selected_radio == 'option2') { $option2 = 'checked'; ?> <a href="#">Download link 2</a> <?php } else if ($selected_radio == 'option3') { $option3 = 'checked'; ?> <a href="#">Download link 3</a> <?php } else if ($selected_radio == 'option4') { $option4 = 'checked'; ?> <a href="#">Download link 4</a> <?php } } ?> Here's what I have for the HTML portion of it: <body> <FORM NAME ="form1" METHOD ="POST" ACTION ="radioButton_test.php"> <INPUT TYPE = 'Radio' Name ='cd_choice' value= 'option1' <?PHP print $option1; ?>> This is the first CD <INPUT TYPE = 'Radio' Name ='cd_choice' value= 'option2' <?PHP print $option2; ?>> This is the second CD <INPUT TYPE = 'Radio' Name ='cd_choice' value= 'option3' <?PHP print $option3; ?>> This is the third CD <INPUT TYPE = 'Radio' Name ='cd_choice' value= 'option4' <?PHP print $option4; ?>> This is the fourth CD <P> <center><INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Yes, please mail me a CD"></center> <p><center><INPUT TYPE = "Submit" Name = "Submit2" VALUE = "Send me download link instead"></center></p> <div align="center"><a href="#">No thanks. </a></div> </FORM> Any help would be greatly appreciated. Thank you!
  3. Any idea what could be wrong ? I do not get any errors but also, nothing in my database. Will answer tomorrow morning if anyone have answered -Thanks <html> <head> <title>update database</title> </head> <body> <form method="post" action="insertken.php"> ID: <input type="text" name="id" size="50" /> <br /> Name: <input type="text" name="name" size="50" /> <br /> Last Name <input type="text" name="description" size="50" /> <br /> price <input type="text" name="price" size="50" /> <br /> sla <input type="text" name="sla" size="50" /> <br /> quantity <input type="text" name="quantity" size="50" /> <br /> fix <input type="text" name="fix" size="50" /> <br /> <input type="submit" value="Update" /> </form> </body> </html> <?php $id = $_POST['id']; $name = $_POST['name']; $description = $_POST['description']; $price = $_POST['price']; $sla = $_POST['sla']; $quantity = $_POST['quantity']; $fix = $_POST['fix']; mysql_connect("localhost:3306","root","") or die ('ERROR: ' . mysql_error()); mysql_select_db ("my_db"); $query="INSERT INTO products (id, name, description, price, sla, quantity, fix) VALUES ('".$id."','".$name."','".$description."','".$price."','".$sla."','".$quantity."','".$fix."')"; ?> <form method="get" action="form.php"> <button type="submit">Continue</button> </form>
×
×
  • 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.