law Posted March 29, 2008 Share Posted March 29, 2008 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.