PHP - Auto Submit Button, I Am So Tired Of Reading That An Auto Submit Button Is Lame
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> Similar TutorialsI have a template written for me on another project that searches a MySQL database. I'm moving this template to work with a database that only have 10 records in it and instead of having a search option I would just like it to automatically display the database when the page opens. Is this possible? The php page in close to 200 lines. This is the line of the code that has the search option. If you need more I can post it. Thanks Bob Code: [Select] <div id="search"> <form action="parts.php" method="GET"> Search: <input type="text" value="'.htmlentities($_GET['s']).'" name="s"/> <input type="submit" value="Search!"/> </form> </div> 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"); ?> So a project I have simply to learn how it is done is to make an auto updating sitemap with a auto submitter. I have been doing a little research on sitemaps but haven't found much in the way of a tutorial or white paper or similar, anyway I was wondering if I am on the right track or not. What I was thinking for the auto-updating sitemap is since site maps are XML, when an article is published using my custom CMS/Blogging system, I make it rewrite the sitemap appending the new URL that will be generated. Then for the auto-submit, I can either make it a cron job or just manual press, but it would go though a for list of URLs, replacing the end part with my site map url. I think that is how it would be done. If you have a better idea, or can point out an article so I can understand a lot more with sitemaps, I will appreciate it, I am trying to learn as much as possible, I have gone to the offical website (sitemaps.org) but it doesn't have what I am looking for. Thanks, James //php code <?php include_once('con.php'); if(!empty($_GET['search'])) { $search = $connect->prepare('SELECT * FROM posts WHERE title LIKE :search'); $search->bindValue(':search', '%'.$_GET['search'].'%', PDO::PARAM_STR); $search->execute(); ?> <?php while($row = $search->fetch()) {?> <li class="result" onClick="searchValue('<?php echo $row['title'];?>')"><?php echo $row['title'];?></li> <?php } ?> <?php } ?> //ajax $('#inputsch').keyup(function(){ $.ajax({ type: 'GET', url: 'fetch.php', data:'search='+$(this).val(), success: function(data){ $('#box').show(); $('#box').html(data); } }); }); }); function searchValue(val) { $('#inputsch').val(val); $('#box').hide(); } //search box <form action="search.php"> <input id="inputsch" type="text" name="search" placeholder="search..." autocomplete="off" autofocus> <button type="submit" value="search" >search</button> </form> <div id="box"></div> //the problem here is when i click the result is only added to input, but i want it to autosubmit
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....... Hi,
I'm a novice and have the below code in a Wordpress theme. I'm trying to get the form to submit automatically so it logs an entry into the MySql db as though the person clicked the heart icon (submit). Ideally I subsequently want to hide the heart icon so on load maybe after 3 seconds the entry is auto fired to the MySql DB.
I have got as far as the manual click adding the entry, however can't get to to auto submit, any gel would be appreciated. Thank you in advance.
////PHP Form/////
<form class="ajax-form" action="<?php echo AJAX_URL; ?>" method="POST"> Hey Everyone, I'll start by saying that I am a very novice php programmer. But I am working on a file storage website, and I have it working and running properly, what you see here is on a new page called index2.php (Thought you might need to know) and full working version can be found here, http://www.jstpreview.net84.net now want I want the site to do is automatically generate a new .php or .html page once the user presses the "submit" button, I've looked through many tutorials to figure this out but anything I have tried so far didn't work. So anyways, the page generated should be named the name of the file uploaded plus the extension. I also want this page to be generated using a pre-uploaded template but if you look at the code, you will see that I havn't implemented that part yet. Code: [Select] <?php //Load the settings require_once("settings.php"); $message = ""; //Has the user uploaded something? if(isset($_FILES['file'])) { $target_path = Settings::$uploadFolder; $target_path = $target_path . time() . '_' . basename( $_FILES['file']['name']); //Check the password to verify legal upload if($_POST['password'] != Settings::$password) { $message = "Invalid Password!"; } else { //Try to move the uploaded file into the designated folder if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $message = "The file ". basename( $_FILES['file']['name']). " has been uploaded"; } else{ $message = "There was an error uploading the file, please try again!"; } } //Clear the array unset($_FILES['file']); } if(strlen($message) > 0) { $message = '<p class="error">' . $message . '</p>'; } /** LIST UPLOADED FILES **/ $uploaded_files = ""; //Open directory for reading $dh = opendir(Settings::$uploadFolder); //LOOP through the files while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..') { $filename = Settings::$uploadFolder . $file; $parts = explode("_", $file); $size = formatBytes(filesize($filename)); $added = date("m/d/Y", $parts[0]); $origName = $parts[1]; $filetype = getFileType(substr($file, strlen($file) - 3)); $uploaded_files .= "<li class=\"$filetype\"><a href=\"$filename\">$origName</a> $size - $added</li>\n"; } } closedir($dh); if(strlen($uploaded_files) == 0) { $uploaded_files = "<li><em>No files have been uploaded yet!</em></li>"; } function getFileType($extension) { $images = array('jpg', 'gif', 'png', 'bmp'); $docs = array('txt', 'rtf', 'doc'); $apps = array('zip', 'rar', 'exe'); if(in_array($extension, $images)) return "Images"; if(in_array($extension, $docs)) return "Documents"; if(in_array($extension, $apps)) return "Applications"; return ""; } function formatBytes($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } ?> <!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=ISO-8859-1" /> <style type="text/css" media="all"> @import url("style/style.css"); </style> <script src="http://code.jquery.com/jquery-latest.js"></script> <title>JetStorm Technologies | Staff - CloudNet</title> </head> <body> <div id="container"> <h1></h1> <form method="post" action="index.php" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="15728640" /> <fieldset> <legend>Add a new file to CloudNet:</legend> <?php echo $message; ?> <p><label for="name">Select file:</label><br /> <input type="file" name="files" /></p> <p><label for="password">Authentication for upload:</label><br /> <input type="password" name="password" /></p> <p><input type="submit" name="submit" value="Start upload" /></p> </fieldset> </form> <fieldset> <center> <?php if(isset($_FILES['file'])); //else $file=1; $file = $_POST["$origName"]; // grabbed from the form $file = fopen("filepages/" . $origName .".php","x"); //(Creates the file) fwrite($out, "<p> Man this really does not work $origName</p>"); // Generates the contents of file ?> </center> </fieldset> <fieldset> <legend>Previousely uploaded files</legend> <ul id="menu"> <li><a href="">All files</a></li> <li><a href="">Documents</a></li> <li><a href="">Images</a></li> <li><a href="">Applications</a></li> </ul> <ul id="files"> <?php echo $uploaded_files; ?> </ul> </fieldset> </div> <script src="js/filestorage.js" /> </body> </html> I would greatly appreciate it if someone can point out and fix the errors in this code, but it would be even more appreciated if someone could provide a working source code of auto-generation of pages on form submit. Thanks in advanced Can someone help me with this.. I cannot figure out why it will not log in.. The actual url and user/pass are valid so feel free to test the live site. <?php // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, 'http://www.handy-hanky.com/shirley/homesell_cron.htm'); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'user=tom&pass=test&login_theme=cpanel'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (FORM LOGIN) $store = curl_exec ($ch); echo "STORE = $store<br>"; // CLOSE CURL curl_close ($ch); ?> Hi all !
I wish to post the value of an auto submit dropdown value to another page, be redirected to that page, and use it on that page. I am unable to achieve this in php and so I tried as :-follows:-
dropdown.php
<form method="post" action = dropdownaction.php> <select name="myselect" onchange="this.form.submit();"> <option>blue</option> <option>red</option> </select> </form>and now I need the equivalent of dropdownaction.php <?php if(isset($_POST(['myselect']))) echo " I am selected".$_POST['myselect']; ?>Please can someone tell me how I may retrieve the value of 'myselect' in the dropdownaction.php after being redirected to it. Thanks loads. i got a submit button... if user click the submit button iwant to page will auto referesh... can someone teach me 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 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"); } ?> sorry solved this one, I didnt put the submit button in the <form> </form> tag lmfao... 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 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'); ?> how do I make a link as a submit button? action is dashboard.php. help please 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? Hi there once again, sry for previous wrong section, i guess this time i'm on the right place ;p Well i need following: I have few forms (input fields) with requested informations, also i have other .php file which i'm calling to send a form. Now i need to know how can i do a check for those fields if they are empty or not. If they are, i need to STOP submiting the form (calling the other .php). Codes: Form: Code: [Select] <form name="f1" form method="post" action="posalji.php"/>Field: Code: [Select] <input type="text" name="hp1" size="20"/>Submit: Code: [Select] <input name="f1" type="image" src="registruj.png" onclick="if(f1.hp1.value.length==0) alert('Error: field can't be empty'); else f1.submit(); if(f1.hp2.value.length==0) alert('Error: field can't be empty'); else f1.submit();"/>There are more than one field, that's why you can see more errors in submit. Well all i need is "die" or "stop" calling the "posalji.php" from action above. Sry 4 poor english. |