grk101
Members-
Posts
60 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
grk101's Achievements
Member (2/5)
0
Reputation
-
well i would assume even with no data loaded the form would still show but with no values no?
-
so even though there are a few entries in the db, unless the URL passes an ID=1 or whatever then populating the form is useless without that unless i hard code it in the script? still dumb founded as to why the form doesn't show but what can u do
-
from what i understand, i can't just land on update.php and have the form populate right? that would be useless right? But if i click Update on a link and pass the variable for the ID - so get can work then i can populate the form right?
-
well, initially the code was different int he first post, therefore i changed it up according to the suggestion from thorpe ( thanks btw) i have changed the form to the correct variable. what i wanted this form to do is populate the entries from the database so i can edit it and submit the changes. though , i can't get the form to display i have added the <?php tags but the echo said the id is not set
-
hmmm, it says the id is not set, bascally the handle error that is commented. though aren't'we defining the id with the GET?
-
I changed this and stil the form doesn't appear for the love of me! I see it on dreamweaver fine, but when i upload it and load the update.php file.. the form is not there. <?php if (isset($_GET['id'])) { mysql_connect("xxxxxx", "tsxxxxx1", "xxxxxxx") or die('Unable to connect to database' .mysql_error()); mysql_select_db("contactsfind"); $id = mysql_real_escape_string($_GET['id']); $query = "SELECT * FROM contacts WHERE id='$id'"; if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { extract($row); ?> <form action="updated.php"> <input type="hidden" name="ud_id" value="<? echo "$id"; ?>"> First Name: <input type="text" name="ud_first" value="<?=$first ?>"><br> Last Name: <input type="text" name="ud_last" value="<? echo "$last"?>"><br> Phone Number: <input type="text" name="ud_phone" value="<? echo "$phone"?>"><br> Mobile Number: <input type="text" name="ud_mobile" value="<? echo "$mobile"?>"><br> Fax Number: <input type="text" name="ud_fax" value="<? echo "$fax"?>"><br> E-mail Address: <input type="text" name="ud_email" value="<? echo "$email"?>"><br> Web Address: <input type="text" name="ud_web" value="<? echo "$web"?>"><br> <input type="Submit" value="Update"> </form> <?php } } else { // no results found, handle error } } else { // query failed, handle error } } else { // id not set, handle error} } ?>
-
I have to admit i getting stupid this late at this.. i have done the following <? if (isset($_GET['id'])) { mysql_connect("****", "****", "****") or die('Unable to connect to database' .mysql_error()); mysql_select_db("contactsfind"); $id = mysql_real_escape_string($_GET['id']); $query = "SELECT * FROM contacts WHERE id='$id'"; if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { extract($row); ?> <form action="updated.php"> <input type="hidden" name="ud_id" value="<? echo "$id"; ?>"> First Name: <input type="text" name="ud_first" value="<?=$first ?>"><br> Last Name: <input type="text" name="ud_last" value="<? echo "$last"?>"><br> Phone Number: <input type="text" name="ud_phone" value="<? echo "$phone"?>"><br> Mobile Number: <input type="text" name="ud_mobile" value="<? echo "$mobile"?>"><br> Fax Number: <input type="text" name="ud_fax" value="<? echo "$fax"?>"><br> E-mail Address: <input type="text" name="ud_email" value="<? echo "$email"?>"><br> Web Address: <input type="text" name="ud_web" value="<? echo "$web"?>"><br> <input type="Submit" value="Update"> </form> <? } } else { // no results found, handle error echo ' no results found' } } else { // query failed, handle error echo ' query failed' } } else { // id not set, handle error} echo ' the id is not set' } ?> ugh i don't know what i am doing the form wont show at all.
-
to be honest this code i found on a tutorial , i copied some of it, fixed it up a bit, things i didn't like and bam didn't work either way so the following is not being used? $i=0; while ($i < $num) { $first=mysql_result($result,$i,"first"); $last=mysql_result($result,$i,"last"); $phone=mysql_result($result,$i,"phone"); $mobile=mysql_result($result,$i,"mobile"); $fax=mysql_result($result,$i,"fax"); $email=mysql_result($result,$i,"email"); $web=mysql_result($result,$i,"web"); doesn't the above just loop through the results to be updated?
-
i have be looking at google for a while and this was my last result. i can't figure out what i am doing wrong if someone can land a hand? basically the information has been written to the db fine and dandy i see it there, i just can't get the update below to work so it populates the form and also shows it! it just gives me a blank page <? $id=$_GET['id']; mysql_connect("mysql.xxx.com", "usre", "pass") or die('Unable to connect to database' .mysql_error()); mysql_select_db("contactsfind"); $query="SELECT * FROM contacts WHERE id='$id'"; $result=mysql_query($query); $num=mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) { $first=mysql_result($result,$i,"first"); $last=mysql_result($result,$i,"last"); $phone=mysql_result($result,$i,"phone"); $mobile=mysql_result($result,$i,"mobile"); $fax=mysql_result($result,$i,"fax"); $email=mysql_result($result,$i,"email"); $web=mysql_result($result,$i,"web"); ?> <form action="updated.php"> <input type="hidden" name="ud_id" value="<? echo "$id"; ?>"> First Name: <input type="text" name="ud_first" value="<?=$first ?>"><br> Last Name: <input type="text" name="ud_last" value="<? echo "$last"?>"><br> Phone Number: <input type="text" name="ud_phone" value="<? echo "$phone"?>"><br> Mobile Number: <input type="text" name="ud_mobile" value="<? echo "$mobile"?>"><br> Fax Number: <input type="text" name="ud_fax" value="<? echo "$fax"?>"><br> E-mail Address: <input type="text" name="ud_email" value="<? echo "$email"?>"><br> Web Address: <input type="text" name="ud_web" value="<? echo "$web"?>"><br> <input type="Submit" value="Update"> </form> <? ++$i; } ?>
-
Okay, i tried search this form, and have provide a screen shot to show that i keep getting errors when searching.. anyway this is what i want to do... fill out form (html ) goes to a confirmation page and then the data is submitted. so i started with something small. HTML FORM PAGE <form id="form1" name="form1" method="post" action="confirm.php"> Name: <label> <input type="text" name="name" /> </label> <p> <label> <input type="submit" name="button" id="button" value="Submit" /> </label> </p> </form> Confirm page: <form id="form1" name="form1" method="post" action="submit.php"> Name: <label> <input type="hidden" name="name" value="<? echo $_POST['name']?>" </label> <p> <label> <input type="submit" name="button" id="button" value="Submit" /> </label> </p> </form> When hit submit on the htmlform so i can see verify the data, i get nothing, an empty name saying : NAME: am i doing something wrong? will the values on the cofirm.php than pass to the submit.php? [attachment deleted by admin]
-
is it wrong to use exit; after the header? thanks though everyone! this has worked out!!
-
how many if statements like these can i use? if ($san) header( "Location: http://yahoo.com" ); exit; if ($san) header( "Location: http://google.com" ); exit; I have four different URLS' but only the first IF statement works. how can i get the others to work and redirect?
-
thanks BK87 , that helped! question if i use header location to redirect to the search page in the redirection url lets say http://www.yahoo.com can i use the following: http://www.yahoo.com/$search Basically can i add the variable $search in the location header or do i have to use special quotes etc?
-
<form id="form1" name="form1" method="post" action="post.php"> <label>search <input type="text" name="search" id="search" /> <select name="san"> <option value="main">main site</option> <option value="sister">sister site</option> <option value="other">other site</option> </select> </form> </body> the San is not passing any values of the drop down not sure why? would i have to do the follwoing for each? $main = ($_POST['main']);
-
<?php $search = ($_POST['search']); $san = ($_POST['san']); if ($san) { header( "Location: http://yahoo.com" ); } else echo "Have a nice day!"; ?> so i got that working, what i can't figure out is how do i pass each individual value from the <option select > because the <select name = "san"> it's only passing the "san" instead of the drop down choices. i have given them values any ideas?