PHP - Changing Text On "submit Query" Button
Hi. I have just one question (I have searched for an answer for this but have not been able to locate one):
How do you go about changing the text on a "Submit Query" button to display simply "Submit"? Below is the current code for the page that displays said button. Thank-you in advance for any help or direction. <?php include 'connection.php'; $query = "SELECT * FROM people"; $result = mysql_query($query) or die(mysql_error()); while ($person = mysql_fetch_array($result)){ echo $person ['name']; echo $person ['descrip']; } ?> <H1>Add Your Review:</H1> <form action="create.php" method="post"> Subject <input type="text" name="inputName" value=""/> </br > Review <textarea cols="50" rows="4" name="inputDesc" value=""/></textarea> </br > <input type= "submit" name= "submit"/> </form> <html> <head></head> <body> <p>The current second is <span style='font-size:16px;font-weight:bold;color:red;position:absolute;right:25px;'><?php echo time(); ?></span> on this computer.</p> </body> </html> Similar TutorialsIf 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 Can someone please help me with an array problem i can not figure out. I need the array to be numbered from 1 to how ever many fields that are needed in the form and have a mysql field name and the title of the field also in the array. 1, "mysql_field_name", "Title of form field" 2, "", "" and so on then the form will be shown based on the array. I have the following draft code which I am working with. any suggestions on how i may do this array ? Code: [Select] <?php $options = array( '1'=> array('fieldtext'=>'option1', 'mysqlfield'=>'option1'), '2'=> array('fieldtext'=>'option2', 'mysqlfield'=>'option2'), '3'=> array('fieldtext'=>'option3', 'mysqlfield'=>'option3'), '4'=> array('fieldtext'=>'option4', 'mysqlfield'=>'option4'), ); // $options = array(1 => "option1", "option2", "option3", "option4"); // the line above works but i want to include the name of the mysql field as well. $userid = 1; ?> <div style="align: center; margin: 12px; font-family:Tahoma;"> <br><br><?php if ($_POST['Update'] != "Update") { // check if form submitted yet, if not get data from mysql. $res = db_query("SELECT * FROM `users` WHERE `userid` = '" . $userid . "'"); foreach($options as $key => $value) { $_POST[$key] = mysql_result($res, 0, $value); } $ok_to_update = "no"; } elseif ($_POST['Update'] == "Update") { // check if form submitted yet, if so get POST data. // error checking // foreach($options as $key => $value) { // $_POST[$i] = ""; // } $ok_to_update = "yes"; } if ($_POST['Update'] == "Update" && $ok_to_update == "yes") { // $res = db_query("INSERT INTO `users` () VALUES ()"); // add user details to database. ?><p><br><br><br>Thank you for updating</p><?php } else { ?><form name="form1" method="post" action=""> <?php foreach($options as $key => $value) { ?><p><?php echo($value); ?>: <input type="text" name="<?php echo($key); ?>" value="<?php echo($_POST[$key]);?>"></p> <?php } ?> <input name="Update" type="submit" value="Update"> </form> <?php } ?> </div> Hi, bit stuck on how to find and replace "<" and ">" with "<" and ">". I basically have a database record that outputs to screen and I need the code in the <code> tags to be rendered to the screen. I therefore need it to go through the whole array variable from the db and change the symbols just inside the code tags. Please be aware that the code tags might happen more than once here's an example below Code: [Select] <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1> </code> <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1> </code> the desired output would be: <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1 </code> <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1 </code> help on this would be great Cheers Rob Hi guys I am a newbie with PHP and I have been trying to solve this problem for 3 days.. Ive set up a booking form on my website to be sent directly to my email once the client clicked on the send button.. The problem I am having while checking these pages on wamp is that the booking form is ok but when I click on the send button the following message error appears "Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\fluffy_paws\booking_form2.php on line 27" When I check online I have this message "500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed." Are my codes wrong??? My webhosting is Blacknight.com , Im on Windows Vista, my internet is a dongle with O2 ireland Thanks for your help! Hi guys I'm struggling a bit, I need to replace a word that occurs multiple times in text with an array("up","down","forward","backwards") of words. $find = "left"; $replace = array("up","down","forward","backwards"); $text = "left left left left"; echo str_replace($find,$replace,$text); The Output is: array array array array Did try this with a foreach statement as well, but no luck. Is there a better way of doing this? Thanks cant work out this mysql syntax error "operation":"medupdate","medid":"","name":"ibo","medyear":"5","medmonth":"21","medday":"1","recuser":1,"SuccFail":"fail","SuccFailMessage":"error occured You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''WHERE med_id=' at line 2","ResultData":""} Code: [Select] $sql="update metodology set med_description='".$req['name']."', med_year='".$req['medyear']."', med_month='".$req['medmonth']."', med_day='".$req['medday']."', med_recorddate= now(), med_recorduserid= 1'"; $sql.= " WHERE med_id=".$req['medid']; Hello. I hope one of the PHP/HTML gurus here can help me. I have a web page that has been altered a bit to add some Google Analytics stuff and I've moved it to a 2nd directory. The original one works fine, the 2nd one won't post the form when I click the submit button. 1st URL https://www.theneutralizer.info/neutralizer 2nd URL: https://www.theneutralizer.info/neutralizer2 I have changed the action property to the correct script, and it does exist. But the problem is when clicking the button nothing happens. Anyone have any ideas? I can send the PHP code if needed, but since it's HTML output, it should work the way it is displayed in the browser. David I am getting the following error when using composer: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? Just started. I am pretty sure composer.json wasn't changed. journalctl doesn't show anything. Maybe Doctrine related, however, nothing seems to help.
Any ideas? [michael@devserver www]$ php -v PHP 7.3.4 (cli) (built: Apr 2 2019 13:48:50) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies with DBG v9.1.9, (C) 2000,2018, by Dmitri Dmitrienko [michael@devserver www]$ composer -V Composer version 1.4.2 2017-05-17 08:17:52 [michael@devserver www]$ yum info composer Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.us.oneandone.net * epel: mirror.rnet.missouri.edu * extras: mirror.us.oneandone.net * remi-php73: mirror.bebout.net * remi-safe: mirror.bebout.net * updates: mirror.us.oneandone.net Installed Packages Name : composer Arch : noarch Version : 1.8.4 Release : 1.el7 Size : 1.8 M Repo : installed From repo : epel Summary : Dependency Manager for PHP URL : https://getcomposer.org/ License : MIT Description : Composer helps you declare, manage and install dependencies of PHP projects, : ensuring you have the right stack everywhere. : : Documentation: https://getcomposer.org/doc/ [michael@devserver www]$ composer update Loading composer repositories with package information Updating dependencies (including require-dev) [ErrorException] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]... [michael@devserver www]$
This topic has been moved to Linux. http://www.phpfreaks.com/forums/index.php?topic=318175.0 An insert function is not inserting. I keep getting "Could not store data, please try again." After some probing, it seems that "$result = $conn->query($user_degree_insert_query); " is where the problem is. Variables before it seem to pass testing. I can't figure out why this line is messing thins up though. Any idea? Thank you in advance for your help! The "//$degree_id = mysql_fetch_array($degree_id_query, MYSQL_BOTH) ;" is commented out because it was giving me trouble, i replaced it with the line above that $conn = db_connect(); $arraycount = count($degree_Array); //loop through the categories chosen and add them each into member-category for($i =0; $i < $arraycount; $i++){ $degree_id_query = "SELECT degree_id FROM degree WHERE degree_type ='".$degree_Array[$i]."'"; $result = $conn->query($degree_id_query); //place the id found into the array, which automatically cancatonates it. $degree_id = $result->fetch_array(); //$degree_id = mysql_fetch_array($degree_id_query, MYSQL_BOTH) ; $user_degree_insert_query = "INSERT INTO user-degree ( `user_id` , `degree_id` ) VALUES ( '".$user_id."', '".$degree_id[0]."' )"; $result = $conn->query($user_degree_insert_query); if($result) { header("Location: survey2.php"); }else { echo "<p>Could not store data, please try again.</p>"; exit; Have got a form for the user to fill in. When they press submit the page SHOULD be sent to itself and update the database. When I load the page I keep getting undefined variable "submit" and also when i press button and bottom I get 404 message. <?php include "variables.php"; ?> <?php $date = date("M d, Y"); if ($submit) { // process form $db = mysql_connect($databaseserver, $databaseuser, $databasepass); mysql_select_db($databasename,$db); $sql = "UPDATE $playerstable SET staff = '$staff' WHERE name='$name'"; $result = mysql_query($sql); echo "Thank you! Information entered.<br><a href='$directory/Admin/index.php'>Return to admin panel</a>"; } else{ // display form ?> <form method="post" action="<?php echo $PHP_SELF?>"> <center> <table border="0" cellpadding="0" width="100%"> <tr> <td width="12%"> Name:</td> <td width="88%"><select size="1" name="name"> <?php $db = mysql_connect($databaseserver, $databaseuser, $databasepass); mysql_select_db($databasename,$db); $sortby = "name ASC"; $sql="SELECT * FROM $playerstable ORDER BY $sortby"; $result=mysql_query($sql,$db); $num = mysql_num_rows($result); $cur = 1; echo "<ol>"; while ($num >= $cur) { $row = mysql_fetch_array($result); $name = $row["name"]; ?> <option><?php echo "$name" ?></option> <?php $cur++; } echo "</ol>"; ?> </select></td> </tr> <tr> <td width="12%"> Staff:</td> <td width="88%"><select size="1" name="staff"> <option>Yes</option> <option>No</option> </select></td> </tr> </table> </center> <p> <input type="Submit" name="submit" value="Enter information"> </form> <?php } ?> Hi, I have set up 2 php pages page 1 - add_entry2.php In this page I have a invoice table created where I can dynamically add/delete rows. This has a View Bill button which takes me to page 2- add_entry3.php In this page it shows up the rows added in page 1 in read only format, so if the user wants to modify the data that he/she entered then he must Click on <back> that i have provided in the page 2 which will direct him to page 1 Now the problem starts here on click of Back the dynamically added rows dissappear..which is frustrating..I know its something to do with my code..but can anyone help me fix it. One more thing is that i dont want to store the data into DB till the finalise button is clicked on page 2 so that means till page 2 is submitted nothing goes to DB from Page 1. I am able to retain values if I use the code Code: [Select] <form action="add_entry2.php" name="eval_edit" method="post" format="html"> i,e if I submit back to the same page and retrieve values form $_POST but If I use the code Code: [Select] <input type="button" value="Back" onClick="history.go(-1);return true;">to get back to add_entry2.ph it looses all the values. Is there any other way to code the BACK link retaining my $_POST values(Do you think $_SESSION would work in this case?) This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=354981.0 Hi, First of all, this is not a spam. Someone with the username Pikachu2000 removed it thinking it was a spam so now I have to post it again. I really need you help fixing this problem. Anyway, I'm building a site where I used a "php include once" for the navigation menu. I was able to show the active pages when they don't have sub pages but I can't seem to show the active sub pages. I've been trying for days and nothing I try seems to work! I'm sure some people have asked this before but I can't find any forums that describe how to do this with sub navs rather then just the main nav buttons. The coding is below along with a link to one of the sub pages in the site I'm working on. The problem is with the sub pages under "Our Coffee Farm". Thanks for reading my post. Website Link: http://vanessajohodesigns.com/sarpa/the_farm/plantation.php before DOCTYPE: <?php $thisPage="The Plantation"; ?> after body tag: <?php include_once("../includes/nav.php");?> nav.php include once file: <div class="arrowsidemenu"> <div<?php if ($thisPage=="Home") echo " class=\"active\""; ?>> <a href="../index.php">Home</a></span></div> <div class="menuheaders"><a>Our Coffee Farm</a></div> <ul class="menucontents"> <li<?php if ($thisPage=="The Plantation") echo " class=\"active\""; ?>><a href="plantation.php">The Plantation</a></li> <li<?php if ($thisPage=="Blooming & Harvest") echo " class=\"active\""; ?>><a href="bloom_harvest.php">Blooming & Harvest</a></li> <li<?php if ($thisPage=="Coffee Processing") echo " class=\"active\""; ?>><a href="processing.php">Coffee Processing</a></li> </ul> <div<?php if ($thisPage=="About Us") echo " class=\"active\""; ?>> <a href="../about_us.php">About Us</a></div> <div<?php if ($thisPage=="Rainforest Alliance") echo " class=\"active\""; ?>> <a href="../rainforest_alliance.php">Rainforest Alliance</a></div> <div<?php if ($thisPage=="Social Commitment") echo " class=\"active\""; ?>> <a href="../social_commitment.php">Social Commitment</a></div> <div<?php if ($thisPage=="News & Events") echo " class=\"active\""; ?>> <a href="../news_events.php">News & Events</a></div> <div<?php if ($thisPage=="Web Cameras") echo " class=\"active\""; ?>> <a href="../webcams.php">Web Cameras</a></div> <div<?php if ($thisPage=="Photo Gallery") echo " class=\"active\""; ?>> <a href="../gallery.php">Photo Gallery</a></div> <div<?php if ($thisPage=="Contact Us") echo " class=\"active\""; ?>> <a href="../contact_us.php">Contact Us</a></div> <!--end .arrowsidemenu --></div> I have a registration form on my website and after Registration I want the user to activate first his account. I don't have problem on sending this email to the user. What I want to appear is like this.. GoodDay "username", Blah Blah! how can you actually do that? I know that you can do that through session variables but the thing is email's can't accept scripts on sending emails. how can I get the value from a session variable for example and convert it to plain html text so that i can OUTPUT it to the email.. HELP PLEASE! Hi, I currently have an if, elseif, else program that starts off with Code: [Select] if( $v_name == "" || $v_msg == "" ) echo "something" how do I turn this into a switch? but the very next elseif I have Code: [Select] elseif( strcspn( $_REQUEST['msg'], '0123456789' ) == strlen( $_REQUEST['msg'] ) ) echo "something" is it possible to turn this into a switch with 2 different strings like that to evaluate? This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=347922.0 I am trying to make a simplified query by example search form for my website. I would like to allow my users to do more complicated queries from one my prospects table. The user will be able to search by 1 or more field(s), select the operator for each field & enter the search value for each field. The advanced_search .php file is below: Code: [Select] <!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>Advanced Query</title> </head> <body> <form name="form1" method="post" action="do_advanced_search.php"> <table border="0" cellspacing="5" cellpadding="5"> <tr> <th>Field Name</th> <th>Operator</th> <th>Value</th> </tr> <tr> <td><input name="company_name" type="text" id="company_name" value="Company Name" readonly="readonly" /></td> <td><select name="company_operator" size="1" id="company_operator"> <option value="=" selected="selected">=</option> <option value="<>">Not Equal</option> <option value="Like %...%">Like %...%</option> </select></td> <td><input type="text" name="company_value" id="company_value" /></td> </tr> <tr> <td><input name="state" type="text" id="state" value="State" readonly="readonly"/></td> <td><select name="state_operator" size="1" id="state_operator"> <option value="=" selected="selected">=</option> <option value="<>">Not Equal</option> <option value="Like %...%">Like %...%</option> </select></td> <td><input type="text" name="state_value" id="state_value" /></td> </tr> <tr> <td><label> <input name="County" type="text" id="County" value="County" readonly="readonly" /> </label></td> <td><select name="county_operator" size="1" id="county_operator"> <option value="=" selected="selected">=</option> <option value="<>">Not Equal</option> <option value="Like %...%">Like %...%</option> </select></td> <td><input type="text" name="county_value" id="county_value" /></td> </tr> <tr> <td><input name="city" type="text" id="city" value="City" readonly="readonly" /></td> <td><select name="city_operator" size="1" id="city_operator"> <option value="=" selected="selected">=</option> <option value="<>">Not Equal</option> <option value="Like %...%">Like %...%</option> </select></td> <td><input type="text" name="city_value" id="city_value" /></td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="button" id="button" value="Search" /> </label></td> <td> </td> </tr> </table> </form> </body> </html> The do_advanced_search.php is below: $connection=mysql_connect($servername,$dbusername,$dbpassword); $db=mysql_select_db($dbname,$connection) or die(mysql_error()); $sql=mysql_query("SELECT * FROM smf_prospects where companyname '". $_POST['company_operator'] ."' '" . $_POST['company_value'] ."' AND state '" . $_POST['state_operator'] ."' '" . $_POST['company_value'] ."' AND county '". $_POST['county_operator'] ."' '" . $_POST['county_value'] . "'); echo $sql; $result=mysql_query($sql,$connection) or die(mysql_error()); while($row=mysql_fetch_array($result)) { $comapanyname= $row['companyname']; $state=$row['state']; $county=$row['county']; } echo $companyname; echo $state; echo $county; ?> Any help would be greatly appreciated. I will poet a completed version of this once it is finished. Thank you, Terry Mullins Hello all, I'm using sessions to store a username/password For example, I have the following at the top of all my source files: Code: [Select] <?php session_start(); if(!isset($_SESSION['myusername'])){ header("Location:login.php"); exit; } else { $username = $_SESSION['myusername']; $permissionLevel = $_SESSION['mypermissionlevel']; } ?> Now, I'd like to add a "Remember Me" checkbox so they can store their login info (securely!) so they don't have to log in all the time.... How do I do this? Thanks |