Jump to content

reload(form)? without losing my data!


law

Recommended Posts

Ok i don't know javascript but I can see how it "works" kinda soo here is the code

<head>

<?php

session_start();

if(isset($_SESSION['admin_user'])){

$tmp=$_SESSION['admin_user'];

echo "
<link rel='stylesheet' type='text/css' href='../css/admin.css'>";
//=================JAVASCRIPT=========================?>
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.section[form.section.selectedIndex].value;
self.location='admin.php?Category=' + val ;
}
</script>
<?php
//====================================================
echo "
</head>
<body>
<div id='stuff'>";
include_once("../dbconfig.php");
//==========================PHP Form Processing Query's=====================================
$section = mysql_escape_string($_POST[section]);
if($section == 1){
if (something>nothing){
	//$updatequery = "UPDATE winner SET choice='$var10' WHERE winnerid='$userid' and competitionid='$i'";
	//$query = "INSERT INTO winner (winnerid, competitionid, choice) VALUES ('$userid','$i','$var10')";
	//$result = mysql_query($query) or mysql_query($updatequery) or die("MySQL ERROR: $query <br>".mysql_error

());
}
}
//==============================End of form Processors======================================
echo 
"<form name='news' action='./admin.php' method='post' enctype='multipart/form-data'>
<table cellspacing='16' cellpadding='0' border='0'  >
<tr>
	<td class='form_field' valign='top' align='right'> What section are you working on? </td><td width='10'  

aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td>
	<td class='form_text'>";

for ($i=1;$i<10;$i++) {
if ($urlname[$i] != null) {
	echo"
	<input type='radio' name='section' onchange=\"reload(this.form)\" value='$i'> $urlname[$i]<br>";
	}
}
echo"
	</td>
	</tr>
	<tr>
	<td class='form_field' valign='top' align='right'> What are you updating? </td><td width='10'  

aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td>
	<td class='form_text'>
	<select name='update'>";
for ($i=1;$i<10;$i++) {
	echo"
	<option value='$i'> $sectionselection <br>";
}
echo"
	</select>
	</tr>
	</td>
	<tr>
	<td class='form_field' valign='center' align='right'>Url </td><td width='10'  aligh='right' valign='top'> 

<font size='2' color='#ff0000'>*</font> </td>
	<td class='form_text'>
	<textarea name='url' rows=1 cols=25 ></textarea>
	</td>
	</tr>

	<tr>
	<td class='form_field' valign='center' align='right'>Title </td><td width='10'  aligh='right' valign='top'> 

<font size='2' color='#ff0000'>*</font> </td>
	<td class='form_text'>
	<textarea name='title' rows=1 cols=25 ></textarea>
	</td>
	</tr>

	<tr>
	<td class='form_field' valign='center' align='right'>Caption </td><td width='10'  aligh='right' 

valign='top'> <font size='2' color='#ff0000'>*</font> </td>
	<td class='form_text'>
	<textarea name='caption' rows=1 cols=25 ></textarea>
	</td>
	</tr>	
	<tr>
	<td class='form_field' valign='top' align='right'>Info </td><td width='10'  aligh='right' valign='top'> 

<font size='2' color='#ff0000'>*</font> </td>
	<td class='form_text'>
	<textarea name='info' rows=4 cols=25 ></textarea>

	</td>
	</tr>


<tr><td colspan=3 align='right'><input type='submit' value='Submit'>    <input type='reset' 

value='Reset'></td></tr>
</table>
</form>
<table align=center>
<tr>
<td align=center><form name='logout' action='./logout.php' method='post' enctype='multipart/form-data'>
<input type='image' src='../images/logout.png' value='Submit' alt='Logout'/>
</tr>
</td>
</div>";
} else {

header("Location:index.php?notloggedin=1");

}
?>

 

the javascript section is not right.. i obviously don't know how the naming system works.. so first i need to actually get it to reload the page.. once that is done i need the url that it redirects the page to... so i can use it for making lots of alternate scenario forms... any way.. i just need to get the reload working so i can go back to PHP lol...

 

also also i want the radio buttons that they click to be selected by default when the form reloads... i should be able to do that with php but.. i cant picture it in my head yet how that would work... any suggestions?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.