Codice PHP:
<?php
session_cache_limiter('no-store');
$cache=session_cache_limiter();
session_cache_expire(5);
session_start();
include("../config.php");
session_name($nome_sessione);
require_once("dompdf_config.inc.php");
if ( isset( $_POST["html"] ) ) {
if ( get_magic_quotes_gpc() )
$_POST["html"] = stripslashes($_POST["html"]);
$old_limit = ini_set("memory_limit", "16M");
$dompdf = new DOMPDF();
$dompdf->load_html($_POST["html"]);
$dompdf->set_paper($_POST["paper"], $_POST["orientation"]);
$dompdf->render();
$dompdf->stream("dompdf_out.pdf");
exit(0);
}
?>
<center><form action="<?php echo $_SERVER["PHP_SELF"];?>" method="POST" [COLOR=red][SIZE=3] onload="this.form.submit();"[/SIZE][/COLOR]>
<div>
<select name="paper">
<?php
echo "<option value=\"$size\">$paper</option>\n";
?>
</select>
<select name="orientation">
<option value="<?php echo $orientation; ?>"><?php echo $orientation;?></option>
</select>
</p>
<?php
$connessione_host = ftp_connect($ftp_host);
$login = ftp_login($connessione_host, $username, $pwd);
$target=fopen("../".$path."/".$_SESSION['id_agenzia']."_$tempo.txt",'r');
$contents = fread($target, filesize("../".$path."/".$_SESSION['id_agenzia']."_$tempo.txt"));
echo "<textarea name=\"html\" cols=\"60\" rows=\"20\">".$contents."</textarea>";
fclose($target);
unlink("../".$path."/".$_SESSION['id_agenzia']."_$tempo.txt");
ftp_close($connessione_host);
?>
<div style="text-align: center; margin-top: 1em;">
<input type="submit" name="submit" value="Crea PDF">
</div>
</div>
</form></center>
Qualcuno sa dirmi come mai non funziona quel onload? O qualcuno saprebbe dirmi come fare per far fare una submit automatica al caricamento della pagina? ho provato onload in un tag body ma non li piace perche se do un id al form (eg. foo) e faccio foo.submit() o form.foo.submit() or document.foo.submit() o qualsiasi combinazione mi dice che o l'oggetto non e dichiarato o che l'oggetto non puo usare quella funzione...