Error with where I position the new text - php

I was wondering if it could post to the top and instead of posting on the bottom?
index.php
<!DOCTYPE html PUBLIC "-W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/xml; charset=utf-8 ">
<title> Printing Statuses </title>
</head>
<body>
<form action = "StatusPoster.php" method = "get">
<fieldset>
<label>How are you feeling today?</label>
<input type = "text"
name = "userStatus" /><br>
<button type = "submit">
Submit
</button>
</fieldset>
</form>
</body>
</html>
StatusPoster.php
<!DOCTYPE html PUBLIC "-W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/xml; charset=utf-8 ">
<title> Printing Statuses </title>
</head>
<body>
<h1>Posted Successfully!</h1>
<?php
$date=date("m-d-Y h:i:s");
$userStatus = $_REQUEST["userStatus"];
print "<p>$userStatus at $date</p>"
?>
<?php
$status = fopen("mystatuses.php", "a+") or die("Unable to open file!");
$txt = " <span title='$date'>$userStatus</span><br>\n";
fwrite($status, $txt);
fclose($status);
print "Click <a href='http://localhost/FacebookStatus/mystatuses.php'>here</a> to see all statuses"
?>
</body>
</html>
mystatuses.php
Click <a href='http://localhost/FacebookStatus'>here</a> to go back<br> <span title='09-04-2015 10:22:30'>Alright</span><br>
<span title='09-04-2015 10:23:02'>Good</span><br>
<span title='09-04-2015 10:23:07'>Bad</span><br>
<span title='09-04-2015 10:26:02'>alright</span><br>

Related

Slideshare API 500 response for upload slideshow (www.slideshare.net/api/2/upload_slideshow)

Since yesterday slideshare API for upload slideshow using PHP didn't work.
We receive only 500 response (check below).
We accessed endpoint: https://www.slideshare.net/api/2/upload_slideshow
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="/stylesheets/error.css" type="text/css" rel="stylesheet" media="screen" />
<script type="text/javascript">
function disableSearch(event) {
var t = document.getElementById('searchstring');
if(t.value === 'Type text here …' || t.value.length === 0) {
event.preventDefault();
}
}
</script>
<title>500 error. The page could not be loaded.</title>
</head>
<body>
<div class="smiley"><img src="/images/errorsmiley.png" width="128px" height="128px" alt="error" /></div>
<div class="errorBox">
<p class="errorCode">500</p>
<h1>Sorry! The page could not be loaded.</h1>
<h2>
This is probably a temporary error. Just refresh the page and retry. If problem continues, please check back in 5-10 minutes.
<br/><br/>You could also check out our homepage or search below.</h2>
<div class="searchSection">
<form style="display: inline;" action="/search/slideshow" method="get">
<input type="text" id="searchstring" name="q" value="Type text here …" class="errorSearchBox" onclick="this.value = '';">
<button type="submit" onclick="disableSearch(event)">
Search<span> </span></button>
</form>
</div>
</div>
</body>
</html>

php reCAPTCHA not displaying

I am trying to add reCAPTCHA to my php/html site. But it does not display. I have downloaded the library and set up my site so I have the public and private keys. I have created a basic page to try and get this working but still no luck. This is my php code:
<!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" />
<?php
require_once('lib/recaptchalib.php');
?>
<title>Test odds and ends</title>
</head>
<body>
<form method="post" action="">
<?php
$publickey = "~hidden~";
echo recaptcha_get_html($publickey);
?>
</form>
</body>
</html>
The page displays completely blank. The html produced is:
<!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>Test odds and ends</title>
</head>
<body>
<form method="post" action="">
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=~hidden~">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=~hidden~" height="300" width="500" frameborder="0">
</iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
</form>
</body>
</html>
Does anyone know why this doesn't work? Many thanks in advance.

fill text field by clicking on another page

i have two pages.When i click link on first page, it fill text field on second page(get value from 'from' ).
my first page codes abc.php :
<!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>Untitled Document</title>
</head>
<body>
<p><strong>From</strong> <strong> Subject</strong> <strong>Reply</strong></p>
<p>biri deneme girdi click</p>
</body>
</html>
and this is second page kum.php :
<!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>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label>
<input type="text" name="hum" id="hum" />
</label>
</form>
</body>
</html>
What should i do?
you can get the url where the user comes from with $_SERVER['HTTP_REFERER'];
<input type="text" name="hum" id="hum"<?php if ($_SERVER['HTTP_REFERER'] == "http://examplepage.com/start/"){?> value="hi" <?php } ?>
/>
(not tested, just to give you a idea how you could use it)

Pop up window closed without completion of the function

I made a pop-up window that has a submit form and upon submission it must close but i first want to process the information from the pop-up window in a different page without displaying that other page. How can I do it?
my popupwindow contains this code
<!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" />
<script type="text/javascript">
function closeSelf(){
self.close();
return true;
}
</script>
<title>Add Activity</title>
</head>
<body>
<form action="./addact.php" method="post" onsubmit ="return closeSelf()">
<table width="500" border="1"><br/>
<tr>
<td>Activity Name</td>
<td>Assigned Person</td>
<td>Deadline</td>
</tr>
<tr>
<td> <input name="activities" type="text" size="40%"/></td>
<td><input name="name" type="text" size="40%"/></td>
<td><input type="date" name="deadline" size="20%"/></td>
</tr>
</table>
<input type="submit" name = "saved" id="saved"/>
</form>
</body>
</html>
and my other page contains this
<?php session_start(); ?>
<!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>Untitled Document</title>
</head>
<?php
include('config.php');
$actname= $_POST['activities'];
$assigned = $_POST['name'];
$deadline = $_POST ['deadline'];
$sql = "INSERT INTO ".$_SESSION['pname']."_activities
(actname, assigned, deadline)
VALUES
('$actname', '$assigned', '$deadline')
";
$query = mysql_query($sql);
echo $_SESSION['pname'];
?>
<body>
</body>
</html>
You should close the window when the response is returned, not when you submit the page. And as #Marc B pointed out, you have major security problem!

textbox number type in html cut off 0 if post form in php

If i give textbox type as number and submit a form it cut off 0 .
ex: 099921 means it will post as 99921
why it cut off preceding 0
Because 0 in front means nothing and is removed. Make it a string (text) and it will stay. Ints have no 0 in front.
i dont know why but i did the same code and it is displaying the value with o i.e 099921
check out my code
<?php
if(isset($_POST['submit']))
{
echo $numberValue = $_POST['numVal'];
}
?>
<!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>Untitled Document</title>
</head>
<body>
<form method="post">
<input type="number" name="numVal" value="" />
<input type="submit" name="submit" value="submit"/>
</form>
</body>
</html

Categories