Jump to content

tomks77

Members
  • Posts

    8
  • Joined

  • Last visited

tomks77's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. we can add dropdown menu in the html part like this: <select name"select1"><option>One</option></select> Ok, something like that, and we use the name "select1" in the php part like this:$_POST['select1']; but i found that i can not use the dropdown menu in the php part when i add it through the php.like this: <?phpprint "<select name='select1'>";print "<option>";print "One";print "</option>";print "</select>";?> because when i try to check what option the user chose using:$_POST['select1']i receive the error : undefined variable select1. if any one have an idea or a website that talk about this i'll be glad..I found some sites but itall use javascript to define what option the user click on.. is this mean there is no way to handle this issue using php??
  2. if i put it like this:print ("<td><a href=\"edit2.php?id='$db_field[id]'\">Edit</a></td></tr>" ); // ' $db_field[id] ' Or like this:print ("<td><a href=\"edit2.php?id=$db_field[id]\">Edit</a></td></tr>" ); / / id=$db_field[id] i still have the same error, in the address bar its like this: ocalhost/edit2.php?id=4so as you see, its right there.. id=4, but in the top of the page i have the error undefind variable.
  3. some body in an other post helped me with this problem, sending variables to an other page.using $_SESSION.. it worked>>, but only when i search for one record only, becouse the SESSION takes the id number that i will use in an other page when user click on "Edit".. now when i show all the records in a table, there will be one more column that have the word 'Edit'so when you find the record in the table just click on "edit" to take you to the edit page, so i did like this in the first page: print ("<td><a href=\"edit2.php?id='$db_field[id]'\">Edit</a></td></tr>" ); when you click on "Edit", you jump to the page Edit2.php, taking the variable 'id'. the problem is this: in the page edit2.php, the variable id is shown in the address bar, but an error keep happenning..UnDefined Variable id in line... i found its strange: why the program can not see the variable id, although it appears in the address bar!!
  4. 'Deirdre's Dad' The easiest thing is to move all that PHP, with the opening and closing <?php ?>tags, after the closing </form> tag. ---------------- well i moved the code and put it after the form tags..and it worked... now the elements stay up on the top of the page...and the table is printed under them.. thank you...for the help
  5. I have this code like this: <html><head><title> some thing </title> <?PHP $user="root";$password="";$server= "1.1.1.1."; $db_handle=mysql_connect($serve,$user,$password);$db_found=mysql_select_db($database,$db_handle); if ($db_found){ if(isset($_POST['sub_show'])){ $SQL2 = "SELECT * FROM costumers ";$result2 = mysql_query($SQL2); print "<table border='2' align ='center'><tr><th bgcolor=#808080><b>ID</b></th><th bgcolor=#808080>Name</th><th bgcolor=#808080>City</th><th bgcolor=#808080>Fone</th><th bgcolor=#808080>E-Mail</th><th bgcolor=#808080>Since</th></tr>"; while ( $db_field = mysql_fetch_assoc($result2) ) {print "<tr>"; print "<td bgcolor=#C0FFC0 >" ."<font color=#FF0000>"."<b>" . $db_field['ID'] . "</b>". "</font>" ."</td>"; print "<td bgcolor=#C0FFC0>" ."<b>". $db_field['name'] . "</b>"."</td>"; print "<td bgcolor=#C0FFC0>". "<b>". $db_field['city'] . "</b>"."</td>"; print "<td bgcolor=#C0FFC0>". "<b>". $db_field['fone'] ."</b>". "</td>"; print "<td bgcolor=#C0FFC0>"."<b>". $db_field['e_mail'] . "</b>"."</td>"; print "<td bgcolor=#C0FFC0>"."<b>". $db_field['date'] . "</b>"."</td>"; print "</tr>"; } print "</table>"; ?> </head><body> <form name=form1 method=POST action"page.php"> <input type="text" name="name" value=""><input type="text" name="city" value=""><input type="text" name="fone" value=""> <input type = "submit" name="sub_save" value="save"><input type = "submit" name="sub_show" value="show"></form</body></html> So the table in the PHP code is displayed on the top of the page and the textboxes and the butons goes down to the end of the page i want to display the table down..to the end, and my textboxes remain on top
  6. First, we (beginners) are sorry that we cant answer other topics to help...we only make topics to ask for help.....who knows...maybe someday.. i have some textboxes where user can enter name, city, fone..and a button to save the informations to the database.. now there is a button 'Show', that shows all the records. Or one specific record in a html table in the same page of the textboxes, the problem, is that the table, with the records, is displayed in the top of the pageand the textboxes go down to the end of the page, so how can i keep the textboxes in the top of the page and print the table under it?
  7. Hi there i am new in php and new in this forum..i sow a tutorial of php and started to learn but i started tohave some problems that i couldn't find an answer for.. i have a database and a table called costumers, i have a form with some textboxes where user put name, city, fone, e-mail, and click on save button, thats ok. and i used an other button to show allthe records in the table. and thats ok too, the PROBLEM is when i want to show a record from the table using the field ID. and toshow this record in the same textboxes.. i used : SQL ="SELECT id FROM costumers WHERE id=&_POST['id']"; untill here i can say like this: if ($result){print "record found";} but i am not able to make the information to appeare in the textboxes..look at the code: $findname=$_POST['id']; //text box with the name id in the form. $sqlfind="SELECT id FROM costumers WHERE id='$findname'";$sqlfind2=mysql_query($sqlfind); while ( $db_field= mysql_fetch_array($sqlfind2)){ $name1=$db_field['name']; } }else {print "<BR>". "This ID does not exist";} i keep having the error: Notice: Undefined index: name in ****** line number .. which is the 'name' in this line:$name1=$db_field['name']; so why it can not see the textbox named 'name'?? okey... i tried to show the record informations in a secund page. that hase a textbox called 'id' to show the ID field in the table costumers , but afterclicking in submit and go to the secund page it gives me this error:Notice: Undefined index: id in*** so as you see its like the textbox id is not there... if eny one have a good advise or some thing....all be happy, thanks
×
×
  • Create New...