Jump to content

Help serious problem...


sp33d1

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.