Location: PHPKode > projects > phpautotest > start.php
<?php
require 'includes/phpautotest_config.php';
require 'includes/phpautotest_functions.php';

if($_POST['targetpage'] && $_POST['description'])
{
	$start_timestamp = time();
	
	// Create a new case record and store its id in a session variable
	$QUERY = <<<END

		INSERT INTO
			`$phpautotest_table_cases`
			(`case_id`, `description`, `start_timestamp`)
		VALUES
			('?', '$_POST[description]', '$start_timestamp')
END;

	phpautotest_send_query($QUERY);
	
	header("Location: $_POST[targetpage]");
}

// We put this after the form processing to avoid sending headers before calling header()
require 'includes/header.php';

// The interpreter wont reach this far if form was submitted since we're using header to redirect it. The javascript below is used to inform the 
?>
<SCRIPT LANGUAGE='JavaScript'>
var page_var = '979a_PTFE';
</SCRIPT>
<?
echo
"
<div class = 'content'>
Enter the address of the page you want to start recording with. You can also enter a description that will help you remember what the test is about. Once the page opens, move from page to page using links or form buttons. The pages you visit as well as data entered into forms is remembered by phpautotest.
<form method = 'POST' action = '$PHP_SELF'>
<table cellspacing='1' cellpadding='3' bgcolor='white' align = 'center' class = 'box'> 

<tr bgcolor='#005896'>
	<td colspan = '2'><font color='#FFFFFF'><b>Start recording a snapshot</b></font></td>
</tr>

<tr bgcolor = '#dddddd'>
	<td>Start URL</td>
	<td valign = 'top'><input type = 'textbox' name = 'targetpage' class = 'phpautotest_text'></td>
</tr>

<tr bgcolor = '#dddddd'>
	<td valign = 'top'>Description</td>
	<td><textarea name = 'description' class = 'phpautotest_text' cols='70' rows='10'></textarea></td>
</tr>

<tr bgcolor = '#dddddd'>
	<td colspan = '2' align = 'right'><input type = 'submit' value = 'start' class = 'phpautotest_button'></td>
</tr>

</table>
</form>
</div>
";

require 'includes/footer.php';
?>
Return current item: phpautotest