PHP - Submit Button Not Submitting
sorry solved this one, I didnt put the submit button in the <form> </form> tag lmfao...
Similar Tutorials
Greeting,
<?php // DELETE FILES $submit_file = $_POST['submit_file']; echo $filename = $_POST['filename']; if ($submit_file == '1') { unlink($filename); } else { } if($reload == 2) { INSERT INTO.. } else if ($reload > 2) { UPDATE ... } else {} ?> // BEGIN OF THE FORM <form action="index.php?lg=<?php echo $lng; ?>&c=new_document" method="post" enctype="multipart/form-data"> // INPUT TEKST AND OTHERS <input type="text" class="form-control form-control-lg" style="width: 40%;" id="sn_text_page" name="sn_text_page" value="<?php echo $text_page; ?>"> <textarea id="sn_text_lead" name="sn_text_lead" class="form-control font-weight-bold" rows="3"><?php echo $text_lead; ?></textarea> // SELECT FILES (MORE THAS ONE) <input type="file" name="file[]" id="file" multiple> // SUBMITTING BUTTON INSERT (UPDATE) DATABASE <button type="submit" name="submit_usertype" value="1" class="btn btn-primary"><?php echo $submit_button; ?></button> <input type="hidden" name="sn_text_id" value="<?php echo $text_id; ?>"> <input type="hidden" name="reload" value="<?php echo $reload; ?>"> // LOADING FILES (IMAGES) <?php $files = glob('./tekstovi/' . $user_txt_year . '/' . $user_txt_nr . '/' . $text_page . '/' . $user_txt_year . '_' . $user_txt_nr . '_' . $text_nr . '_' . $text_page . '_img_' . '*.{doc,docx,odt,pdf,jpg,JPG,jpeg,png,gif,psd,eps,ai,tiff,tif}', GLOB_BRACE); for ($i = 0; $i < count($files); $i++) { $image = $files[$i]; ?> <div class="col p-3"> <?php if ($reload == '1') { } else if ($reload > '1') { echo '<img class="img-fluid img-thumbnail shadow" src="' . $image . '" alt="" />' . '<small class="font-weight-bold">' . basename($image) . '</small><br /><br />'; ?> // DELETE ONE SELECTED FILE <button type="submit" name="submit_file" value="1" class="btn btn-danger"><?php echo $list_document_button_title_delete; ?></button> <input type="hidden" name="filename" value="<?php echo $image; ?>"> <input type="hidden" name="sn_text_id" value="<?php echo $text_id; ?>"> </div> <?php }}?> </div> </form> // END OF FORM
I would like to delete the file I selected with "submit_file" and at the same time input the texts with UPDATE. (If I wasn't clear, ask. Thanks again.) the info posts beautifully i just canst seem to get the button to auto click or submit, tried numerous ways! help Code: [Select] <?php require_once "../store/paypal/utility.php"; require_once "../store/paypal/constants.php"; $url = "https://www.".DEFAULT_ENV.".paypal.com/cgi-bin/webscr"; $postFields = "cmd=".urlencode("_notify-synch"). "&tx=".urlencode(htmlspecialchars($_GET["tx"])). "&at=".urlencode(DEFAULT_IDENTITY_TOKEN); $ppResponseAr = Utils::PPHttpPost($url, $postFields, true); if(!$ppResponseAr["status"]) { Utils::PPError($ppResponseAr["error_msg"], $ppResponseAr["error_no"]); exit; } $httpParsedResponseAr = $ppResponseAr["httpParsedResponseAr"]; // assign posted variables to local variables $item_name = $httpParsedResponseAr['item_name']; $item_number = $httpParsedResponseAr['item_number']; $receiver_email = $httpParsedResponseAr['receiver_email']; $receiver_id = $httpParsedResponseAr['receiver_id']; $quantity = $httpParsedResponseAr['quantity']; $first_name = $httpParsedResponseAr['first_name']; $last_name = $httpParsedResponseAr['last_name']; $payer_email = $httpParsedResponseAr['payer_email']; $txn_type = $httpParsedResponseAr['txn_type']; $address_street = $httpParsedResponseAr['address_street']; $address_city = $httpParsedResponseAr['address_city']; $address_state = $httpParsedResponseAr['address_state']; $address_zip = $httpParsedResponseAr['address_zip']; $item_number = $httpParsedResponseAr['item_number']; $option_name1 = $httpParsedResponseAr['option_name1']; $option_selection1 = $httpParsedResponseAr['option_selection1']; $option_name2 = $httpParsedResponseAr['option_name2']; $option_selection2 = $httpParsedResponseAr['option_selection2']; $invoice = $httpParsedResponseAr['invoice']; $custom = $httpParsedResponseAr['custom']; $payer_id =$httpParsedResponseAr['payer_id']; ?> <html lang="en"> <head> <title>Rec</title> <link REL="stylesheet" href="include/style.css" type="text/css"> <!--[if IE]> <link REL="stylesheet" href="include/styleIE.css" type="text/css"> <![endif]--> <style> #center_block {width:50%;margin:0 auto;min-width:500px;} #contents_block {text-align:center;} #header_block {white-space:nowrap;height:25px;padding:0 10px 5px;text-align:center;} #fields_block {width:100%;margin:0;padding:10px} #header_block span {margin:0 5px} #buttons_block {padding:10px 10px 5px} #buttons_block div {padding:3px} #delimiter {margin:2px} #fields_block td {padding:3px 14px} #username_block td {padding-top:13px;white-space:nowrap;} #remember_block td {padding-bottom:13px;white-space:nowrap;} #required_block {text-align:left;padding:5px} </style> <!--[if IE]> <style> #main_block {width:100%} </style> <![endif]--> </head> <body> <script language="JavaScript" src="include/jquery.js"></script> <script language="JavaScript" src="include/jsfunctions.js"></script> <script language="JavaScript" src="include/runnerJS/RunnerBase.js"></script> <form action="rec.php" method="post" id="rec" name="rec.php"> <table id="center_block" align="center"> <tr><td id="contents_block"> <div class="main_table_border2 loginshade" id="main_block"> <table cellpadding=0 cellspacing=0 border=0 id="fields_block" class="loginshade"> <tr id="email_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_email_1">Email:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_email_0" style="white-space: nowrap;"><input id="value_email_1" style="" type="text" name="value_email_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["payer_email"]) ?>"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="pass_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_pass_1">Pass:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_pass_0" style=""><input style="" id="value_pass_1" type="Password" name="value_pass_1" maxlength=50 value="1234"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="confirm_block"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_confirm_1">Re-enter password:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_confirm_0" style=""><input style="" id="value_confirm_1" type="Password" name="value_confirm_1" value="1234"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="fname_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_fname_1">First Name:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_fname_0" style="white-space: nowrap;"><input id="value_fname_1" style="" type="text" name="value_fname_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["first_name"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="lname_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_lname_1">Last Name:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_lname_0" style="white-space: nowrap;"><input id="value_lname_1" style="" type="text" name="value_lname_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["last_name"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="address_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_address_1">Address:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_address_0" style="white-space: nowrap;"><input id="value_address_1" style="" type="text" name="value_address_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_street"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="city_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_city_1">City:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_city_0" style="white-space: nowrap;"><input id="value_city_1" style="" type="text" name="value_city_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_city"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="state_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_state_1">State:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_state_0" style="white-space: nowrap;"><input id="value_state_1" style="" type="text" name="value_state_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_state"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="zip_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_zip_1">Zip:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_zip_0" style="white-space: nowrap;"><input id="value_zip_1" style="" type="text" name="value_zip_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_zip"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="cosponsor_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_cosponsor_1">Cosponsor:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_cosponsor_0" style=""><input id="type_cosponsor_1" type="hidden" name="type_cosponsor_1" value="checkbox"><input id="value_cosponsor_1" type="Checkbox" name="value_cosponsor_1" ></span> </td> </tr> <tr id="recipients_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_recipients_1">Recipients:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_recipients_0" style="white-space: nowrap;"><input id="value_recipients_1" style="" type="text" name="value_recipients_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["quantity"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="clients_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_clients_1">Clients:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_clients_0" style=""><input id="type_clients_1" type="hidden" name="type_clients_1" value="checkbox"><input id="value_clients_1" type="Checkbox" name="value_clients_1" ></span> </td> </tr> <tr id="space_block"></tr> </table> </div> </td></tr> </table> <input type=submit value="Submit" class=button id="saveButton1" onload="Submit"></form> </body> </html> Friends I am new to php and i have to submit my coursework in php by 3rd dec, I stuck at one place where i have to upload multiple photo and one can see all the photo he has uploaded and can edit or delete that photo so i have done uploading now i am showing those pics in table by running loop and generating tr and td but now i have two buttons with each row edit and delete now when i clicked on one delete or edit that pic should be delete or give text box to edit description of pic, Please help me how to do that....... If you look at this form: kmkwebdevelopment.com/formtest/upload.php you will see that when you click on the "add another upload box" button, instead of it adding another upload box, it is submitting the form for some reason. Can anyone see where the error lies? Relevant snippet of code below: <?php //deafult number of upload boxes $upload_quant = 4; //if the user increased the number of boxes if(isset($_POST['increase_upload'])) { //increasing the number of upload boxes $upload_quant = $_POST['previous_upload'] + 1; } $upload_quantity = $_POST['previous_upload']; //getting all the names into an array $uplaoded_array = array(); for($i=0;$i<$upload_quantity;++$i) { $ii = $i+1; $upload_name = 'upload'.$ii; $get_upload_name = $_POST['$upload_name']; array_push($uplaoded_array,$get_upload_name); } ?> <form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);"> <?php IsThereErrors("0", $_iserrors); ?> <input type="hidden" name="_referer" value="<?php echo $_referer ?>"> <input type="hidden" name="_next_page" value="1"> <p class="form_expert_style"><input name="URL" type="text" value=""/></p> <table> <tr> <td>First Name *</td> <td><input type='text' size='30' name='firstname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("firstname", "") ?> value="<?php echo isset($_values["firstname"]) ? htmlspecialchars($_values["firstname"]) : "" ?>"></td> </tr> <tr> <td>Last Name *</td> <td><input type='text' size='30' name='lastname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("lastname", "") ?> value="<?php echo isset($_values["lastname"]) ? htmlspecialchars($_values["lastname"]) : "" ?>"></td> </tr> <tr> <td>E-mail *</td> <td><input type='text' size='30' name='email' onblur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("email", "") ?> value="<?php echo isset($_values["email"]) ? htmlspecialchars($_values["email"]) : "" ?>"></td> </tr> <tr> <td>Company Number *</td> <td><input type='text' size='30' name='companynumber' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("companynumber", "") ?> value="<?php echo isset($_values["companynumber"]) ? htmlspecialchars($_values["companynumber"]) : "" ?>"></td> </tr> <?php for($i=0;$i<$upload_quant;++$i) { $ii = $i+1; $upload_name = 'upload'.$ii; echo <<<_END <tr> <td>Upload $ii</td> <td><input class="image" type='file' size='30' name='$upload_name'></td> </tr> _END; } echo <<<_END <tr> <td> <input type="hidden" value="$upload_quant" name = "previous_upload"/> <input type="submit" name="increase_upload" value="Add another upload box" /> </td> <tr> <td><input type="submit" name="SubmitBtn" onClick="CheckForm1();" value="SUBMIT" /></td> </tr> </table> </form> _END; } ?> </html> <?php Thanks how do I make a link as a submit button? action is dashboard.php. help please Code: [Select] <?php include('../../header.php'); ?> <from method="post" action=""> <input type="checkbox" name="confirmation" value="yes" /> I do confirm to get my password reseted.<br /> <input type="submit" name="submit_confirmation" value="Confirm" /> </from> <?php if (isset($_POST['submit_confirmation'])) $submit_confirmation = $_POST['submit_confirmation']; if (isset($_POST['confirmation'])) { $confirmation_checkbox = $_POST['confirmation']; } if (isset($submit_confirmation)) { echo "works"; } // Check if the user has confirmed the resetting. if (isset($submit_confirmation) && isset($confirmation_checkbox) && $confirmation_checkbox == 'yes') { This is a password resetting script, this script in example occurs after confirmation to have the password reset, the problem I am experiencing is that the script does not get executed and seems that the submit button does not even work to execute the script. I tried to test the submit button by printing out a message stating "works" when pressing the submit button, but that one does not work either. The execution of the whole script does not go path the conditional if statement check in the bottom area, and the statement "works" does not become printed out. Any ideas what is going on here? Here is the whole php file: Code: [Select] <?php include('../../header.php'); ?> <from method="post" action=""> <input type="checkbox" name="confirmation" value="yes" /> I do confirm to get my password reseted.<br /> <input type="submit" name="submit_confirmation" value="Confirm" /> </from> <?php if (isset($_POST['submit_confirmation'])) $submit_confirmation = $_POST['submit_confirmation']; if (isset($_POST['confirmation'])) { $confirmation_checkbox = $_POST['confirmation']; } if (isset($submit_confirmation)) { echo "works"; } // Check if the user has confirmed the resetting. if (isset($submit_confirmation) && isset($confirmation_checkbox) && $confirmation_checkbox == 'yes') { // Reset the password of the user $random_password = random(111111, 999999); $query_get = "UPDATE user SET password = '$random_password' WHERE user_id = '{$_GET['id']}' and random = '{$_GET['code']}'"; $query_run = mysqli_query($dbc, $query_get); // Get the email address and user name of the user $query_get = "SELECT nickname, email FROM user WHERE user_id = '{$_GET['id']}'"; $query_run = mysqli_query($dbc, $query_get); $assoc = mysqli_fetch_assoc($query_run); $to = $assoc['email']; $subject = "Your Reseted Password"; $sender = 'From: rochoven@googlemail.com'; $body = ' Hello' .$assoc['nickname']. ', \n\n you requested and confirmed to have your password reseted, here is your new password, please use it to log in and change it to your desired password. \n\n New Reseted Password:' .$random_password. '\n\n Greetings! '; mail($to, $subject, $body, $sender); mysqli_close($dbc); header('Location:'.$password_reset_success); } ?> <?php include('../../footer.php'); ?> Hi, I am trying to using an image as the submit but I cant get it to work, I have tried around ten different options but when I click the image not happens. (It works with plain submit button). Can anyone advise please. I cant quite believe I cant get it to work. Do I need to change the form action? Code: [Select] <form action="" method="post"> ----form---- <input type="image" value="submit" name="image" src="http://www.domain.co.uk/images/homepageregister.PNG" > I think I'm using the wrong method, but GET and POST don't seem to fit in at all. I'm making a random game where they can only play 20 times a day. Once they hit that roll again button, I want a string to go into the database. And then after that, I will pull all those.. whatever I know how to do that part, but I just want to know why the button isn't making it insert all those values into the fields. <?php $dice = rand(1,6); echo "You rolled a<br /><b>{$dice}</b>\n"; $winnings = "500"; if($dice == 6) { include("haha.php"); $cxn = mysqli_connect($dbhost,$dbuser,$dbpassword,$dbdatabase); $username = $cxn->real_escape_string($_SESSION['username']); $sql = "UPDATE `Member` SET `rp` = rp+$winnings WHERE `username` = '$username'"; mysqli_query($cxn,$sql); }?> <FORM ACTION="random.php" METHOD="post"> <INPUT TYPE="submit" VALUE="Roll Again! NAME="sixdice"> </FORM> <?php if (@$_POST['sixdice']) { include("haha.php"); $cxn = mysqli_connect($dbhost,$dbuser,$dbpassword,$dbdatabase); $userid = "$_SESSION['userid']"; $username = "$_SESSION['username']"; $sql = "INSERT INTO Sixdice (userid,username,rolltime) VALUES ('$userid','$username',NOW())"; $result = mysqli_query($cxn,$sql) or die("Query died: insert"); } ?> Whenever I hit the submit button, it's not even reading if they hit it and doing all that if and else statements I have. Why is not noticing the submit button? I had this working last night, but my dumb self saved over it with another file I was editing. Code: [Select] <?php session_start(); include("config.php"); include("logincheck.php"); $time = date_default_timezone_set("US/Eastern"); $timeformat = date("Y-m-d H:i:s"); $author = $_SESSION['username']; $title = $_POST['title']; $body = $_POST['body']; if (isset($_POST['submit'])) { if (!empty($title)) { if (!empty($body)) { $sql = "INSERT INTO news (author, title, body, time) VALUES ('$author', '$title', '$body', NOW())"; mysqli_query($cxn, $sql); $error = "Your news posting has been submitted successfully."; } else { $error = "You must fill out the body of the posting!"; } } else { $error = "You must fil out the title of the posting!"; } } $sql = "SELECT userlevel FROM members WHERE userid='".$_SESSION['userid']."'"; $result = mysqli_query($cxn, $sql); $row = mysqli_fetch_array($result); if ($row['userlevel'] != 2) { $error = "You do not have the power to view this page!"; header("Location: news.php"); } else { ?> <?php include("header.php"); ?> <h1>Post News</h1> <?php echo $error; ?> <form method="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post"> <b>Author:</b> <?php echo $author; ?><br> <b>Title:</b><br> <input type="text" maxlength="25" name="title" value="<?php echo $title; ?>" /><br> <b>Body:</b><br> <textarea name="body" maxlength="999" rows="10" cols="40"><?php echo $body; ?></textarea><br> <input type="submit" name="submit" value="Post News" /> </form> <?php } ?> <?php include("footer.php"); ?> I have a button that increases a counter (which also a link to a file) beside it. Code: [Select] echo "<tr>"; echo "<td name='".$cell1['value']."'>".$cell1['value']."</td><td name='".$cell2['value']."'><a href='file.php'>".$counter."</a><input type='button' name='buttonName' onclick='submit('.$cell1['value'].');'></td> <td name='".$cell2['value']."'><a href='file.php'>".$counter."</a><input type='button' name='buttonName' onclick='submit('.$cell1['value'].');'></td>"; echo "</tr>";When one of the buttons is clicked I want to pass cell1value to the processing script. Is this the correct way to do it? And how do I access $cell1['value'] after submission? Hello, Im new to website building. I have created a login system. The login system echoes some text when the username and password is correct. However, if correct i would like it to open another page on my site. Code: [Select] <form name="form1" method="post" action=""> <p>Username <label> <input type="text" name="username" id="username"> </label> Password <label> <input type="password" name="password" id="password"> </label> <input name="login" type="submit" id="login" value="Login"> <?php $username = $_POST ["username"]; $password = $_POST ["password"]; if ($username == "admin" && $password == "password"){ echo"Logged In";} ?> </p> </form> I am a novice and learnt this via youtube. However, can't find a tutorial for what i want. Thanks This may be a bit removed from straight php, but I have a submit button for an e-commerce site as the final step. It runs through all of the php steps and submits the order. The problem is....sometimes the submit button doesn't do anything for some users. They hit it and nothing happens. Is there a way I can verify everything is loaded correctly with php? Its hard to nail it down to a specific problem. Has anyone had this issue in the past? Hello I'm using a form with a dropdown list. When the user select "Test1" in the dropdown then press the button "Submit" it has to send the data to www.test1.com. When the user select "Test2" in the dropdown then press the button "Submit" it has to send the date to www.test2.com. Also the data they've filled in has to come with. I'm working with a datacheck.php, so when the press submit it post to datacheck.php and there I have following code: <?php if(isset($_POST['TEST1']) && $_POST['TEST1']== 'Y'){ header("Location: http://mysite.com/sage/page1.php"); } else { header("Location: http://mysite.com/sage/page2.php"); } ?> here is the code Code: [Select] <label for="rank">Font</label> <select class="element select medium" id="fonts" onchange="<?php echo 'selected'; ?>" name="fonts"> <option value="Arial" selected="selected">Arial</option> <option value="times" selected="selected">Times New Roman</option> </select> It is supposed to echo the value selected but it does nothing any ideas regarding what i should do? Also what i really want to do is create a cookie which will contain the selected value and then use this value of the cookie later. But I cant even manage to echo the values so thought it would be better to first learn how to echo and then try to create a cookie out of it I have this piece of code: Code: [Select] if (isset($_POST['type1'])) { mysql_query("UPDATE tabke SET status = 1 WHERE id = $rid", $c2) or die(mysql_error()); } if (isset($_POST['type2'])) { mysql_query("UPDATE table SET status = 1 WHERE id = $rid", $c2) or die(mysql_error()); } if (isset($_POST['type3'])) { mysql_query("UPDATE table SET status = 1 WHERE id = $rid", $c2) or die(mysql_error()); } ?> <br /> <form method="post" action=""> <input type="hidden" name="pageid" value="plyrmgmt"> <input type="hidden" name="action" value="changeBan"> <input type="hidden" name="uid" value="<?php echo $hr_uid; ?>"> <input type="hidden" name="repid" value="<?php echo $rid; ?>"> <input type="submit" name="type1" value="Choice1" onClick="this.form.submit()"> </form> <form method="post" action=""> <input type="hidden" name="pageid" value="plyrmgmt"> <input type="hidden" name="action" value="changeMute"> <input type="hidden" name="uid" value="<?php echo $hr_uid; ?>"> <input type="hidden" name="repid" value="<?php echo $rid; ?>"> <input type="submit" name="type2" value="Choice2" onClick="this.form.submit()"> </form> <form method="post" action=""> <input type="hidden" name="pageid" value="plyrmgmt"> <input type="hidden" name="action" value="changeLock"> <input type="hidden" name="uid" value="<?php echo $hr_uid; ?>"> <input type="hidden" name="repid" value="<?php echo $rid; ?>"> <input type="submit" name="type3" value="Choice3" onClick="this.form.submit()"> </form> Now, for some reason when I click on Choice1, the query doesn't execute. Also, when I click on Choice2 or Choice3, the URL in my browser doesn't change for some odd reason...it stays the same as it was prior to clicking the Submit Button. Can anyone point out some errors I have? Thanks, Mark. Hi all, I have a regular comment section and i want the submit button to call a mysql_query function in comment.class.php so Code: [Select] <form method="post" action="../php/comment.class.php?action=addcomment" name="commentform" id="commentform" onsubmit="validateForm()"> <label for "body">Your Comment</label> <div><textarea cols="20" rows="4" name="body" id="body"></textarea></div> <input type="submit" id="submit" value="Submit"/> and my comment.class.php is... Code: [Select] function addcomment($body){ $body=mysql_real_escape_string($_POST['body']); if($body!=''){ mysql_query("INSERT INTO comment(uid,screenname,body) VALUES ('$_SESSION[uid]','$_SESSION[screenname]','$body')") or die('lame'); } header("location:../index.php"); } but when I click submit, i'm taken to a blank page with the URL: http://test/php/comment.class.php?action=addcomment any tips? and is there a better alternative to header? Thanks Hey guys! I've looked through this code over and over today, and I still haven;t found where my error is. Here is my entire code: Code: [Select] <?php session_start(); include("config536.php"); ?> <html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <?php if(!isset($_SESSION['username'])) { echo "<banner></banner><nav>$shownavbar</nav><ubar><a href=login.php>Login</a> or <a href=register.php>Register</a></ubar><content><center><font size=6>Error!</font><br><br>You are not Logged In! Please <a href=login.php>Login</a> or <a href=register.php>Register</a> to Continue!</center></content>"; } if(isset($_SESSION['username'])) { echo "<nav>$shownavbar</nav><ubar>$ubear</ubar><content><center><font size=6>Quest Agency</font><br><br>"; $startjob = $_POST['submit']; $jobq = "SELECT * FROM jobs WHERE username='$showusername'"; $job = mysql_query($jobq); $jobnr = mysql_num_rows($job); if($jobnr == "0") { ?> <form action="<?php echo "$PHP_SELF"; ?>" method="POST"> <input type="submit" name="submit" value="Start Job"></form> <?php } if(isset($startjob)) { $initemidq = "SELECT * FROM items ORDER BY RAND() LIMIT 1"; $initemid = mysql_query($initemidq); while($ir = mysql_fetch_array($initemid)) { $ids = $ir['itemid']; } mysql_query("INSERT INTO jobs (username, item, time, completed) VALUES ('$showusername', '$ids', 'None', 'No')"); $wegq = "SELECT * FROM items WHERE itemid='$ids'"; $weg = mysql_query($wegq); while($wg = mysql_fetch_array($weg)) { $im = $wg['image']; $nm = $wg['name']; $id = $wg['itemid']; } $_SESSION['theid'] = $id; $yeshere = $_SESSION['theid']; echo "<font color=green>Success! You have started this Job!</font><br><br>Please bring me this item: <b>$nm</b><br><br><img src=/images/items/$im><br><br><br>"; } if($jobnr == "1") { $yeshere = $_SESSION['theid']; $finish = $_POST['finish']; $quit = $_POST['quit']; $okgq = "SELECT * FROM items WHERE itemid='$yeshere'"; $ok = mysql_query($okgq); while($ya = mysql_fetch_array($ok)) { $okname = $ya['name']; $okid = $ya['itemid']; $okimage = $ya['image']; } $yeshere = $_SESSION['theid']; echo "Where is my <b>$okname</b>?<br><br><img src=/images/items/$okimage><br><br><br>"; ?> <form action="<?php echo "$PHP_SELF"; ?>" method="POST"> <input type="submit" name="finish" value="I have the Item"><br><br> <input type="submit" name="quit" value="Quit"></form> <?php } } if(isset($finish)) { $yeshere = $_SESSION['theid']; $cinq = "SELECT * FROM uitems WHERE theitemid='$_SESSION[theid]'"; $cin = mysql_query($cinq); $connr = mysql_num_rows($cin); if($connr != "0") { mysql_query("DELETE FROM uitems WHERE username='$showusername' AND theitemid='$yeshere' LIMIT 1"); mysql_query("UPDATE users SET jobs=jobs+1 WHERE username='$showusername'"); mysql_query("UPDATE users SET credits=credits+320 WHERE username='$showusername'"); mysql_query("DELETE FROM jobs WHERE username='$showusername'"); echo "<font color=green>Success! You have completed this job! You have been given <b>320</b> credits as an award. Thank You!</font>"; } else { echo "<font color=red>Error! You do not have my item!</font>"; } if(isset($quit)) { mysql_query("DELETE FROM jobs WHERE username='$showusername'"); echo "<font color=green>Success! You have quit this quest.</font>"; } $yeshere = $_SESSION['theid']; } ?> The variable for the button is: $quit = $_post and I want the quit button to work. Does anybody know why it will not work? Thank you in advance! So I posted something like this a while ago but i didn't get any particularly good answers so I redid it. this is what I have now. It takes clicking the reply three times before it changes changes the form but then after that initial session of reply button clicks it only takes two which is what I want. This is the last thing on my forum (at least till I find some other bug :p) and I need it fixed but I can't figure it out. IT\t wouldn't be a huge issue but the thing is that the first reply you make someone would fill it all in and then press reply then they would lose all their stuff and have to start over before it was submitted, Help please! thanks! Code: [Select] <form action="<?php if ($_SESSION['logged_in'] == '1') { if ((isset($_POST['reply_to_thread'])) && ($_SESSION['reply_has_been_clicked'] != '1')) { echo $this_thread_path; } elseif ((isset($_POST['reply_to_thread'])) && ($_SESSION['reply_has_been_clicked'] == '1')) { $_SESSION['reply_has_been_clicked'] = '0'; $_SESSION['came_from_a_page'] = '1'; echo 'thread_redirect.php'; }}?>" method='post'> <?php if ($_SESSION['logged_in'] == '1') { if ((isset($_POST['reply_to_thread'])) && ($_SESSION['reply_has_been_clicked'] != '1')) { echo '<textarea name="reply_body" cols="75" rows="10" style="resize:none; onKeyUp="limitText(this.form.reply_body,this.form.countdown,5000); onKeyDown="limitText(this.form.reply_body,this.form.countdown,5000);">Enter your reply here...</textarea><br><br><font size="1">(Maximum characters: 5000)<br> You have <input readonly type="text" name="countdown" size="3" value="5000"> characters left.</font><br>'; $_SESSION['reply_has_been_clicked'] = '1'; } } ?> <input type='submit' name='reply_to_thread' value="Reply"> <?php if (isset($_POST['reply_to_thread'])) { if ($_SESSION['logged_in'] != '1') { echo 'You need to be logged in!'; } } ?> </form> I'm having problems creating a working submit button for a php script. The script is sitting on index.php and if I browse to that page it will send the email as required... great. So I though happy days I'll make a simple button for it... 6 hours later no joking. Firstly this is working php <?php require 'includes/PHPMailer.php'; require 'includes/SMTP.php'; require 'includes/Exception.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = "true"; $mail->SMTPSecure = "tls"; $mail->Port = "587"; $mail->Username = "Myemail@gmail.com"; $mail->Password = "Pass"; $mail->Subject = "Test email using PhPmailer"; $mail->setFrom("Myemail@gmail.com"); $mail->isHTML(true); $mail->addAttachment('img/LifesaverFootage.mp4'); $mail->Body = "<h1>This is a HTML heading</h1></br><p>Title</p>"; $mail->addAddress("myemail@gmail.com"); if ($mail->Send() ) { echo "Email sent..!"; } else{ echo "Error..!"; } $mail->smtpClose(); ?> Now I've been at this with everything but a blow torch these are some attempts below. I've also tried to just href to the page. All that happens is it creates another copy of the index.php file as if it were a download. The last thing I wanted to do was wrap this up as a function and I wanted to try something to do with Isset. But it won't even load the page if I define it as a function and then call it. I know I'm defining and calling the function correctly as I can do an echo function. Surely it couldn't be this hard. I mean all the thing has to do is dang trigger the page for goodness sake. Lol sighhhhhhh...Please help
<!--
</body> Here is code that i want to redirect after submitting to another url
<div class="js-ticket-form-btn-wrp"> |