Jump to content

Search the Community

Showing results for tags 'submit button'.

  • 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. 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!
  2. Hello all, i have a change your password feature on one of my websites. It works perfectly in FF and Chrome but it is not working in IE 8. I have used MySQLi prepared statements and the script is fairly straight forward. In IE 8 when i click on submit button, it kills the session and gives "you are not authorized to view this page message". So I need some help in solving it. Below is the HTML form. <form name="frmcp" method="post" action="#"> <table border="0" cellpadding="5" cellspacing="5"> <tr><td>Old Password</td></tr> <tr><td><input type="password" name="password" id="password" /></td></tr> <tr><td>New Password</td></tr> <tr><td><input type="password" name="txtpass1" /></td></tr> <tr><td>Confirm Password</td></tr> <tr><td><input type="password" name="txtpass2" /></td></tr> <tr><td><input type="submit" name="btncp" value="Change Password" class="button" onclick="formhash(this.form, this.form.password);" /></td></tr> </table> </form> Below is the PHP Script which is on the same page above the html open tag. <?php // Include database connection and functions here. include '../php/config.php'; include 'php/functions.php'; //Securely Start Session sec_session_start(); //Check if user is logged in or not if((login_check($mysqli) == true) && $_SESSION['usertype'] == 0) { $userid = $_SESSION['user_id']; // Check if the button was clicked or not. if(isset($_POST['btncp'])){ //Check if all fields are filled. if(isset($_POST['txtpass1']) && !empty($_POST['txtpass1']) AND isset($_POST['txtpass2']) && !empty($_POST['txtpass2'])){ $newpass = htmlspecialchars(strip_tags($_POST['txtpass1'])); $newpass = hash('sha512', $newpass); $newcpass = htmlspecialchars(strip_tags($_POST['txtpass2'])); $newcpass = hash('sha512', $newcpass); //Check if new password matches the confirm password or not. if($newpass == $newcpass){ $password = $_POST['p']; //Check if the old password entered is correct or not. if ($stmt = $mysqli->prepare("SELECT username, password, usertype, salt FROM active_users WHERE user_id = ? LIMIT 1")) { $stmt->bind_param('i', $userid); // Bind "$email" to parameter. $stmt->execute(); // Execute the prepared query. $stmt->store_result(); $stmt->bind_result($username, $db_password, $usertype, $salt); // get variables from result. $stmt->fetch(); $password = hash('sha512', $password.$salt); // hash the password with the unique salt. if($stmt->num_rows == 1) { if($db_password == $password) { //Hash the new password with a new randomly created salt. $new_random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true)); $new_db_password = hash('sha512', $newcpass.$new_random_salt); //Update new password in the table. if ($stmt = $mysqli->prepare("UPDATE active_users SET password = ?, salt = ? WHERE user_id = ?")) { // Bind the variables to the parameter as strings. $stmt->bind_param("ssi", $new_db_password, $new_random_salt, $userid); // Execute the statement. $stmt->execute(); // Close the prepared statement. $stmt->close(); } //Redirect if password was changed and ask the user to login again using new password. header('Location: error.php?error=5'); } else { $msg = 'Old password entered is incorrect.'; } } else { $msg = 'User Does Not Exist.'; } } } else { $msg = 'New Password and Confirm Password does not match.'; } } else { $msg = 'All fields are mandatory.'; } } ?> The problem appears to be in the line where PHP checks if the button was clicked or not or in the line where it checks if user is logged in or not. But it works in FF and Chrome, just not in IE 8.
×
×
  • 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.