PHP - Unable To Submit Php Form On Ie Browser
I have php form which I can submit without any problem on Firefox browser but unable to submit it using IE browser.
to submit this form I am using input tag such as <input type="submit" value="Submit"> I am not sure what to do here. Can anyone help me in this matter? Thanks in advance Smita Similar TutorialsDear fourm, i am wondering if anyone can shed some light on this form submission problem with back/forward buttons. long story short: i used to make a form, then submit to a form process php file. errors were difficult to deal with. Thus, many people tell me to submit to the same page. I now submit to the same page. my homepage has a login button. i use a csrf token in a hidden input matched with a session variable. i decided to submit to same page and handle the submit like so: if server request-method = post and isset input name and isset session token then check the token with hash_equals if everything matches then show the login page. i don't have a problem with the form and the form submission processing. everything i fine. now when i use the browser refresh button on the login page, i am sent back to the homepage. all is good. when i press the back button, i go back to the homepage again. super. then i press the forward button in the browser and i get a not connected error. the back button now also shows this error. i tinkered around a bit and added crazy ideas and it worked one time with unset($_POST) as an else to the if mentioned above. the idea is that if server request-method is post without an else. the page is listed below for any get request to process. i assume that the browser is trying to repost data is empty but my if statement should kick it out to the get code, right? what i want is to unset the csrf token and the matching session token for security purposes. i suppose that this breaks the back/forward buttons? how can i get the browser to show the homepage regardless of the post situation? there must be a logical answer. something in my code is breaking this an preventing the browser from simply loading the home page any help is greatly appreciated! Thank you. Say I have an "Entries" table. I want to submit same multiple entries using a form submission. And If I have other queries submitted in the same form, I want those quarries to be submitted only once. Is that possible to do? Here's my code. if(isset($_POST['submit'])) { $entries = 10; $id = 55; $name = 'Smith'; $insert = $db->prepare("INSERT INTO entries(id, name) VALUES(:id, :name)"); $insert->bindParam(':id', $id); $insert->bindParam(':name', $name); $result_insert = $insert->execute(); if($result_insert == false) { echo 'Fail'; } else { echo 'Success'; } } ?> <form action="" method="post"> <input type="submit" name="submit" value="SUBMIT" /> </form> Edited January 13, 2019 by imgrooot Hi. Pretty straight forward I guess but as the name suggests am a newbie. I have a form that requires the user to enter certain parameters. If the values are blank it submits to itself and loads the error messages. What I want to do is create PHP code that submits the form to a different url. What I thought was create two forms (the second with hidden fields replicating the first form), each form having a different url in the action"" code. What I cant work out is the PHP IF ELSE code to submit form 2 if Form1 is is validated correctly. This is the PHP code relevant to the form validation. Help? <?php //If form was submitted if ($_POST['submitted']==1) { $errormsg = ""; //Initialize errors if ($_POST[width]){ $title = $_POST[width]; //If title was entered } else{ $errormsg = "Please enter width"; } if ($_POST[drop]){ $textentry = $_POST[drop]; //If comment was entered } else{ if ($errormsg){ //If there is already an error, add next error $errormsg = $errormsg . " & content"; }else{ $errormsg = "Please enter drop"; } } } if ($errormsg){ //If any errors display them echo "<div class=\"box red\">$errormsg</div>"; } //If all fields present if ($title && $textentry){ //Do something echo 'THIS IS WHERE I WANT THE CODE TO SUBMIT FORM 2 or SUBMIT FORM 1 TO A DIFFERENT URL'; } ?> Ive tried using header and form action and my page will not load into another page after submitting ! Any ideas?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Task2 - App</title> <meta name="description" content="The Task2 App"> <meta name="author" content="SitePoint"> </head> <body> <h1>Task 2 - Web App</h1> <br><br> <div class ="submission"> <form action="" method="POST" name='submit'> <label>N:</label> <input type="text" name="number-entered" id="number"/> <input name="form" type="submit" value="Submit"/> <br><br> </form> </div> </body> </html> <?php $number = $_POST['number-entered']; $form_result = $_POST['form']; if(isset($form_result)) { if(($number < 5) || ($number > 25)) { echo 'Input out of range'; } else { $number = $_POST['number-entered']; foreach ( range(1, $number) as $i ) { $triangle_numbers[] = $i * ( $i + 1 ) / 2; } //make a file $contents = fopen('gs://a1-task22020.appspot.com/triangular_' .$number. ".txt", "w"); fwrite($contents,implode(',', $triangle_numbers)); //open the file $contents = fopen('gs://a1-task22020.appspot.com/' . $content, 'w'); //re-open the document if you put something in it fwrite($contents, $number); fclose($contents); } } ?>
Hello, first time poster.. I've looked the web over for a long time and can't figure this one out. - Below is basic code that successfully checks MySQL for a match and displays result. I was debugging and forced the "height" and "width" to be 24 and 36 to make sure that wasn't the problem. That's good.. - I'd like to give the user ability to select width and height from a form.. and have it do an onchange this.form.submit so the form can be changing as fields are altered (thus the onchange interaction) - In a normal coding environment I've done this numerous times with no "Page cannot be displayed" problems. It would simply change one select-option value at a time til they get down the form and click submit... but in WordPress I'm having trouble making even ONE single onchange work! - I've implemented the plugins they offer which allows you to "copy+paste" your php code directly into their wysiwyg editor. That works with basic tests like my first bullet point above. - I've copied and pasted the wordpress url (including the little ?page_id=123) into the form "action" url... that didn't work... tried forcing it into an <option value=""> tag.. didn't work. I'm just not sure. I've obviously put xx's in place of private info.. Why does this form give me Page Cannot Be Displayed in WordPress every time? It won't do anything no matter how simple.. using onchange.. Code.. $con = mysql_connect("xxxx.xxxxxxx.com","xxxxxx","xxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxxxx", $con); $myprodwidth=24; $myprodheight=36; $result = mysql_query("SELECT * FROM product_sizes WHERE prodwidth='$myprodwidth' and prodheight='$myprodheight'"); while($row = mysql_fetch_array($result)) { echo $row['prodprice']; } mysql_close($con); <form method="post" action=""> <select name="myheight" onchange="this.form.submit();"> <option selected="selected" value="">select height</option> <option value="xxxxxxxxx.com/wordpress/?page_id=199&height=36">36</option> <option value="xxxxxxxxx.com/wordpress/?page_id=199&height=36">48</option> </select> Hi- the code below lets me upload a CSV file to my database if I have 1 field in my database and 1 column in my CSV. I need to add to my db "player_id" from the CVS file and "event_name" and "event_type" from the form... any ideas??? here's the code: Code: [Select] <?php $hoststring =""; $database = ""; $username = ""; $password = ""; $makeconnection = mysql_pconnect($hoststring, $username, $password); ?> <?php ob_start(); mysql_select_db($database, $makeconnection); $sql_get_players=" SELECT * FROM tabel ORDER BY player_id ASC"; // $get_players = mysql_query($sql_get_players, $makeconnection) or die(mysql_error()); $row_get_players = mysql_fetch_assoc($get_players); // $message = null; $allowed_extensions = array('csv'); $upload_path = '.'; //same directory if (!empty($_FILES['file'])) { if ($_FILES['file']['error'] == 0) { // check extension $file = explode(".", $_FILES['file']['name']); $extension = array_pop($file); if (in_array($extension, $allowed_extensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'], $upload_path.'/'.$_FILES['file']['name'])) { if (($handle = fopen($upload_path.'/'.$_FILES['file']['name'], "r")) !== false) { $keys = array(); $out = array(); $insert = array(); $line = 1; while (($row = fgetcsv($handle, 0, ',', '"')) !== FALSE) { foreach($row as $key => $value) { if ($line === 1) { $keys[$key] = $value; } else { $out[$line][$key] = $value; } } $line++; } fclose($handle); if (!empty($keys) && !empty($out)) { $db = new PDO( 'mysql:host=host;dbname=db', 'user', 'pw'); $db->exec("SET CHARACTER SET utf8"); foreach($out as $key => $value) { $sql = "INSERT INTO `table` (`"; $sql .= implode("`player_id`", $keys); $sql .= "`) VALUES ("; $sql .= implode(", ", array_fill(0, count($keys), "?")); $sql .= ")"; $statement = $db->prepare($sql); $statement->execute($value); } $message = '<span>File has been uploaded successfully</span>'; } } } } else { $message = '<span>Only .csv file format is allowed</span>'; } } else { $message = '<span>There was a problem with your file</span>'; } } ob_flush();?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CSV File Upload</title> </head> <body> <form class="form" action="" method="post" enctype="multipart/form-data"> <h3>Select Your File</h3> <p><?php echo $message; ?></p> <input type="file" name="file" id="file" size="30" /> <br/> <label>Event Name:</label><input name="event_name" type="text" value="" /> <br/> <label>Event Type:</label><input name="event_type" type="text" value="" /> <br/> <input type="submit" id="btn" class="button" value="Submit" /> </form> <br/> <h3>Results:</h3> <?php do { ?> <p><?php echo $row_get_players['player_id'];?></p> <?php } while ($row_get_players = mysql_fetch_assoc($get_players)); ?> </body> </html> Hi all, What I am trying to achieve is, I thought quite simple! Basically, a user signs up and chooses a package, form is submitted, details added to the database, email sent to customer, then I want to direct them to a paypal payment screen, this is where I am having issues! Is their any way in php to submit a form without user interaction? Here is my code for the form process page Code: [Select] <?php include('config.php'); require('scripts/class.phpmailer.php'); $package = $_POST['select1']; $name = $_POST['name']; $email = $_POST['email']; $password = md5($_POST['password']); $domain = $_POST['domain']; $a_username = $_POST['a_username']; $a_password = $_POST['a_password']; $query=mysql_query("INSERT INTO orders (package, name, email, password, domain, a_username, a_password) VALUES ('$package', '$name', '$email', '$password', '$domain', '$a_username', '$a_password')"); if (!$query) { echo "fail<br>"; echo mysql_error(); } else { $id = mysql_insert_id(); $query1=mysql_query("INSERT INTO customers (id, name, email, password) values ('$id', '$name', '$email', '$password')"); if (!$query1) { echo "fail<br>"; echo mysql_error(); } if($package=="Reseller Hosting") { //email stuff here - all works - just cutting it to keep the code short if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } ?> <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="business" value="subscription@jollyhosting.com"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name" value="Jolly Hosting Reseller Packages"> <input type="hidden" name="no_shipping" value="1"> <!--1st month --> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="a3" value="3.00"> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1"> </form>'; <?php } //last } //end ?> hello everyone, I have a php form, everything works, I do not carry any header() at the end of the form because I have to stay on the same page and because I feel it wipes out the message you sent the form successfully, but for this though if reloading the page shows me the popup asking me to resend the form. how can i solve? I found a function in js with replacestate but I saw that it doesn't work with mobile Safari. if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); }
Hi, I want to submit a form using ajax ans jquery with two fields input text and file. Code: [Select] <script> $(document).ready( function() { $('#basicinfofrm').ajaxForm(function() { url: ''+PN+'.php', type:'POST', data:'action=yes&'+frmFeilds, success: function(html) { alert(html); } }).submit(); </script> <form action='' method='post'> <label>name</label> <input type='text' name='txtname' /> <input type='file' name = 'txtfile' /> <input type='submit' value='save' /> </form> but is is not working... can anyone tell me how to? i don't want to refresh my page Thanks I can't submit php form using IE 8. This works fine on Firefox very well. I tried following code but none of them is working. 1. <button type="submit">Submit</button> 2. <input type="submit" value="Submit" name="submit"> I would appreciate if any one help me in this. Can anybody see as to why, if any, this form takes forever to execute? Code: [Select] <?php if(isset($_POST['submitted'])){ $z = $_POST['zipcode']; $r = $_POST['radius']; $sql = mysql_query("SELECT DISTINCT m.LocAddZip, m.MktName,m.LocAddSt,m.LocAddCity,m.LocAddState,m.x1,m.y1,z1.lat,z2.long FROM mrk m, zip z1, zip z2 WHERE m.LocAddZip = z1.zipcode AND z2.zipcode = $z AND ( 3963 * acos( truncate( sin( z2.lat / 57.2958 ) * sin( z1.lat / 57.2958 ) + cos( z2.lat / 57.2958 ) * cos( z1.lat / 57.2958 ) * cos( z1.long / 57.2958 - z2.long / 57.2958 ) , 8 ) ) ) <= $r ") or die(mysql_error()); while($row = mysql_fetch_array( $sql )) { $store = $row['MktName']."<br />"; $store .= $row['LocAddSt']."<br />"; $store .= $row['LocAddCity'].", ".$row['LocAddState']." ".$row['LocAddZip']; $lat1 = $row['lat']; $lon1 = $row['long']; $lat2 = $row['y1']; $lon2 = $row['x1']; $dis = distance($lat1, $lon1, $lat2, $lon2); echo "<p>".$store."</p>"; echo ceil($dis) . " mile(s) away"; echo "<hr/>"; } } ?> I get a timeout error sometimes, and sometimes I don't. Is it the form, or would it be on the server? Thanks in advance Hi, I have setup a basic enquiry form with a Captcha - once the code has been inserted and is correct I want to action the form (submit) in PHP. <?php session_start(); if($_SERVER['REQUEST_METHOD'] == 'POST'){ $vResult = ''; if(strtolower($_SESSION['security_code']) != strtolower($_POST['security_code'])){ $vResult = 'Invalid code!'; } else{ "/enquiry.php" } } ?> I want to submit the form to /enquiry.php - I tried header(Location.. and realised that just redirects, and doesn't submit the form. Any suggestions or tips would be great. Cheers, Paul Code: [Select] <?php if (isset($_POST['checking'])) { echo $_POST['checking']; } if (isset($_POST['test'])) { echo $_POST['test']; } ?> <form id="testform2" action="testform.php" method="post"> <select name="checking" onchange="this.form.submit()"><option value="5">5</option><option value="6">6</option></select> <input type="text" name"test" id="test"> <a href="#" onclick="this.form.submit()">submit it!</a> </form> It works when I try to submit by selecting a new value from the dropdown box but when I try to click the link it won't display the text field value. That is a test case for a problem I m having in one of my codes. Hello everyone, this is my first post here! My question covers a PHP, SQL, and HTML so I apologise if this isn't the appropriate section to post this message. Outline to my problem: A user can search my database for a variety of events, which are then listed on a results form. Next to each result I have an option to add this event to the users personal area as a 'saved event' for future reference. Currently I have a solution whereby an HTML form sends an action to '#', inserts the event ID and member ID into the 'savedevent' table via a PHP/SQL function. The page then displays 'event added'. THIS WORKS. However, if the user navigates away from the page, and then back to it again, the PHP script is obviously run again, ie- a 'resend data' dialog box is displayed to the user, which I really don't want. This website:http://www.bandsintown.com/event/3988178-nme-awards-tour-2011-london-united-kingdom-live-at-o2-academy-brixton-on-february-19-2011 achieves exactly what I am trying to do with the 'attending' button, but I cannot figure out how they accomplish this. Any help and ideas would be greatly appreciated. Hello again, and thanks! paddyfields. Hi Guy, First Post ..so please help! I have rows returning from a mYSQL Database which I put in a form which is php generated and im sending this form to the next page with a SUBMIT button. I want PHP/Javascript to do this automatically when the data is loaded from the MYSQL Table Ive tried fsockpen and document.form.submit() but it doesnt seem to work Any help. Thanks in Adv, Hittesh Ahuja <?php session_start(); if(isset($_POST['submit'])) { header("Location: http://localhost/PHP/brk_plan.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <p> <?php require_once('connect.php'); $email=$_SESSION['email']; $query="SELECT glycemic_index.gi_id,glycemic_index.value FROM food_preference JOIN glycemic_index ON glycemic_index.gi_id=food_preference.gi_id WHERE food_preference.email='$email' and glycemic_index.value >= 55 " or die("Update not Possible"); $result=mysql_query($query); $session_array=array(); echo "<form method='post' action='brk_plan.php' name='recommend'>"; echo "<p>This area is filtered from the user's table showing values only > 55</p>"; while($row=mysql_fetch_array($result)) { echo "Instead of: ".$row[0]."-".$row[1]."<br/>"; $one=$row[0]; $one_trimmed=substr($one,2,strlen($one)-5); $one_search="%".$one_trimmed."%"; $query2="SELECT glycemic_index.gi_id,glycemic_index.value,glycemic_index.food FROM glycemic_index WHERE glycemic_index.gi_id LIKE '$one_search' AND glycemic_index.value <55 AND glycemic_index.gi_id!='$row[0]' ORDER BY RAND() LIMIT 1 "; $result2=mysql_query($query2); while($row2=mysql_fetch_array($result2)) { echo "<input type='hidden' value='$row2[2]' name='fields[]'></input>"; echo "<p>You can have ".$row2[2].": ".$row2[0]."-".$row2[1]."</p>"; } } echo "<input type='submit' name='submit' value='dikha!'></input>"; echo "</form>"; //$_SESSION['higher_gi']=$session_array; //foreach($session_array as $value) //{ // echo $value."<br/>"; //} ?> </p> <p></p> <p></p> <p></p> <p></p> <p> </p> </body> </html> I've got a form that submits values to itself and the user input values are saved into the database in a table with an auto incrementing ID. After SUBMIT is clicked, it reloads the page and all the values are gone, I'm wondering how I can get it to keep the values so that the user can make a single change and resubmit again. I know I can save all the values into the session or in the URL or pass them through $_POST in an array but I'm wondering what is the proper way to do this. Thanks. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=323588.0 I have a Feedback form that I use to get peoples input. So far it works But I have 2 Problems Here is the Code: Code: [Select] <?php include "includes/config.php"; $date = date('jS \of F h:i A'); $sql="INSERT INTO news (name, email, comments, date) VALUES ('$_POST[Name]', '$_POST[email]', '$_POST[comments]', '$date')"; header( 'Location: thanks.php' ); mysql_close($con) ?> I'm making a VB.net Feedback form and I want to imput like this http://mysite.com/feedback.php?name=Mike&email=test@test.net&comments=comment&date=20th of April 12:30 AM But so far from my testing it doesn't register the values and says that there is a Duplicate value for email ". I'd like it to register values somehow and if there is a duplicate email entered then have it update it or write over it. Any help appreciated, Thanks! In a form example I am learning from I came across the value of the submit button being 'Next &rarr'. Could anyone explain this to me rather than using a value that sends you to another page to process the form? In this example what I am trying to learn is form validation using a function that checks for letters and numbers only. Right now i got the code posted below. It works alright, but it has 1 problem. When i press the submit button the form resets, but what i want is that the checkboxes which were checked remain checked and the values selected in the dropdown box keep that value. How can you do this? Is it even possible with php or am i going to need js? <?php $verhuur = 60.00; $Totaal = 0; $Averhuur = ""; if (isset($_POST['Averhuur'])) { $Averhuur = $_POST['Averhuur']; } if (isset($_POST['verhuur'])) { $verhuur = $verhuur * $Averhuur; $Totaal = $Totaal + $verhuur; } ?> <form action="test.php" method="post"> <table> <tr> <td> <input type="checkbox" name="verhuur" value="" /></td> <td>Verhuur</td> <td>€ 60,00</td> <td> <select name="Averhuur"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </td> </tr> <tr> <td> </td> <td><strong>Totaal:</strong></td> <td> <strong> <?php $formatnumber = number_format($Totaal, 2, ',', ''); echo "€ "; if($Totaal!=0){ echo $formatnumber; } else { echo "0,00"; } ?> </strong> </td> </tr> <tr> <td> </td> <td><input type="submit" value="Bereken" /></td> </tr> </table> </form> |