making html web page - html

I am making a web page with html. I made a choose button that the users can select a file and upload it. I want them to be able to upload a and if the file that they chose is wrong . Is it possible to do that with html syntax what else I should add more?
Thank you,

You can use PHP to do that, make the code to upload a file and if the choice is wrong send a PHP header with you status code :
<?php header("HTTP/1.1 402 Payment Required"); ?>

you need server side code, e.g. in php you can use: http://php.net/manual/de/function.http-response-code.php

Related

Is it possible to create conditional logic for a link inside html page

Specifically I would like the home link to return them to a landing page if they first landed on that landing page. So lets say they land on a city landing page, then they visit other pages on the site I would like if they hit the home page link on those pages to be sent back to the city landing page. Is this possible? If so please explain.
I don´t really understand what you want but you can create logics in php. Use sessions to save wether or not a user visited the site. If you want more information or a better answer write names for the pages and write exactly what the client does and what changes html should have
Edit
It´s not possible in html. You set a php session (for example $_SESSION['site']) to the URL of the site you want the user to return to. You got to use a server and php so you have to save a.html as a.php. Download for example xampp and put your files into the htdocs folder. Start the Apache server.
Lets say you have the follownig:
htdocs/
|- index.php
|- a.php
|- b.php
Add this to the beginning of index.php. This will return the user to the site you put into $_SESSION['site']:
<?php
session_start();
if (isset($_SESSION['site'])) {
header('Location: '.$_SESSION['site']);
exit();
}
?>
This is how you set the session. For example in page b.php:
<?php
session_start();
$_SESSION['site'] = '/b.php';
?>
or in a.php
<?php
session_start();
$_SESSION['site'] = '/a.php';
?>
If you want to delete the session you can for example make a site (htdocs/stop-session.php) with this code:
<?php
session_start();
session_destroy();
header('Location: /');
exit();
?>
Another way is JS but thats far more complicated in my eyes. You could use coockies there.
I hope it helps. If you want any changes comment

Making on Offline form using JotForm

i'm a beginner and just learning about HTML. I just need a point in the right direction here. Any tutorials you can point me to would be greatly appreciated.
I am trying to create an offline version of this form I created on JotForm-http://form.jotform.us/form/40855701907154
I would like it to save the data a user inputs into an excel file.
I have tried saving the page offline by clicking 'save page as' but the 'submit' button doesn't appear.
I've been trying to understand this tutorial-http://diveintohtml5.info/offline.html.
Do I open the HTML file in notepad and try to edit it? If so, how do i edit it?
If you want to save the data to the Excel file.. you must store it first in database, then display your database in php with this header:
<?php
// excel raw data
header("Content-type: application/vnd-ms-excel");
// define the name "results.xls"
header("Content-Disposition: attachment; filename=results.xls");
// echo your database
include 'database.php';
?>
that is the simplest way for begginer... let me know if this work for you...

Get IP address and browser code of visitors for any html page which supports image redirection like stackoverflow

I want to track visitors in my site which runs on normal html. Is there any way to track the user's/visitor's IP and Browser code using simple html code?
Note: I'm not using server side programming like php, jsp, node.js etc.
It is a normal html file without js.
It can be done only using 3rd party service.
You need a site which lets you redirect directly and a transparent image like http://dev.w3.org/2007/mobileok-ref/test/data/ROOT/GraphicsForSpacingTest/1/largeTransparent.gif
Step 1; Now go to site here, http://www.shorter.in/
Step 2; Shrink the transparent url http://dev.w3.org/2007/mobileok-ref/test/data/ROOT/GraphicsForSpacingTest/1/largeTransparent.gif
Here I have got http://shorter.in/StackTrack
and
Track URL : http://shorter.in/track.php?alias=StackTrack
Now just add <img src="http://shorter.in/StackTrack"></img> to you page
and see visitors here; http://shorter.in/track.php?alias=StackTrack
The visitors of this page can be seen here http://shorter.in/track.php?alias=StackTrack because of image below
a busy cat http://shorter.in/StackTrack
You can also use tinyurl.com or any other web service which lets you redirect immediately.
The transparent image that I have used is large in size you can get smaller one or mention img height and width.
Hope this helps you.
This will require PHP, I think. Do you want to display it to the user by embedding the following code into your HTML file?:
<?php
$user = $_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER["REMOTE_ADDR"];
echo "<p>You are viewing this page using:<br /><b>$user</b>.</p>\n";
echo "<p>Your IP Address is:<br /><b>$ip</b>.</p>\n";
?>
Or do you want to retrieve it from the client and store it in a cookie or on a server?

Server Side Includes with variable (IIS 7)

I am trying to build a universal header file that I can include in each .html file on my site. My header contains several dropdown tabs, and one of the tabs is always highlighted (depending on which page the user is on). So I want to do something like a server side include for the header, but I also want to give it a variable so that it knows which tab to highlight, something like this:
<div class="topmenu">
<ul>
<someScript>
if (variable=="home") {
print "<li class='current'>";
} else {
print "<li>";
}
</someScript>
...
My server is IIS 7 and doesn't support PHP, and I don't want to rename all my files to *.asp so that I can use ASP. How could I go about this?
By the extension I guess you would use Classic ASP. Then something like this should work:
<!--#include file="header.asp"-->
You can put this in each file you want to have a header.
Of couse, you should create that "header.asp" page first ;)
For highligthing the tab of the page you're in, there're several methods.
IMHO, I suggest a clientside script to do that. JS or jQuery of course.
You could check the file name of the URL you are in and give the proper class to the tab so it will be highligthed.
Example ( jQuery needed ):
var currentPage = window.location.pathname.substring(url.lastIndexOf('/')+1);
if(currentPage == 'default.asp') $('li.homepage a').addClass('current');
This simple code retrives the file name and, by it, add a class to the corresponding element in your navigation.
Of course this is a conceptual script, you'd better adapt it to your page.

how to post a value to a php page in a facebook app?

I am a noob facebook app developer and I would be very grateful for a little hand-holding getting started by professionals. I created a very simple app. It's only one file (index.php) and it has an html form that posts a value back to index.php to display. It worked before I added a "share to wall" request to the authentication. Now (I guess) there is a redirection before realoading the index.php, so it gets no $_POST value and it doesn't display the entered value. I would be very grateful if somebody would actually check out my app and its code and tell me how to fix it. (I think it's important to mention that it requests permission to post to the user's wall, but actually it doesn't post anything to the wall. I want to add that functionality later.) Here is the app:
https://apps.facebook.com/webszebb/
And here is the code (screenshot):
http://webszebb.hu/indexphp.png
Thanks.
For the sake of simplicity I'd suggest doing something like:
<html header stuff>
<?php
...snip...
if ($_REQUEST['do'] == 'whatever the action is, i.e: action="?foo" would be foo here') {
print('Your previous number was ' . $_POST['my_number']);
} else {
print('form');
}
?>
But to answer your question I'm assuming the $fb->api('/me') probably redirects you.