0

Hi,

I tried to get this code to work, and the gist is I am trying to allow the user to edit their inputs by allowsing them to edit past submissions. But even after I put "<?php echo ?>" tags in there, it still does not work. It worked perfectly fine on a previous script, but this one does not seem to want to work. I tried making sure it was not the variable, but the variable itself was passed.

 <?php
include('mysqli_connect.php');
echo"Success";
echo '<a href="?logout"> Logout? </a>';
if(isset($_GET['logout']))
{
header ("Location: enter_passcode.html");
}
if(isset($_GET['pass']))
{
$pass=$_GET['pass'];
echo 'pass is set';
$set="SELECT title, ad_body, contact, zip_code, price, email FROM ads WHERE password=SHA1('$pass')"; 
$gets=mysqli_query($dbc,$set);
$results=mysqli_fetch_array($gets,MYSQLI_NUM);
$contact=$results[2];
$ad_body=$results[1];
$zip_code=$results[3];
$price=$results[4];
$email=$results[5];
$title=$results[0];
echo 'GET is set';
}else{ echo 'Get is not set';}
?>
<html>
<form method="post" action="post.php">
Title:
<input type="text"  name="title" value="<?php echo $title; ?>" size="30" /><p>

<textarea name="ad" rows="10" cols="40" size="150">

</textarea><p>

Passcode:<input type="password" name="passcode" size=12 />
Contact:<input type="text" name="contact" value="Enter a website,email, phone number, or other contact detail customers can use to contact you. " size=120/>
<p>Price:<input type="text" name="price" value="<?php echo $price; ?> " size=50/>
Email:<input type="text" name="email" size=50/>
<input type="submit" name="Submit" />
<input type="hidden" name="submitted"/>

</form>

</html>

Any ideas?

3
Contributors
3
Replies
19
Views
1 Year
Discussion Span
Last Post by vivosmith
0

What do you mean ' it still does not work' ? Do you see the page but there isn't any value in those fields ? Viewing the HTML code is there empty where values should be in form ? What do you mean by 'I tried making sure it was not the variable, but the variable itself was passed' ? . Did you inspect in a way (echo it , debug , write in a file or what ever) the variables you want to insert to the form as values before inserting them ?

0

I see the forms, but the variable is not entered as the value, thus they are empty. I was passing a variable from before via GET. That would then be how I get the password variable, but the variables that come from the SQL query are NULL, so I am wondering even though the password is right, it could be formatting of the input.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.