Jump to content

korbenmxli

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

korbenmxli's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. im having trouble with this code.... i have 2 tables oe with us states and other with countys in each state.. you maybe have the idea... the user check a state in one drop and the other filter the table to just of the countys in the selected state... my code works fine but... here?s my problem.... i had to put a "GO" button so the other drop do the filter and when i click the button the 2nd drop filter the table ok but the 1st table show the first element... heres the tables structures.... allstates: id, states countys: id, state, county and heres the code <body> <?php mysql_connect("localhost", "root", ""); mysql_select_db("ubication"); ?> <form action="" method="post"> <select name="state"> <?php $state_query = "SELECT id, states FROM allstates"; $state_result = mysql_query($state_query); while($state = mysql_fetch_array($state_result)) { if($_POST['sta'] == $state['id'] ) { echo '<option selected value="' . $state['id'] . '">' . $state['sta'] . '</option>'; } else { echo '<option value="' . $state['id'] . '">' . $state['sta'] . '</option>'; } } ?> </select> <input type="submit" name="submit" value="GO" /><br /><br /> <select name="city"> <?php if($_POST['submit']) { echo $_POST['state']; $city_query = "SELECT id, county FROM countys WHERE id = '{$_POST[state]}'"; $city_result = mysql_query($city_query); while($city = mysql_fetch_array($city_result)) { echo '<option value="' . $city['id'] . '">' . $city['county'] . '</option>'; } } ?> </select> </form> </body> </html> tnx in advance!!!
  2. hey!! tnx.. the suggest from socrates was the solution... i cant believe i was not think in something so simple... tnx 4 everything guys
  3. use an <a>. ?? where i must use that option... sorry im kinda ne to php
  4. it display all records in the database but dont link to the page associated to the record, example record 1 in the database is modelo paginal SF-6032 6032.html SF-6032IR sfri.html .... ...
  5. hi every one i want to make a list from my database and if user click on one item it open a link... its a list of models of products so if click in one link me to the page of its full description, my database has the fields: "modelo" (model), and "paginal" the link page i make this code.. works fine cause display all the catalog but when i click in an item dont do nothing... hes the code.. what im missing?? tnx in advance <?PHP // Connect to MySQL Server @mysql_connect('localhost','user','password') or DIE("Couldn't Connect to MySQL Database"); // Select Database @mysql_select_db('zerocctv_almacen') or DIE("Couldn't Select Database"); $sql = "SELECT modelo, paginal,precio,foto FROM modelos"; $result=mysql_query($sql); $row_array=mysql_fetch_row($result); $string='<select name=selection><option value=>modelo</option>'; for ($i=0;$i < mysql_num_rows($result);$i++) { if ($row_array[0]=="") { $row_array=mysql_fetch_row($result); } else { $string .='<option value="'.$row_array[1].'">'.$row_array[0]."</option>"; $row_array=mysql_fetch_row($result); } } $string .='</SELECT>'; //echo "</label>"; echo $string; ?>
  6. tnx dooper i didn't know i can record info in html format.... i did and works fine even i add the <..... target=_blank> im building of site of my own with documents, manuals and tips bout software thats y i want links.... tnx again
  7. new to PHP but make advances.... i display my table in a grid and all work fine... i have a field with url adress or links to other pages in my site..... its possbible to display that field in my grid but like real hyperlinks?? i mean do click on it and go to the page?? i mean... like any other link ... let say .... subject description more info -----------------|---------------------------------------------|------------------- WORD calendar templates bla bla templates here <-- this field must be a link tnx
  8. TNX thats what i need
  9. hi all im new to PHP & SQL i just wantr a simple way to give my query a grid format... i have this and works fine <?php // 1. Create a database connection $connection = mysql_connect("localhost","root","#######"); if (!$connection) { die("Database connection failed:" . mysql_error()); } // 2. Select a database to use $db_select = mysql_select_db("mb_tips" ,$connection); if (!$db_select) { die("Database selection failed: " . mysql_error()); } ?> <html> <head> <title>DISPLAY</title> </head> <body> <?php $result = mysql_query("SELECT * FROM tips", $connection); if (!$result) { die("Database query failed: " . mysql_error()); } while ($row = mysql_fetch_array($result)) { echo $row[1]." ".$row[2]."<br/>"; } ?> </body> </html> <?php mysql_close($connection); ?> how i make all my rows show like this ------------------------------------------------------ | Subject # | SUBJECT | Date | BLA | BLA | --------------------------------------------------------------- | 1 | bla bla | ccc ....................... ....................
×
×
  • 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.