PHP - I Need A Script Which Will Submit 1 Article To Multiple Sites With 1 Click.
i need to submit 1 article (3 input fields: title, category, description), to multiple sites. it must be done with 1 click.
one more thing... each site to which i have to submit has different input names, but are the same 3, also 1 is for title 1 for category and 1 for description. Similar TutorialsYou would think the answer would be all over the Internet and easy to find, but it’s not. I have searched many times, and in all the multitude of search results I have still never found an adequate usable answer. The MOST you ever find is someone saying how easy it is with PHP, but they don’t tell you how, even when the person they are answering asks them (odd). You can be that one in a billion person who finally answers it for real and helps someone out. I have a simple HTML form with data fields first_name, last_name, email, phone, country, a few hidden inputs, and a single submit button, like so: (Please note: the method is GET, not Post.) <form action="https://MyDomainOnMyServer.com/MyPHPScript.php”> <input type="text" name="first_name" value="" /> <input type="text" name="last_name" value="" /> <input type="text" name="email" value="" /> <input type="text" name="phone" value="" /> <input type="hidden" name="type" value="type123"> <input type="hidden" name="project" value="new123"> <select required name="country"> <option value="">Choose your country</option> <option value="US">United States</option> <option value="CA">Canada</option> <option value="GB">United Kingdom</option> <option value="Many More">Many More Countries</option> </select> <input type="submit" value="Submit Form" /> </form> NOTE: Originally, the form action would have been: action="https://TheirExampleDomainOnTheirRemoteServer.com/TheirRemotePHPScript.php" name="form1234" Upon clicking the single submit button only, what I need to have happen is this: 1. Send me an email to whatever@whatever.tld containing all the form submission data 2. Place the form submission data into a MySQL database having the corresponding data fields 3. Send the form submission contents including the hidden input values to "https://TheirExampleDomainOnTheirRemoteServer.com/TheirRemotePHPScript.php" name="form1234" AS IF that had remained set as the original form action to begin with So basically what I’m trying to obtain is the cleanest possible PHP script that will do those three things, which is essentially what others have asked for over the years in search results I have found, but no one has ever provided it in a clear instance that works. If I can just see such a script, I should be able to see how it works and then do what I need. Thanks. Reply I'm learning to develop social media buttons, and I'm trying to figure out, how to find out the correct submit links to the social media sites? For example: Digg has their submit link like this: return "<a href='http://digg.com/submit?url=$link& title=$title&bodytext=$text'>Digg This</a>"; Digg also requires to use urlencode for the variables inside the URL. But delicious has their submit link like this: return "<a href='http://del.icio.us/post?url= $link&description=$text&replace=no'>Add to Delicious</a>"; When I go on delicious.com (under this URL: http://www.delicious.com/help/api#posts_add) I will find the link: Code: [Select] https://api.del.icio.us/v1/posts/add? Which is stated on the API page, but that link won't work. I rather have to use the link I showed earlier. So my question is, what is the proper way in figuring the correct submit links for each website and how to format them properly to their requirements, I can not find any information on the websites? So I can build social media buttons to the other sites as well. I know this has been asked before and I have searched but I can't find an answer. I have a cookie that is set on a customers web site(yes I've tested it and it is defined) and I was going to use it to display certain info on my web site. Sooo ... How do I get a cookie to work across multiple (2) web sites? Thanks I have written a small script for my own personal use that checks the servers of my favorite sites to see if they are operational. I'm having trouble getting it to work, I have most of it (I think) and I'm very new to PHP. The script also allows for a form to add any sites to the file, which I think I explode into an array correctly, at a later time. Here's my code, Please Help! <html> <head> <title>project.php</title> </head> <body> <?php $filename = "websites.txt"; $file = file_get_contents($filename); // reads entire file into a string $DomainNames = explode("\n", $file); // split the string at new line characters, returns an array $length = count($DomainNames) - 1; // count is the correct way to get the length of an array $i=0; while($i<=$length){ $fp = @fsockopen ($DomainNames[$i], 80, $errno, $errstr, 10); if (!$fp) echo "$DomainNames[$i] : <font color='red'>Failed!</font>"; else { echo "$DomainNames[$i] : <font color='green'>Online!</font>"; echo "<br>"; $i++; } } if (isset($_POST['submit'])) { $DomainNames[] = $_POST['url']; // append url to array $file = implode("\n", $DomainNames); // convert array to string, delimiting by new lines file_put_contents($filename, $file); // save contents to file } ?> <form action="project.php" method="post"> <fieldset> <label for="url">Url: </label> <input type="text" name="url" id="url" /> <input type="submit" name="submit" id="submit" value="Add URL" /> </fieldset> </form> </body> </html> 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 Hello I am working in moodle and its code base is in PHP. I am a novice to moodle as well as PHP and not quite familiar with PHP syntax. Right now I have built a Web page in moodle, and its view.php file I need to implement a fuctionality on click of a button. On click of submit button, I am trying to implement a functionality and I have written the code for that under if(isset($_POST['submit])) { ...my code...} Also while creating the form I have set the attributes as follows: echo "<form method='post' action='" . $_SERVER['PHP_SELF']."?inpopup=". $_GET['inpopup']."&id=" . $_GET['id'] . "'>"; But irrespective of whether or not I click the button, whenevr the page loads for the first time, it perform the code written in IF loop as well. So Am i going wrong in implementing a functionality on click of button in PHP or is it something related to moodle, if anyone knows? Any help or suggestions would be appreciated. As I am stuck with this logic since last three days. Regards Code: [Select] <?php $db = mysql_connect("localhost", "root") or die("Could not connect."); //username and password if(!$db) die("no db"); if(!mysql_select_db("simple",$db)){ if(!mysql_select_db("regis",$db)){//database name die("No database selected.");}} $message=$_POST['message']; print "<form action='registration.php' method='post'onsubmit='return msg();'>"; print "Your message:<br>"; print "<textarea name='message' cols='40' rows='2'></textarea><br>"; print "<a onClick=\"addSmiley(':)')\"><img src='smile.gif'></a> "; print "<a onClick=\"addSmiley(':(')\"><img src='blush.gif'></a> "; print "<a onClick=\"addSmiley(';)')\"><img src='images/wink.gif'></a> "; print "<input type='submit' name='submit' value='Set Name'></form>"; print "<script language=\"Java Script\" type=\"text/javascript\">\n"; print "function addSmiley(a)\n"; print "{\n"; print "document.form.message.value += a;"; print "document.form.message.focus();\n"; print "}\n"; print "</script>\n"; print "<br><br>"; ?> <script type="text/javascript"> <?php function msg(){ if(isset($_POST['submit'])) //if submit button push has been detected { if(strlen($message)<1) { // print "You did not input a message"; echo"<SCRIPT LANGUAGE='javascript'>alert('You did not input a message')</SCRIPT>"; } else { $message=strip_tags($message); $IP=$_SERVER["REMOTE_ADDR"]; //grabs poster's IP $checkforbanned="SELECT IP from admin where IP='$IP'"; $checkforbanned2=mysql_query($checkforbanned) or die("Could not check for banned IPS"); if(mysql_num_rows($checkforbanned2)>0) //IP is in the banned list { print "You IP is banned from posting."; } else if(strlen($message)>=1) { $message=strip_tags($message); echo("<SCRIPT LANGUAGE='JavaScript'>window.alert('$message')</SCRIPT>"); // die("<meta http-equiv=\"refresh\" content=\"0; url=registration.php\">"); } $message=$_POST['message']; $message=strip_tags($message); /* if($_POST['username'] && $_POST['pass']) { $name = mysql_query("SELECT * FROM Persons"); $thedate = date("U"); //grab date and time of the post $insertmessage="INSERT into mesej (name,IP,postime,message) values('$name','$IP','$thedate','$message')"; mysql_query($insertmessage) or die("Could not insert message"); } */ } } return false; } return true; </script> ?> This is my code in my submit2.php im clicked submit button but if it is empty it should return an javascript alert error but why it directs through registration.php without reading the rules? Folks,
Look at this weird thing. I load the page and get echoed as expected: Did Not REQUEST_METHOD! Then, I click the SUBMIT button and to my astonishment I get echoed: Did Not POST->Submit! Got 2 buttons. Same result whenever clicking any. Why is that ? Check it out:
<?php //include('error_reporting.php'); ini_set('error_reporting',E_ALL);//Same as: error_reporting(E_ALL); ini_set('display_errors','1'); ini_set('display_startup_errors','1'); ?> <form name = "submit" method = "POST" action=""> <label for="domain">Domain:</label> <input type="text" name="domain" id="domain" placeholder="Input Domain"> <br> <label for="domain_email">Domain Email:</label> <input type="email" name="domain_email" id="domain_email" placeholder="Input Domain Email"> <br> <label for="url">Url:</label> <input type="url" name="url" id="url" placeholder="Input Url"> <br> <label for="link_anchor_text">Link Anchor Text:</label> <input type="text" name="link_anchor_text" id="link_anchor_text" placeholder="Input Link Anchor Text"> <br> <textarea rows="10" cols="20">Page Description</textarea> <br> <label for="keywords">Keywords:</label> <input type="text" name="keywords" id="keywords" placeholder="Input Keywords related to Page"> <br> <input type="checkbox" name="alert_visitor_type" id="alert_visitor_type" value="Give Alert: Visitor Type"> </label for="alert_visitor_type">Give Alert: Visitor Type</lablel> <input type="checkbox" name="alert_visitor_potential" id="alert_visitor_potential" value="Give Alert: Potential Visitor"> </label for="alert_visitor_potential">Give Alert: Potential Visitor</lablel> <br> <input type="radio" name="tos_agree" id="tos_agree_yes" value="yes"> <label for="tos_agree_yes">Yes:</label> <input type="radio" name="tos_agree" id="tos_agree_no" value="no"> <label for="tos_agree_no">No:</label> <br> <label for="tos_agreement">Agree to TOS or not ?</label> <select name="tos_agreement" id="tos_agreement"> <option value="yes">Yes</option> <option value="no">No</option> </select> <br> <button type="submit" value="submit">Submit</button><br> <button type="submit">Submit</button> <br> <input type="reset"> <br> </form> <?php if($_SERVER['REQUEST_METHOD'] === 'POST') { if(isset($_POST['submit'])) { mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT); mysqli_connect("localhost","root","","test"); $conn->set_charset("utf8mb4"); $query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES (?,?,?,?,?,?,?,?)"; $stmt = mysqli_stmt_init($conn); if(mysqli_stmt_prepare($stmt,$query)) { mysqli_stmt_bind_param($stmt,'ssssssss',$_POST['domain'],$_POST['domain_email'],$_POST['url'],$_POST['link_anchor_text'],$_POST['page_description'],$_POST['keywords'],$_POST['alert_visitor_type'],$_POST['alert_visitor_potential']); if(mysqli_stmt_execute($stmt) === FALSE) { die("Error\" . mysqli_stmt_error()"); } mysqli_stmt_close($stmt); mysqli_close($conn); } else { die("Did not INSERT!"); } } else { die("Did Not POST->Submit!"); } } else { die("Did Not REQUEST_METHOD!"); } ?>
Hello all,
I am an absolute beginner when it comes to PHP and Javascript but wanted a simple contact form for my website. I used the PHP code from one source and the Javascript validator code from another source and all is working fine except for one very annoying bug: I have to press the Submit button twice in order for the form to send the email. I've found that if the validator is already triggered, however, I only need to press the button once for it to submit. I have scoured the internet for a solution to this problem but am realizing this must be a hangup in the particular code I'm using and I'm just not experienced enough to troubleshoot it.
A little help is greatly appreciated. Thank you for your time.
Here's the client side code (truncated to only show relevant parts):
<html> <head> <script src="js/gen_validatorv4.js" type="text/javascript"></script> </head> <body> <form method="post" action="contact.php" name="contactform"> <div class="row collapse-at-2 half"> <div class="6u"> <input name="name" placeholder="Name" type="text" /> </div> <div class="6u"> <input name="email" placeholder="Email" type="text" /> </div> </div> <div class="row half"> <div class="12u"> <textarea name="message" placeholder="Message"></textarea> </div> </div> <div class="row half"> <div class="12u"> <ul class="actions"> <li><input type="submit" value="Send Message" /></li> <li><input type="reset" value="Clear form" /></li> </ul> </div> </div> </form> <script type="text/javascript"> var myformValidator = new Validator("contactform"); myformValidator.addValidation("name","req", "Please provide your name."); myformValidator.addValidation("email","req", "Please provide your email."); myformValidator.addValidation("message","req", "Please enter your message."); myformValidator.addValidation("email","email", "Please enter a valid email address."); </script> </body> </html> I have posted this problem in the PHP section but someone suggested I take it here because the hangup is likely in the JS. I have tried removing the JS validator with varying results; sometimes the form still requires double-clicking and sometimes it works fine. Please see my original post below:
Hi all, slightly confusing title! What I am trying to do is make a simple stores system whereby I can add and remove stores. It is purely php and no mySQL. My idea was to create a text file with the individual number and then include the file on the table on the page. I have worked out how to increment one value by one, but the others I am struggling with. Example I wish to have two links one which I click to increase and another to decrease the value by one. It's the multiple issue that is confusing me, I create a txt file and a php file using a variable from a submitted form (part number). The php file holds info and the text file holds the number which is default at '0' (Zero). My idea was to write some php to the file, perhaps when I click the plus it will open and write to the file + 1 .. Any guidance or points in the right direction would be greatly appreciated. Thanks. Shugs I'm not sure if this belongs in the PHP or SQL sections or both but- Is it possible to insert form data (one record) into 2 different tables when I click submit? As is, I have 2 distinct log-in scripts each linked to 2 separate databases . I want to merge them into one log-in form that populates both tables(in different dbs). I don't want my visitors to log into 2 different forms. Can one form's action attribute send the POST data to two different processing scripts? and can the input from a text box be sent to 2 different fields? I don't have any code, I just wanted to know if it can be done or point me to a sample that I can work from. Hi all, I was wondering if it was possible and not too messy to have a single form page (html) and have it post to 2 or more PHP files? Surely this is something that is desirable and accomplished at some point, right? Thanks. Richard Only the last row will update when I submit. I have this form (and one nerve left): <form action="" method="post" > echo" <input style=\"text-align:center\" type=\"text\" name=\"linkorder\" value=\"".$row['order']."\" /> <input type=\"hidden\" name=\"id\" value=\"".$row['id']."\"/> "; <input type="submit" name="updateorder" value="Save Order" /> </form> On Submit: if (isset($_POST['updateorder'])){ connect(); $changeorder = mysql_unbuffered_query("update links set `order` = '".$_POST['linkorder']."' where id = '".$_POST['id']."'") or die(mysql_error()); } I was going put my fist through the monitor but then I remembered I could get help here. Thank you!
I have a webpage that I am working on that is now in construction mode. The url is: https://localbizseek.com/lbs/index6 The problem is that I want to it to be able to search 2 at the same time in the phpmyadmin database table which is named "places". I also want to be able to get to search all 9 cities for that area. There are a total of 36,000+ cities in the database. However, I want it to be able to search just 2 or 9 specific cities of those cities. Each city has a city_id which is an integer assigned to it in the database Right now it will search only 1 city at a time or it will search every city in the database if I assign the search variable as "" or "0". I don't know what to do on this page to solve it and on the related processing page. Here is the code on the webpage: <form id="main-search-form" method="GET" action="<?= $baseurl; ?>/_searchresults.php" role="search"> <select id="query-input" name="city_id" style="width:28.8%" style="height:69px" required> <option value="">Select Area</option> <option value="3;1">Ches & VB</option> <option value="3">Chesapeake , VA</option> <option value="9">Hampton , VA</option> <option value="10">Newport News , VA</option> <option value="2">Norfolk , VA</option> <option value="12">Poquoson , VA</option> <option value="4">Portsmouth , VA</option> <option value="5">Suffolk , VA</option> <option value="1">Virginia Beach , VA</option> <option value="11">Williamsburg , VA</option> <option value="0">All Active US Cities</option> </select> </form>
You will notice that I have tried "3;1" up under the Ches & VB Select Option but that doesn't work because it will not work that way. I can have it as "3 1" but then it just displays 1 which is VB's information. I've tried everything possible and it won't search both variables. It only will search one. <form id="main-search-form" method="GET" action="<?= $baseurl; ?>/_searchresults.php" role="search"> <select id="query-input" name="city_id" style="width:28.8%" style="height:69px" required> <option value="">Select Area</option> <option value="3,1">Ches & VB</option> <option value="3">Chesapeake , VA</option> <option value="9">Hampton , VA</option> <option value="10">Newport News , VA</option> <option value="2">Norfolk , VA</option> <option value="12">Poquoson , VA</option> <option value="4">Portsmouth , VA</option> <option value="5">Suffolk , VA</option> <option value="1">Virginia Beach , VA</option> <option value="11">Williamsburg , VA</option> <option value="0">All Active US Cities</option> </select>
Here is the final page of code which I'm not sure if this one needs changing but just in case here it is: <!DOCTYPE html> <!--[if IE 9]><html class="lt-ie10" lang="<?= $html_lang; ?>"> <![endif]--> <html class="no-js" lang="<?= $html_lang; ?>"> <head> <title><?= $txt_html_title; ?> - <?= $site_name; ?></title> <meta name="description" content="<?= $txt_meta_desc; ?>" /> <meta name="robots" content="noindex"> <?php require_once('_html_head.php'); ?> </head> <body class="tpl-searchresults"> <?php require_once('_header.php'); ?> <h1><?= $txt_main_title; ?></h1> <div class="full-block"> <div class="content-col"> <div class="list-items"> <?php /* -------------------------------------------------- BEGIN SHOW LIST -------------------------------------------------- */ if($total_rows > 0) { $count = ($page - 1) * $limit; $results_arr = array(); foreach($list_items as $k => $v) { $count++; $place_id = $v['place_id']; $place_name = $v['place_name']; $place_slug = $v['place_slug']; $address = $v['address']; $cross_street = $v['cross_street']; $place_city_name = $v['place_city_name']; $place_city_slug = $v['place_city_slug']; $place_state_abbr = $v['place_state_abbr']; $postal_code = $v['postal_code']; $area_code = $v['area_code']; $phone = $v['phone']; $phone = preg_replace("/[^0-9]/", "", $phone); $phone = substr($phone, 0, 3) . '-' . substr($phone, 3); $lat = $v['lat']; $lng = $v['lng']; $cat_icon = $v['cat_icon']; $photo_url = $v['photo_url']; $rating = $v['rating']; $description = $v['description']; $results_arr[] = array( 'ad_id' => $place_id, 'ad_lat' => $lat, 'ad_lng' => $lng, 'ad_title' => $place_name, 'count' => $count, 'cat_icon' => $cat_icon); $places_names_arr[] = $place_name; ?> <div class="item" data-ad_id="<?= $place_id; ?>"> <div class="item-pic" id="<?= $place_id; ?>"> <img src="<?= $photo_url; ?>" /> </div><!-- .item-pic --> <div class="item-description"> <div class="item-title-row"> <div class="item-counter"><div class="item-counter-inner"><?= $count; ?></div></div> <h2><a href="<?= $baseurl; ?>/<?= $place_city_slug; ?>/place/<?= $place_id; ?>/<?= $place_slug; ?>" title="<?= $place_name; ?>"><?= $place_name; ?></a></h2> </div> <div class="item-ratings-wrapper"> <div class="item-rating" data-rating="<?= $rating; ?>"> <!-- raty plugin placeholder --> </div> <div class="item-ratings-count"> <?php // echo $count_rating; ?> <?php // echo ($count_rating == 1 ? 'review' : 'reviews'); ?> </div> <div class="clear"></div> </div><!-- .item-ratings-wrapper --> <div class="item-info"> <div class="item-addr"> <strong> <?= (!empty($address)) ? $address : ''; ?> </strong> <?= (!empty($cross_street)) ? "($cross_street)" : ''; ?> <br> <strong> <?= (!empty($place_city_name)) ? "$place_city_name," : ''; ?> <?= (!empty($place_state_abbr)) ? " $place_state_abbr " : ''; ?> <?= (!empty($postal_code)) ? $postal_code : ''; ?> </strong> </div> <div class="item-phone"> <?= (!empty($phone)) ? '<i class="fa fa-phone-square"></i>' : ''; ?> <?= (!empty($area_code)) ? $area_code : ''; ?> <?= (!empty($phone)) ? $phone : ''; ?> </div> </div><!-- .item-info --> <?php echo (!empty($tip_text)) ? $tip_text : ''; ?> </div><!-- .item-description --> <div class="clear"></div> </div><!-- .item --> <?php } // end foreach($response as $k => $v) } // end if($total_rows > 0) else { // else no results found ?> <div class="empty-cat-template"> <p><?= $txt_empty_results; ?></p> </div> <?php } ?> </div><!-- .list-items --> <?php /* -------------------------------------------------- BEGIN PAGER -------------------------------------------------- */ ?> <div id="pager"> <ul class="pagination"> <?php if(!empty($pager) && $pager->getTotalPages() > 1) { $curPage = $page; $startPage = ($curPage < 5)? 1 : $curPage - 4; $endPage = 8 + $startPage; $endPage = ($pager->getTotalPages() < $endPage) ? $pager->getTotalPages() : $endPage; $diff = $startPage - $endPage + 8; $startPage -= ($startPage - $diff > 0) ? $diff : 0; $startPage = ($startPage == 1) ? 2 : $startPage; $endPage = ($endPage == $pager->getTotalPages()) ? $endPage - 1 : $endPage; if($total_rows > 0) { $page_url = "$baseurl/_searchresults.php?city_id=$query_city_id&query=$query_query&page="; if ($curPage > 1) { ?> <li><a href="<?= $page_url; ?>1">Page 1</a></li> <?php } if ($curPage > 6) { ?> <li><span>...</span></li> <?php } if ($curPage == 1) { ?> <li class="active"><span>Page 1</span></li> <?php } for($i = $startPage; $i <= $endPage; $i++) { if($i == $page) { ?> <li class="active"><span><?= $i; ?></span></li> <?php } else { ?> <li><a href="<?php echo $page_url, $i; ?>"><?= $i; ?></a></li> <?php } } if($curPage + 5 < $pager->getTotalPages()) { ?> <li><span>...</span></li> <?php } if($pager->getTotalPages() > 5) { $last_page_txt = "Last Page"; } $last_page_txt = ($pager->getTotalPages() > 5) ? "Last Page" : $pager->getTotalPages(); if($curPage == $pager->getTotalPages()) { ?> <li class="active"><span><?= $last_page_txt; ?></span></li> <?php } else { ?> <li><a href="<?php echo $page_url, $pager->getTotalPages(); ?>"><?= $last_page_txt; ?></a></li> <?php } } // end if($total_rows > 0) } // end if(isset($pager) && $pager->getTotalPages() > 1) if(isset($pager) && $pager->getTotalPages() == 1) { ?> <?php } ?> </ul> </div><!-- #pager --> </div><!-- .content-col --> <div class="sidebar"><div class="clear"></div> <?php if($total_rows > 0) { ?> <div class="clear"></div> <div class="map-wrapper" id="sticker"> <div id="map-canvas" style="width:100%; height:100%"></div> </div> <?php } ?> </div> <div class="clear"></div> <!-- #sidebar --> <div class="clear"></div> </div><!-- .content-full --> <?php require_once('_footer.php'); ?> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?= $google_key; ?>"></script> <script type="text/javascript"> // place markers var results_obj = <?php echo json_encode($results_arr); ?>; var infowindow; var map; function initialize() { markers = {}; infoboxcontents = {}; // set map options var mapOptions = { zoom: 1 }; // instantiate map var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); var bounds = new google.maps.LatLngBounds(); var infowindow = new google.maps.InfoWindow(); // $results_arr[] = array("ad_id" => $place_id, "ad_lat" => $ad_lat, "ad_lng" => $ad_lng, "ad_title" => $ad_title, "count" => $count); // set markers for (var k in results_obj) { var p = results_obj[k]; var latlng = new google.maps.LatLng(p.ad_lat, p.ad_lng); bounds.extend(latlng); var marker_icon = '<?= $baseurl; ?>/imgs/marker1.png'; // place markers var marker = new google.maps.Marker({ position: latlng, map: map, animation: google.maps.Animation.DROP, title: p.ad_title, //icon: marker_icon }); markers[p.ad_id] = marker; infoboxcontents[p.ad_id] = p.ad_title; // click event on markers to show infowindow google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(this.title); infowindow.open(map, this); }); } // end for (var k in results_obj) map.fitBounds(bounds); $(".list-items .item").mouseover(function() { marker = markers[this.getAttribute("data-ad_id")]; // mycontent = infoboxcontents[this.getAttribute("data-ad_id")]; mycontent = '<div class="scrollFix">' + infoboxcontents[this.getAttribute("data-ad_id")] + '</div>'; // console.log(mycontent); infowindow.setContent(mycontent); // infowindow.setOptions({maxWidth:300}); infowindow.open(map, marker); marker.setZIndex(10000); }); // end mouseover } // end initialize() google.maps.event.addDomListener(window, 'load', initialize); </script> <script type="text/javascript"> $.fn.raty.defaults.path = '<?= $baseurl; ?>/templates/lib/raty/images'; $('.item-rating').raty({ readOnly: true, score: function(){ return this.getAttribute('data-rating'); } }); </script> <script> $(document).ready(function(){ $("#sidebar").sticky({topSpacing:0}); }); </script> <script> $(document).ready(function(){ $("#sticker").sticky({topSpacing: 24}); }); </script> <script type="text/javascript"> function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++) { hash = hashes.split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } $(document).ready(function() { var loc = '<?= e($_GET['loc']); ?>'; var query = '<?= e($_GET['query']); ?>'; if(loc !== '') { $("#city-input").val(loc); } if(query !== '') { $("#query-input").val(query); } }); </script> </body> </html> Edited April 13, 2019 by requinix please use the Code <> button when posting code. Hi All, I'm hoping someone can help me. I'm looking to create a form that will submit multiple entries to a MySQL database depending on the options selected on the form. I am able to submit single entries, but the multiple entire is a bit of a mystery to me. I have attached an JPG image to show an example of how I would like the form to work. I have also added the description/explination below to this example: Example 1 The form was completed and three access types were selected. Thus Three entries, all with the Same Reference number were captured into the database Example 2 The form was completed and Two Access Types were selected. Thus Two entries, all with the Same Reference number were captured into the database Example 3 The form was completed and Four Access Types were selected. Thus Four entries, all with the Same Reference number were captured into the database Hello all , here is another problem of my project. I need to create a textarea , drop down list and submit button . At first , I can type whatever I want in the textarea , but for certain part I can just choose the word I want from drop down list and click submit , then the word will appear in the textarea as my next word . But I have no idea how to make this works , is there any simple example for this function ? Thanks for any help provided . hi i am trying to make a payroll calculator script that takes employee info, calculates pay, displays submitted info in a table, stores info in an array, and updates the array when new info is submitted. i have most of these accomplished, i am having trouble with the "store into an array, and update the array when new info is submitted" parts of the project. i am still not very fluent in php so there may be easier ways to achieve what i have so far. any pointers would be a great help, this part has got me stumped. I am creating a user inbox system. I am retrieving all the unread messages. Each message row contains a "reply" form. So say I have 10 messages showing on a single page. That's 10 forms. What I would like to know is how can I submit any one of the 10 forms and not have it affect the remaining 9 forms? Here is the basic code. if(isset($_POST['submit'])) { $post_message = trim($_POST['message']); $errors = array(); $db->beginTransaction(); if(empty($post_message)) { $errors[] = 'The message field can not be empty!'; } if(empty($errors)) { $db->commit(); echo 'success'; } else { $db->rollBack(); } } <form action="" method="post"> <fieldset> <textarea name="message" maxlength="10000" placeholder="What would you like to say?"></textarea> </fieldset> <fieldset> <input type="submit" name="submit" value="Submit" /> </fieldset> </form>
hi i need help on posting multiple inputs in a single button...while using mysql_fetch_array here is my codes: <? $re6 = mysql_query('select username from users where course = "BSIT" and yearlevel = "FOURTH"'); ?> <br /> <h1>Post Grade</h1> <h1>IT, Fourth Year</h1> <br />Please fill the following form to send The Grade<br /> <? $n = 0; while($row = mysql_fetch_row($re6)) { echo'<form action="grade_post.php" method="post">'; echo'Recipient<span class="small">(Username)</span><input type="text" value="'.$row['username'].'" readonly="readonly" id="recip" name="recip[' . $n . ']" />'; echo'Subject<input type="text" value="'.htmlentities($otitle, ENT_QUOTES, 'UTF-8').'" id="title" name="title[' . $n . ']" />'; echo'<input type="hidden" value="FOURTH" id="year" name="year[' . $n . ']" />'; echo'<input type="hidden" value="FIRST" id="sem" name="sem[' . $n . ']" />'; echo'Grade<input type="text" id="message" name="message[' . $n . ']" ><br />'; ++$n; } ?> i get all my recipients in every input type, but when i tried to post it in my database not all of them are posted rather only one of them are posted in my database ...what i want to happen is that all of my recipients in every input type will be posted in my database with different ids'...help pls... |