PHP - Php Submit Link Problem
when i upload a link using the form below it adds \ into it like this <a href=\"http://www.google.co.uk\" target=\"_blank\">test</a> and the link is unusable with them any way to stop this
<?php include("dbinfo.inc.php"); mysql_connect($localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM News WHERE id='$id'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $News=mysql_result($result,$i,"News"); ?> <form action="updated.php"> <input type="hidden" name="ud_id" value="<? echo "$id"; ?>"> News:<br> <TEXTAREA NAME="ud_News" COLS=40 ROWS=6><? echo "$News"?></TEXTAREA><br> <input type="Submit" value="Update"> </form> <?php ++$i; } ?> Similar Tutorialshow do I make a link as a submit button? action is dashboard.php. help please Hi,
I have the following submit button and would like to change it into a link with a class.
<input type="image" alt="Click here to Continue" name="I2" src="altimages/buttons/continue.gif" id="submit">How would I do this using jQuery? Thanks! Hope someone can help put with this - I have inherited a site and am trying to modify some PHP that I am unfamiliar with. I have gotten so far with it, but still have a problem with it.
Its a page on an online store offering optional extras depending on the product. The products are furniture, so and there was an option to buy cushions for some. The change I am trying to make is to have an option for two different sizes of cushion depending on the product.
So there was a field 'cushions' in the product table, and a page 'accessories.php' that offered the option to add cushions.
I have added a new field 'cushions2' and a new page 'accessories2.php' to cover the new size of cushions.
The site is here, with this example product:
http://www.lloydloom...oduct.php?id=32
If you click 'Add to cart' the next page offers you the option to add custom paintwork.
If you enter something there, and click on 'Add colour to order' it works - i.e. the next page is the one offering the cushions.
But if you just click on 'No thank you, proceed with order' it just reloads the page - basically the URL isn't being puled through as it should be.
On that page the PHP at the top of the page looks like this:
<?php session_start(); Hello everyone, this is my first post here! My question covers a PHP, SQL, and HTML so I apologise if this isn't the appropriate section to post this message. Outline to my problem: A user can search my database for a variety of events, which are then listed on a results form. Next to each result I have an option to add this event to the users personal area as a 'saved event' for future reference. Currently I have a solution whereby an HTML form sends an action to '#', inserts the event ID and member ID into the 'savedevent' table via a PHP/SQL function. The page then displays 'event added'. THIS WORKS. However, if the user navigates away from the page, and then back to it again, the PHP script is obviously run again, ie- a 'resend data' dialog box is displayed to the user, which I really don't want. This website:http://www.bandsintown.com/event/3988178-nme-awards-tour-2011-london-united-kingdom-live-at-o2-academy-brixton-on-february-19-2011 achieves exactly what I am trying to do with the 'attending' button, but I cannot figure out how they accomplish this. Any help and ideas would be greatly appreciated. Hello again, and thanks! paddyfields. Hello All, i could really use some coding help. I have a form that users use and submit. i'd like the page to refresh and show the new data when submit button is pressed however, right now it only shows when i manually refresh the page. here is the code, can someone please tell me what to add or take away to make it work. thanks <iframe src="http://pickthefights.com/smack/?id=<?php echo $idvar; ?>&smack=yes" width="300" height="100">;Your browser does not support iframes.</iframe> <form name="smack" method="post" action="http://pickthefights.com/smack-reg/" target="_blank" name="smack" > <input type="hidden" value="<?php echo $_SESSION[uid] ?>" name="session" > <input type="hidden" value="<?php echo $idvar ?>" name="idvar" > Smack Talk : <input type="text" name="comment" > <input value="Smack" type="submit" name="smack"> </form> Hi im a newbie php developer and am experiencing two problems at the moment. The first and most important is that google charts can not save over https i have copied a function that should save the file but i am clueless as to how it work s and where i am going wrong with it ??? any help with this would be greatly appreciated. Secondly every time i hit submit the page first posts data and then i have to submit again before it posts the data to google charts api ? Again any help would be greatly appreciated Thanks in advance ill add all the code here for you guys. Saving the google chart api function saveImage($chart_url,$path,$file_name) { if ( (!file_exists($path.$filename)) || (md5_file($path.$filename) != md5_file($chart_url)) ) { file_put_contents($path.$filename,file_get_contents($chat_url)); } return($filename); } function doSomething() { $local_image_path ="home/sean/img/charts/"; $imagename="some_chart_image.png"; $chart_url = $chartimage; $image = saveImage($chart_url ,$local_image_path,$image_name); echo "Image Saved"; } $body .= "<table class='formTABLE'> <tr> <TD class='FieldCaptionTD' align='right' colspan='2'> <input class='Button' method='post' action='' align='right' type='submit' name='save_file' value='Save'> <input class='Button' method='post' action='' align='right' type='submit' name='submit_button' value='Submit'> </center> </TD> </tr> </table>"; $body .= htmlmaintsplit(); ?> <img src="/home/sean/work/some_chart_image.png" alt="" /> How am i to use this now to save the graph i have created ??? Relating to the submit button problem - this is set after the submit button though i have tried placing the submit button beneath this code but still the same problem persists <form action='<?php echo $action?>' method='POST' name='bargraph' value='bargraph' chid='post_form' onsubmit="this.action = 'http://chart.apis.google.com/chart?chid=' + (new Date()).getMilliseconds(); return true;"> Hello everyone, I am working on a form that is similar to a shopping cart system and I am thinking of creating a button that submits the checked value and saves them to a $_SESSION variable. And also a link that links to a cart.html that takes the values of a $_SESSION variable. I am have trouble figuring what tag/attribute should I use in order to achieve that.
Right now my code attached below submits the checked values to cart.html directly. However I want my submit button to save the checked box to a $_SESSION variable and STAY on the same page. And then I will implement a <a> to link to the cart.php.
I researched a little bit about this subject and I know it's somewhat related to ajax/jquery. I just wanted to know more about it from you guys. I appreciate your attention for reading the post and Thanks!
Below is the form that I currently have:
<form name= "finalForm" method="POST" action="cart.php"> <input type="Submit" name="finalSelected"/> <?php foreach($FinalName as $key => $item) {?> <tr> <td><input type="checkbox" name="fSelected[]" value="<?php echo htmlspecialchars($FinalID[$key])?>" /> <?php echo "$FinalID[$key] & $item";?> </td> </tr> <?php } ;?>Below is the code for cart.php <?php require ('connect_db.php'); if(isset($_POST['finalSelected'])) { if(!empty($_POST['fSelected'])) { $chosen = $_POST['fSelected']; foreach ($chosen as $item) echo "aID selected: $item </br>"; $delimit = implode(", ", $chosen); print_r($delimit); } } if(isset($delimit)) { $cartSQL = "SELECT * from article where aID in ($delimit)"; $cartQuery = mysqli_query($dbc, $cartSQL) or die (mysqli_error($dbc)); while($row = mysqli_fetch_array($cartQuery, MYSQLI_BOTH)) { $aTitle[] = $row[ 'name' ]; } } ?> <table> <?php if(isset($delimit)) { $c=0; foreach($aTitle as $item) {?> <tr> <td> <?php echo $aTitle[$c]; $c++;?> </td> </tr> <?php }}?> </table> Say I have an "Entries" table. I want to submit same multiple entries using a form submission. And If I have other queries submitted in the same form, I want those quarries to be submitted only once. Is that possible to do? Here's my code. if(isset($_POST['submit'])) { $entries = 10; $id = 55; $name = 'Smith'; $insert = $db->prepare("INSERT INTO entries(id, name) VALUES(:id, :name)"); $insert->bindParam(':id', $id); $insert->bindParam(':name', $name); $result_insert = $insert->execute(); if($result_insert == false) { echo 'Fail'; } else { echo 'Success'; } } ?> <form action="" method="post"> <input type="submit" name="submit" value="SUBMIT" /> </form> Edited January 13, 2019 by imgrooot Hi. Pretty straight forward I guess but as the name suggests am a newbie. I have a form that requires the user to enter certain parameters. If the values are blank it submits to itself and loads the error messages. What I want to do is create PHP code that submits the form to a different url. What I thought was create two forms (the second with hidden fields replicating the first form), each form having a different url in the action"" code. What I cant work out is the PHP IF ELSE code to submit form 2 if Form1 is is validated correctly. This is the PHP code relevant to the form validation. Help? <?php //If form was submitted if ($_POST['submitted']==1) { $errormsg = ""; //Initialize errors if ($_POST[width]){ $title = $_POST[width]; //If title was entered } else{ $errormsg = "Please enter width"; } if ($_POST[drop]){ $textentry = $_POST[drop]; //If comment was entered } else{ if ($errormsg){ //If there is already an error, add next error $errormsg = $errormsg . " & content"; }else{ $errormsg = "Please enter drop"; } } } if ($errormsg){ //If any errors display them echo "<div class=\"box red\">$errormsg</div>"; } //If all fields present if ($title && $textentry){ //Do something echo 'THIS IS WHERE I WANT THE CODE TO SUBMIT FORM 2 or SUBMIT FORM 1 TO A DIFFERENT URL'; } ?> I'm having a problem with including a list of clickable links. They keep including my website address before the web address instead of the the web address alone. Here is the code I'm using for it. The $item_url is the web address from the database. $content .="<table width=\"700\" height=\"50\" border=\"0\"><tr><td width=\"500\" class=\"titles\"><a href=$item_url target=\"_blank\">$item_title</a></td></tr><tr> <td width=\"400\" class=blackfont>Location: {$item_city}, {$item_state}</td></tr><tr><td class=blackfont>Country: {$item_country}</td></tr><br /> </table>"; I'm having a problem with make my links work. I have a link saved in a session variable but when I print it to the screen it doesn't seem to work. What happens is instead of the link taking you to "www.google.com" it will but the currently directory first so for example if would be "www.example.com/folder/www.google.com". I have checked the page source and it appears to be fine so I'm not sure what's happening. I've copied my code below. echo("<h3 class=\"left\"><a href=\"" . $_SESSION['submit_content_link'] . "\" class=\"linker\" title=\"1\" target=\"_blank\">" . $_SESSION['submit_content_title'] . "</a></h3>"); Thanks for any help. if i put a link in to go to google say, <a href='www.google.com'>link1</a> it goes to www.mysite.co.uk/www.google.com can any1 help? cheers mat I'm trying to figure out a way to incorporate multiple sorts on my php page. On the page of products, I want users to have three choices of links: one by date, one by price - low to high and one by price - high to low. I know how to perform ASC & DESC sorts in MySql but I'm not sure how to go about this sort with the three choices without creating more pages. I would really like it to stay with the same page. Is this even possible?? How would I go about it? Here is the section of code : $get_items_sql = mysql_query("SELECT id, thumb, username, sub_id, title, ROUND(price,2) AS price, date FROM product WHERE CURDATE() <= relist_date AND inactive IS NULL AND sold IS NULL AND cat_id = '1' ORDER BY date ") or die(mysql_error());; if (mysql_num_rows($get_items_sql) < 1) { $content = "<p><em>Sorry, no items in this category.</em></p>\n"; } else { $col = 0; $content .= "<ul>\n"; while ($items = mysql_fetch_array($get_items_sql)) { $item_url = "items3.php?id={$items['id']}&username={$items['username']}"; $item_title = stripslashes($items['title']); $item_price = $items['price']; $item_photo = $items['thumb']; $item_username = $items['username']; $item_date = $items['date']; $content .= ""; list($width) = getimagesize("image_files/{$item_photo}"); // set the maximum width of the image here $maxWidth = 100; if ($width > $maxWidth); $content .= "<table width=\"693\" border=\"0\" class=anotherfont><tr><td width=\"101\"> <a href=\"{$item_url}\"> <img alt=\"{$item_title}\" border=0 width=\"{$maxWidth}\" src=\"image_files/{$item_photo}\" /></a><td width=\"200\"> <a href=\"{$item_url}\">{$item_title}</a></td> <td width=\"109\">{$item_username}</td><td width=\"101\"> {$item_date}</td><td width=\"99\">\${$item_price} USD </td></tr></table>"; $content .= "\n"; Hi, This is a image tooltip from database. but I have got the problem, Not Working! How can i fix it. <a href="index.php?MD=urundetay&resimid=<?php echo $row_uruns['resimid']; ?>"><img src="urun_resim/<?php echo $row_image['image']; ?>" width="150" border="0" /></a> Hi guys. Im not sure if this is normal in php. But if someone could help. Its much appreciated! I try to do an anchor link on another page, here is my example: <a name="testi"></a> //somewhere above the code below <a href='$targetpage?page=$prev#testi'>prev</a> //anchor link When i click on "prev" link, it direct me to another page correctly. But my page name/title which is: <title>Testimonials | Ten International</title> //page name appears to be Testimonials | Ten International#testi How do i actually make the word #testi in my page name/title disappear of hidden? On my website, I have links to another website. The problem is, when I clink on the link for the first time, the target website gives me the error "Your session has expired". Then I have two options: Close that window and click on the link again: this will load the page without any problem. Refresh the window with the error message, again page loads with no issues. This is not very convenient for my users. I wonder if there is any way to fix this problem from my end using some coding? Not sure how. Thanks in advance. Hello, I am having a problem with a link text when ever there is a text that has multiple words. (e.g. 2 Cor prints out with the white space but when I click on the text the url is printed without the text as 2Cor and so it doesn't find a match) here is my code: Code: [Select] <?php if($_GET['book'] == ''){ $books = $wpdb->get_results(" SELECT book_name FROM {$wpdb->prefix}sb_books_sermons LEFT JOIN {$wpdb->prefix}sb_books ON {$wpdb->prefix}sb_books_sermons.book_name = name GROUP BY book_name ORDER BY {$wpdb->prefix}sb_books.id ASC "); foreach($books as $book){ echo '<li><div class="droidlist"><a href="bible/?book='.htmlentities($book->book_name).'">'.$book->book_name.'</a></div></li>'."\n\t"; } } I found a function online to auto link any variable containing text. It looks for http:// or www. in the text and then automatically adds the HTML code to turn it into a link. I have a problem though.. I have some html already in some of the variables that contain IMG tags. This function tries to link the url of the image.. so I get something like this: Code: [Select] <img src="<a rel="nofollow" href="IMAGEURL" target="_blank">IMAGEURL</a>" border="0" /> This creates a problem and the images don't load! Is there anyway to stop it from doing this? function auto_link($text) { $pattern = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#'; return preg_replace_callback($pattern, 'auto_link_callback', $text); } function auto_link_callback($matches) { $max_url_length = 50; $max_depth_if_over_length = 2; $ellipsis = '…'; $url_full = $matches[0]; $url_short = ''; if (strlen($url_full) > $max_url_length) { $parts = parse_url($url_full); $url_short = $parts['scheme'] . '://' . preg_replace('/^www\./', '', $parts['host']) . '/'; $path_components = explode('/', trim($parts['path'], '/')); foreach ($path_components as $dir) { $url_string_components[] = $dir . '/'; } if (!empty($parts['query'])) { $url_string_components[] = '?' . $parts['query']; } if (!empty($parts['fragment'])) { $url_string_components[] = '#' . $parts['fragment']; } for ($k = 0; $k < count($url_string_components); $k++) { $curr_component = $url_string_components[$k]; if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) { if ($k == 0 && strlen($url_short) < $max_url_length) { // Always show a portion of first directory $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short)); } $url_short .= $ellipsis; break; } $url_short .= $curr_component; } } else { $url_short = $url_full; } return "<a rel=\"nofollow\" href=\"$url_full\" target=\"_blank\">$url_short</a>"; } Hi, I have one webhost (A) that supports no PHP and has unlimited bandwidth. I have a second webhost (B) that does support PHP, but has limited bandwidth. The website is on host A and contains a 5mb file that people can download and I'd like to count the downloads. But now I need to use host B to count the downloads. I'm using this small script on host B to count the downloads. <?php $hits=file("count.txt"); $hits[0]++;$fp=fopen("count.txt","w"); fputs($fp,$hits[0]); fclose($fp); header("Location: http://webhost-A.com/files/download.zip"); ?> The download link people see on my website is: http://webhost-B.com/download.php Generally this works fine, but I found out that people can still find the direct link with download managers and then put that direct link on their website, which prevents me from counting those downloads. A solution I found is to use ReadFile. But the problem is that when using ReadFile, host B first downloads the file from host A and then sends it to the user and that's exactly what I don't want. Is it possible to let people download the file directly from host A without showing the direct download link in any way and also count the downloads? Hey guys im having a problem with emailing a link using local host mail. I'm using out look express with Mercury. I shorten the email below as much as possible. Its really wierd the target for the link is correct but clicking on it gives me this res ieframe.dll res://ieframe.dll/syntax.htm#http//localhost/stargate/users/account_settings.php? npd=82b1e0df295ee681f1fa2f213ade823d $to = $_POST['resendemail']; $from = "stargate@localhost.com"; $subject = "Stargate System Lords Password Recovery"; $message = "<html> <body background=\"#4B4B4B\"> <h1>Stargate System Lords Password Recovery</h1> Dear ".$users1['name'].", <br> <center> <a href="localhost/stargate/users/account_settings.php?npd=$new_password ">Log In</a> <p> <br /> </font> </body> </html>"; $headers = "From: Stargate Game Password Recovery <stargate@localhost.com>\r\n"; $headers .= "Content-type: text/html\r\n"; mail($to, $subject, $message, $headers); |