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
Share on other sites

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