sp33d1 Posted July 21, 2008 Share Posted July 21, 2008 Im trying to build a script when i hit the submit button the noticia[id] number alters the mysql select ORDER BY id number but the problem is when i hit submit i cant get the number to change im trying to this with forms so when they hit submit the Id number changes based on which listing they selected by hitting the submit button. can anyone help me alter this so i can get the Id number to change the value does but the mysql query variable wont. heres the code: echo " <form action=\"preview.php\" method=\"post\" target=\"foo\" onSubmit=\"window.open(\"\", \"foo\", \"width=800,height=600,status=yes,resizable=yes,scrollbars=yes\" )\" > <input type=\"hidden\" name=\"Id\" value=\"$noticia[id]\"/> this is the code on preview.php $layout_id = "echo POST_['Id']"; // Get all the data from the "layouts" table $result = mysql_query("SELECT * FROM layouts ORDER BY id='$layout_id' DESC LIMIT 0,1") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/115780-help-serious-problem/ Share on other sites More sharing options...
joquius Posted July 21, 2008 Share Posted July 21, 2008 First of all you might want to have more punctuation in your sentences, it's hard to understand the connection between what's gone wrong and what you actually need. Are you trying to UPDATE the mysql table with the new value? Link to comment https://forums.phpfreaks.com/topic/115780-help-serious-problem/#findComment-595215 Share on other sites More sharing options...
sp33d1 Posted July 21, 2008 Author Share Posted July 21, 2008 Ok sorry about the that. Yes when the value changes by the id number I'd like for preview.php to change also once they hit submit. it's a looping process i cant make 100's previews thats why i use the php form option but it's not working. Link to comment https://forums.phpfreaks.com/topic/115780-help-serious-problem/#findComment-595217 Share on other sites More sharing options...
joquius Posted July 21, 2008 Share Posted July 21, 2008 Ah ok I finally understand what's going on. <input type=\"hidden\" name=\"Id\" value=\"$noticia[id]\"/> Where is $noticia[id] from? Where is the changeable input field? $layout_id = "echo POST_['Id']"; should be $layout_id = isset ($_POST['fieldname']) ? $_POST['fieldname'] : $defaultvalue; A lot of other things but this is a start. Link to comment https://forums.phpfreaks.com/topic/115780-help-serious-problem/#findComment-595219 Share on other sites More sharing options...
sp33d1 Posted July 21, 2008 Author Share Posted July 21, 2008 Where is $noticia[id] from? Where is the changeable input field? it's on the original code page while($noticia = mysql_fetch_array($result)) it's my fetch. the changeable input field is value=\"$noticia[id]\" the problem is when i click submit it wont change the mysql code on the other page which is $layout_id = "echo $_POST['Id']"; // Get all the data from the "layouts" table $result = mysql_query("SELECT * FROM layouts ORDER BY id='$layout_id' DESC LIMIT 0,1") or die(mysql_error()); When i hit submit i want $layout_id to change based on which noticia id I hit since it's looping i'll get value="1" value="2" value="3" ect... Link to comment https://forums.phpfreaks.com/topic/115780-help-serious-problem/#findComment-595225 Share on other sites More sharing options...
sp33d1 Posted July 21, 2008 Author Share Posted July 21, 2008 i appreciate the help. Link to comment https://forums.phpfreaks.com/topic/115780-help-serious-problem/#findComment-595226 Share on other sites More sharing options...
sp33d1 Posted July 21, 2008 Author Share Posted July 21, 2008 wow man you fixed the problem thanks Link to comment https://forums.phpfreaks.com/topic/115780-help-serious-problem/#findComment-595230 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.